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

Function sameServerOrigin

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

Source from the content-addressed store, hash-verified

2800const originPort = (url: URL): string => url.port || (url.protocol === "https:" ? "443" : "80");
2801
2802const sameServerOrigin = (left: string, right: string): boolean => {
2803 const leftUrl = new URL(normalizeExecutorServerConnection({ origin: left }).origin);
2804 const rightUrl = new URL(normalizeExecutorServerConnection({ origin: right }).origin);
2805 if (leftUrl.toString() === rightUrl.toString()) return true;
2806 return (
2807 leftUrl.protocol === rightUrl.protocol &&
2808 originPort(leftUrl) === originPort(rightUrl) &&
2809 LOCAL_SERVICE_HOSTS.has(leftUrl.hostname.toLowerCase()) &&
2810 LOCAL_SERVICE_HOSTS.has(rightUrl.hostname.toLowerCase())
2811 );
2812};
2813
2814const hasReachableCliDaemonManifest = (input: {
2815 readonly origin: string;

Calls 3

originPortFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected