Files
clash-verge-rev/src/utils/open-external-url.ts
T
2026-08-25 16:11:47 +08:00

12 lines
303 B
TypeScript

import { openUrl } from '@tauri-apps/plugin-opener'
export async function openExternalUrl(raw: string) {
const url = new URL(raw.trim())
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
throw new Error('Only HTTP and HTTPS URLs are allowed')
}
await openUrl(url.toString())
}