tweak link handling (#7857)

This commit is contained in:
Hailey
2025-02-27 13:18:30 -08:00
committed by GitHub
parent a3d36393a1
commit a2b71e3a4b
8 changed files with 43 additions and 2 deletions
+15
View File
@@ -320,6 +320,21 @@ export function createBskyAppAbsoluteUrl(path: string): string {
return `${BSKY_APP_HOST.replace(/\/$/, '')}/${sanitizedPath}`
}
export function createProxiedUrl(url: string): string {
let u
try {
u = URL.parse(url)
} catch {
return url
}
if (u?.protocol !== 'http:' && u?.protocol !== 'https:') {
return url
}
return `https://go.bsky.app/redirect?u=${url}`
}
export function isShortLink(url: string): boolean {
return url.startsWith('https://go.bsky.app/')
}