a2ae3de31a
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
19 lines
438 B
TypeScript
19 lines
438 B
TypeScript
export function validateGatewayUrl(url: string): boolean {
|
|
try {
|
|
const parsed = new URL(url)
|
|
if (parsed.protocol === "https:") return true
|
|
if (
|
|
parsed.protocol === "http:" &&
|
|
(parsed.hostname === "localhost" ||
|
|
parsed.hostname === "127.0.0.1" ||
|
|
parsed.hostname === "::1" ||
|
|
parsed.hostname === "[::1]")
|
|
) {
|
|
return true
|
|
}
|
|
return false
|
|
} catch {
|
|
return false
|
|
}
|
|
}
|