fix: don't allow invalid url like 'http:127.0.0.1' (#766)

This commit is contained in:
Xi Gou 2024-06-16 20:19:49 +08:00 committed by GitHub
parent 705893f015
commit 68b97a6753
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,7 +3,7 @@ export const isSingBox = (version: string) => {
}
export const transformEndpointURL = (url: string) =>
/^https?/.test(url) ? url : `${window.location.protocol}//${url}`
/^https?:\/\//.test(url) ? url : `${window.location.protocol}//${url}`
export const useStringBooleanMap = () => {
const [map, setMap] = createSignal<Record<string, boolean>>({})