diff --git a/gateway/edge-functions/auth.js b/gateway/edge-functions/auth.js index 326f40f..0f2a441 100644 --- a/gateway/edge-functions/auth.js +++ b/gateway/edge-functions/auth.js @@ -13,218 +13,360 @@ const CONFIG = { export async function onRequest({ request }) { const url = new URL(request.url); - const hostname = url.searchParams.get('hostname') || url.hostname; - const html = getCaptchaPage(hostname); + const rawHostname = url.searchParams.get('hostname') || url.hostname; + const hostname = rawHostname.replace(/[<>"'&]/g, ""); // Basic XSS prevention + const clientIP = request.headers.get("EO-Client-IP") || "1.1.1.1"; + const zoneID = request.headers.get("EO-Zone-ID") || "UNKNOWN"; + + const html = getCaptchaPage(hostname, clientIP, zoneID); return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8" } }); } -function getCaptchaPage(hostname) { +function getCaptchaPage(hostname, clientIP, zoneID) { return ` - + + + +
- - -
- Please complete the security check to access
- ${hostname}
-
Robots/Low-sanity commonalty should stay out.
Do the captcha to prove you are human (and welcome or not).
Protected by EdgeOne Functions
+ + ++ Ray ID: ${zoneID} + • + + • + Performance & security by LOOP Edge Functions +