MCPcopy Create free account
hub / github.com/dailydotdev/apps / allowedOrigin

Function allowedOrigin

packages/world-cli/src/dev.js:33–46  ·  view source on GitHub ↗
(origin)

Source from the content-addressed store, hash-verified

31const PROTOCOL_VERSION = 2;
32
33const allowedOrigin = (origin) => {
34 if (!origin) return null;
35 try {
36 const url = new URL(origin);
37 const local = ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
38 const daily =
39 url.hostname === "daily.dev" || url.hostname.endsWith(".daily.dev");
40 return ["http:", "https:"].includes(url.protocol) && (local || daily)
41 ? url.origin
42 : null;
43 } catch {
44 return null;
45 }
46};
47
48const corsFor = (req) => {
49 const origin = allowedOrigin(req.headers.origin);

Callers 2

corsForFunction · 0.85
startDevFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected