From 804496c665e018f8a56a594558e50366be3530e4 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Sat, 6 Sep 2025 20:17:27 -0700 Subject: [PATCH] origin filter --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index 37ec9d7..d77f0fd 100644 --- a/index.js +++ b/index.js @@ -29,6 +29,8 @@ export default { if (method === 'OPTIONS') return new Response(null, { status: 204, headers: CORS_HEADERS }); + if ((h => h !== 'sune.planetrenox.com' && !h.endsWith('.github.io'))(new URL(req.headers.get('Origin') || 'null').hostname)) return withCORS(new Response('Forbidden', { status: 403 })); + if (url.pathname === '/ws') { const isGet = method === 'GET'; const isWs = req.headers.get('Upgrade') === 'websocket';