mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-28 16:30:03 +08:00
fix(security): restrict external URL opening
Close: 7800
This commit is contained in:
+8
-4
@@ -34,7 +34,9 @@ import { HomeProfileCard } from '@/components/home/home-profile-card'
|
||||
import { ProxyTunCard } from '@/components/home/proxy-tun-card'
|
||||
import { useProfiles } from '@/hooks/use-profiles'
|
||||
import { useVerge } from '@/hooks/use-verge'
|
||||
import { entry_lightweight_mode, openWebUrl } from '@/services/cmds'
|
||||
import { entry_lightweight_mode } from '@/services/cmds'
|
||||
import { showNotice } from '@/services/notice-service'
|
||||
import { openExternalUrl } from '@/utils/open-external-url'
|
||||
|
||||
const preloadTestCard = () =>
|
||||
import('@/components/home/test-card').then((module) => ({
|
||||
@@ -240,9 +242,11 @@ const HomePage = () => {
|
||||
(verge?.home_cards as HomeCardsSettings | undefined) ?? DEFAULT_HOME_CARDS
|
||||
|
||||
// 文档链接函数
|
||||
const toGithubDoc = useLockFn(() => {
|
||||
return openWebUrl('https://clash-verge-rev.github.io/index.html')
|
||||
})
|
||||
const toGithubDoc = useLockFn(() =>
|
||||
openExternalUrl('https://clash-verge-rev.github.io/index.html').catch(
|
||||
showNotice.error,
|
||||
),
|
||||
)
|
||||
|
||||
// 新增:打开设置弹窗
|
||||
const openSettings = useCallback(() => {
|
||||
|
||||
+14
-10
@@ -8,9 +8,9 @@ import SettingClash from '@/components/setting/setting-clash'
|
||||
import SettingSystem from '@/components/setting/setting-system'
|
||||
import SettingVergeAdvanced from '@/components/setting/setting-verge-advanced'
|
||||
import SettingVergeBasic from '@/components/setting/setting-verge-basic'
|
||||
import { openWebUrl } from '@/services/cmds'
|
||||
import { showNotice } from '@/services/notice-service'
|
||||
import { useThemeMode } from '@/services/states'
|
||||
import { openExternalUrl } from '@/utils/open-external-url'
|
||||
|
||||
const SettingPage = () => {
|
||||
const { t } = useTranslation()
|
||||
@@ -19,17 +19,21 @@ const SettingPage = () => {
|
||||
showNotice.error(err)
|
||||
}
|
||||
|
||||
const toGithubRepo = useLockFn(() => {
|
||||
return openWebUrl('https://github.com/clash-verge-rev/clash-verge-rev')
|
||||
})
|
||||
const toGithubRepo = useLockFn(() =>
|
||||
openExternalUrl('https://github.com/clash-verge-rev/clash-verge-rev').catch(
|
||||
onError,
|
||||
),
|
||||
)
|
||||
|
||||
const toGithubDoc = useLockFn(() => {
|
||||
return openWebUrl('https://clash-verge-rev.github.io/index.html')
|
||||
})
|
||||
const toGithubDoc = useLockFn(() =>
|
||||
openExternalUrl('https://clash-verge-rev.github.io/index.html').catch(
|
||||
onError,
|
||||
),
|
||||
)
|
||||
|
||||
const toTelegramChannel = useLockFn(() => {
|
||||
return openWebUrl('https://t.me/clash_verge_re')
|
||||
})
|
||||
const toTelegramChannel = useLockFn(() =>
|
||||
openExternalUrl('https://t.me/clash_verge_re').catch(onError),
|
||||
)
|
||||
|
||||
const mode = useThemeMode()
|
||||
const isDark = mode === 'light' ? false : true
|
||||
|
||||
Reference in New Issue
Block a user