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

Function sameServerOrigin

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

Source from the content-addressed store, hash-verified

2829const originPort = (url: URL): string => url.port || (url.protocol === "https:" ? "443" : "80");
2830
2831const sameServerOrigin = (left: string, right: string): boolean => {
2832 const leftUrl = new URL(normalizeExecutorServerConnection({ origin: left }).origin);
2833 const rightUrl = new URL(normalizeExecutorServerConnection({ origin: right }).origin);
2834 if (leftUrl.toString() === rightUrl.toString()) return true;
2835 return (
2836 leftUrl.protocol === rightUrl.protocol &&
2837 originPort(leftUrl) === originPort(rightUrl) &&
2838 LOCAL_SERVICE_HOSTS.has(leftUrl.hostname.toLowerCase()) &&
2839 LOCAL_SERVICE_HOSTS.has(rightUrl.hostname.toLowerCase())
2840 );
2841};
2842
2843const hasReachableCliDaemonManifest = (input: {
2844 readonly origin: string;

Calls 3

originPortFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected