@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 03:37 UTC

main
ts 22 lines 527 Bytes
Raw
1 export function normalizeSecureRelayUrl(value: string): string | null {
2 try {
3 const url = new URL(value.trim());
4 if (
5 url.protocol !== "https:" ||
6 url.username.length > 0 ||
7 url.password.length > 0 ||
8 url.search.length > 0 ||
9 url.hash.length > 0 ||
10 !/^\/+$/u.test(url.pathname)
11 ) {
12 return null;
13 }
14 return url.origin;
15 } catch {
16 return null;
17 }
18 }
19
20 export function isSecureRelayUrl(value: string): boolean {
21 return normalizeSecureRelayUrl(value) !== null;
22 }