feat: add option to disable filtering for onion relays

This commit is contained in:
codytseng 2025-11-15 13:58:20 +08:00
parent 606f9af1ba
commit 5ba5c26fcd
25 changed files with 98 additions and 36 deletions

View file

@ -2,6 +2,15 @@ export function isWebsocketUrl(url: string): boolean {
return /^wss?:\/\/.+$/.test(url)
}
export function isOnionUrl(url: string): boolean {
try {
const hostname = new URL(url).hostname
return hostname.endsWith('.onion')
} catch {
return false
}
}
// copy from nostr-tools/utils
export function normalizeUrl(url: string): string {
try {