fix(security): restrict external URL opening

Close: 7800
This commit is contained in:
Tunglies
2026-08-25 16:11:47 +08:00
parent b7c4f7d39b
commit 695fadf21e
17 changed files with 136 additions and 61 deletions
+3 -2
View File
@@ -18,7 +18,6 @@ import {
MenuItem,
Typography,
} from '@mui/material'
import { open } from '@tauri-apps/plugin-shell'
import { useLockFn } from 'ahooks'
import dayjs from 'dayjs'
import {
@@ -47,6 +46,7 @@ import { showNotice } from '@/services/notice-service'
import { useLoadingCache, useSetLoadingCache } from '@/services/states'
import type { TranslationKey } from '@/types/generated/i18n-keys'
import { debugLog } from '@/utils/debug'
import { openExternalUrl } from '@/utils/open-external-url'
import parseTraffic from '@/utils/parse-traffic'
import { ProfileBox } from './profile-box'
@@ -316,7 +316,8 @@ const ProfileItemBase = (props: ProfileItemProps) => {
const onOpenHome = () => {
setAnchorEl(null)
open(itemData.home ?? '')
if (!itemData.home) return
void openExternalUrl(itemData.home).catch(showNotice.error)
}
const onEditInfo = () => {