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

Function sameServerOrigin

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

Source from the content-addressed store, hash-verified

2769const originPort = (url: URL): string => url.port || (url.protocol === "https:" ? "443" : "80");
2770
2771const sameServerOrigin = (left: string, right: string): boolean => {
2772 const leftUrl = new URL(normalizeExecutorServerConnection({ origin: left }).origin);
2773 const rightUrl = new URL(normalizeExecutorServerConnection({ origin: right }).origin);
2774 if (leftUrl.toString() === rightUrl.toString()) return true;
2775 return (
2776 leftUrl.protocol === rightUrl.protocol &&
2777 originPort(leftUrl) === originPort(rightUrl) &&
2778 LOCAL_SERVICE_HOSTS.has(leftUrl.hostname.toLowerCase()) &&
2779 LOCAL_SERVICE_HOSTS.has(rightUrl.hostname.toLowerCase())
2780 );
2781};
2782
2783const hasReachableCliDaemonManifest = (input: {
2784 readonly origin: string;

Calls 3

originPortFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected