Feat: Promote every ?i= and ?src=, measured by a WAF logging rule

Analytics has no query string, so a WAF custom rule logs image requests with
theirs and promote.js splits each path's views across its variants. The
rewrite names static files after the param values (/orange%2Bcat/i2-), since
the static file server redirects names with = or &. Drops the legacy
/free/5/x paths and the /1/ segment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 19:08:03 +00:00
co-authored by Claude Opus 5.5
parent d2f8c8ffba
commit 87f80ac956
6 changed files with 114 additions and 76 deletions
+6
View File
@@ -10,6 +10,12 @@ export const TTL_SECONDS = 90 * 24 * 60 * 60;
// Higher values serve max-i.webp, which lists these, so redraw it from design/max-i.html when they change.
export const MAX_INDEX = { "": 40, free: 20, ai: 1000 };
// ?i=1 or higher (default 1). Returns null if invalid.
export function parseIndex(searchParams) {
const i = searchParams.get("i") || "1";
return /^\d+$/.test(i) && +i >= 1 ? +i : null;
}
// "free", "ai" or "" (main site), from the hostname's first label
export const siteOf = hostname => ["free", "ai"].find(s => hostname.startsWith(`${s}.`)) || "";