origin filter

This commit is contained in:
2025-09-06 20:17:27 -07:00
parent 735049a918
commit 804496c665

View File

@@ -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';