Referrers count only on pages we served

A scanner forging google.com on /.env showed as forty-eight Google
readers before breakfast.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
Eric Wagoner
2026-09-06 23:30:14 -04:00
co-authored by Claude Fable 5.1
parent 7af9de4a9a
commit 96c0c18d97
+4 -1
View File
@@ -69,7 +69,10 @@ for f in sorted(glob.glob("/var/lib/caddy/access*.log*")):
m = re.match(r"https?://([^/]+)", ref)
host = m.group(1) if m else ""
ours = host.endswith("kestrelsnest.social") or "104.236.96.198" in host
if host and not ours and not isbot: refs[host] += 1
# A referrer on /.env is a scanner's costume (a forged google.com),
# not a reader — and the app answers unknown paths with the page,
# so the status cannot tell them apart. Only the pages count.
if host and not ours and not isbot and key in ("/", "/clips", "/watch"): refs[host] += 1
# --- the table ---
new_rooms = 0; seats = collections.Counter()