9router/src/app/(dashboard)/dashboard/cli-tools/components/cliEndpointMatch.js
decolua 5c62e73cc6 - Cowork: ComboFormModal
- BaseUrlSelect: add cloud endpoint option, custom URL local state, always
  default to first option; new cliEndpointMatch helper; CLI tool cards refactor
- API: new /v1/audio/voices and /v1/models/info; /v1/models filters disabled
  models, drop unused timestamp
- initializeApp: guard tunnel/tailscale auto-resume to once-per-process
- geminiHelper: ensureObjectType for schemas with properties but no type
- skills: minor SKILL.md tweaks (chat/embeddings/image/stt/tts/web-*)
2026-05-07 15:45:09 +07:00

13 lines
696 B
JavaScript

// Match a configured CLI base URL against all known endpoints (local/tunnel/tailscale/cloud)
const stripTrailingSlash = (s) => (s || "").replace(/\/+$/, "");
export function matchKnownEndpoint(currentUrl, opts = {}) {
if (!currentUrl) return false;
const url = stripTrailingSlash(currentUrl);
const { tunnelPublicUrl, tailscaleUrl, cloudUrl } = opts;
if (/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(url)) return true;
if (tunnelPublicUrl && url.startsWith(stripTrailingSlash(tunnelPublicUrl))) return true;
if (tailscaleUrl && url.startsWith(stripTrailingSlash(tailscaleUrl))) return true;
if (cloudUrl && url.startsWith(stripTrailingSlash(cloudUrl))) return true;
return false;
}