MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / sameServerOrigin

Function sameServerOrigin

apps/cli/src/main.ts:2723–2733  ·  view source on GitHub ↗
(left: string, right: string)

Source from the content-addressed store, hash-verified

2721const originPort = (url: URL): string => url.port || (url.protocol === "https:" ? "443" : "80");
2722
2723const sameServerOrigin = (left: string, right: string): boolean => {
2724 const leftUrl = new URL(normalizeExecutorServerConnection({ origin: left }).origin);
2725 const rightUrl = new URL(normalizeExecutorServerConnection({ origin: right }).origin);
2726 if (leftUrl.toString() === rightUrl.toString()) return true;
2727 return (
2728 leftUrl.protocol === rightUrl.protocol &&
2729 originPort(leftUrl) === originPort(rightUrl) &&
2730 LOCAL_SERVICE_HOSTS.has(leftUrl.hostname.toLowerCase()) &&
2731 LOCAL_SERVICE_HOSTS.has(rightUrl.hostname.toLowerCase())
2732 );
2733};
2734
2735const hasReachableCliDaemonManifest = (input: {
2736 readonly origin: string;

Calls 3

originPortFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected