mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-03 13:32:16 +08:00
12 lines
303 B
TypeScript
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())
|
|
}
|