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

Function sameServerOrigin

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

Source from the content-addressed store, hash-verified

2899const originPort = (url: URL): string => url.port || (url.protocol === "https:" ? "443" : "80");
2900
2901const sameServerOrigin = (left: string, right: string): boolean => {
2902 const leftUrl = new URL(normalizeExecutorServerConnection({ origin: left }).origin);
2903 const rightUrl = new URL(normalizeExecutorServerConnection({ origin: right }).origin);
2904 if (leftUrl.toString() === rightUrl.toString()) return true;
2905 return (
2906 leftUrl.protocol === rightUrl.protocol &&
2907 originPort(leftUrl) === originPort(rightUrl) &&
2908 LOCAL_SERVICE_HOSTS.has(leftUrl.hostname.toLowerCase()) &&
2909 LOCAL_SERVICE_HOSTS.has(rightUrl.hostname.toLowerCase())
2910 );
2911};
2912
2913const hasReachableCliDaemonManifest = (input: {
2914 readonly origin: string;

Calls 3

originPortFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected