mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-25 07:02:08 +08:00
fix(security): restrict external URL opening
Close: 7800
This commit is contained in:
@@ -25,8 +25,9 @@ import { useTranslation } from 'react-i18next'
|
||||
import { useNavigate } from 'react-router'
|
||||
|
||||
import { useAppRefreshers } from '@/providers/app-data-context'
|
||||
import { openWebUrl, updateProfile } from '@/services/cmds'
|
||||
import { updateProfile } from '@/services/cmds'
|
||||
import { showNotice } from '@/services/notice-service'
|
||||
import { openExternalUrl } from '@/utils/open-external-url'
|
||||
import parseTraffic from '@/utils/parse-traffic'
|
||||
|
||||
import { EnhancedCard } from './enhanced-card'
|
||||
@@ -49,6 +50,10 @@ const parseExpire = (expire?: number) => {
|
||||
return dayjs(expire * 1000).format('YYYY-MM-DD')
|
||||
}
|
||||
|
||||
const openProfileHome = (url: string) => {
|
||||
void openExternalUrl(url).catch(showNotice.error)
|
||||
}
|
||||
|
||||
// 使用类型定义,而不是导入
|
||||
interface ProfileExtra {
|
||||
upload: number
|
||||
@@ -115,7 +120,7 @@ const ProfileDetails = ({
|
||||
{current.home ? (
|
||||
<Link
|
||||
component="button"
|
||||
onClick={() => current.home && openWebUrl(current.home)}
|
||||
onClick={() => current.home && openProfileHome(current.home)}
|
||||
sx={{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
@@ -318,7 +323,7 @@ export const HomeProfileCard = ({
|
||||
<Link
|
||||
component="button"
|
||||
variant="h6"
|
||||
onClick={() => current.home && openWebUrl(current.home)}
|
||||
onClick={() => current.home && openProfileHome(current.home)}
|
||||
sx={{
|
||||
color: 'inherit',
|
||||
textDecoration: 'none',
|
||||
|
||||
Reference in New Issue
Block a user