diff --git a/src/openclaw/dispatcher.ts b/src/openclaw/dispatcher.ts index 173819c93..7c777a39e 100644 --- a/src/openclaw/dispatcher.ts +++ b/src/openclaw/dispatcher.ts @@ -1,30 +1,11 @@ import { spawn } from "bun" +import { validateGatewayUrl } from "./config" import type { OpenClawGateway, WakeResult } from "./types" const DEFAULT_HTTP_TIMEOUT_MS = 10_000 const DEFAULT_COMMAND_TIMEOUT_MS = 5_000 const MIN_COMMAND_TIMEOUT_MS = 100 const MAX_COMMAND_TIMEOUT_MS = 300_000 -const SHELL_METACHAR_RE = /[|&;><`$()]/ - -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 - } -} export function interpolateInstruction( template: string,