mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-26 23:30:09 +08:00
fix(proxy): validate user-entered URLs via isValidUrl
Delay test inputs now reject non-http(s) URLs with a warning toast and fall back to the default URL instead of erroring every node in the core. Subscription import and profile card host parsing reuse the same validator, fixing bare-domain URLs shown as local files and credential-bearing URLs leaking into the card.
This commit is contained in:
@@ -43,6 +43,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 { isValidUrl } from '@/utils/network'
|
||||
import { openExternalUrl } from '@/utils/open-external-url'
|
||||
import parseTraffic from '@/utils/parse-traffic'
|
||||
|
||||
@@ -965,9 +966,7 @@ export const ProfileItem = memo(ProfileItemBase)
|
||||
|
||||
function parseUrl(url?: string) {
|
||||
if (!url) return ''
|
||||
const regex = /https?:\/\/(.+?)\//
|
||||
const result = url.match(regex)
|
||||
return result ? result[1] : 'local file'
|
||||
return isValidUrl(url) ? new URL(url).host : 'local file'
|
||||
}
|
||||
|
||||
function parseExpire(expire?: number) {
|
||||
|
||||
Reference in New Issue
Block a user