mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-06 07:01:52 +09:00
- models.py: 4 tables (site/event/daily/log_cursor), all ext_serverkit_analytics_* prefixed; site_key generator; JSON settings blob. - ingest_service.py: cookieless visitor hashing (daily-rotating in-memory HMAC salt, never persisted, raw IP/UA discarded), UA bot filter + lightweight browser/os/device parse, in-process token-bucket rate limiter (per site_key + per IP), buffered batch inserts with a daemon flush thread (5s / buffer_max, skipped under TESTING), payload validation + event build. - analytics.py: public POST /collect (site_key auth, 8 KB body cap, per-site origin allowlist + reflected CORS, DNT + bot drop as silent 204, 429 on rate limit) and GET /tracker.js (placeholder; real build Phase 3). Client IP via the plan-48 trusted-proxy helper. - rollup_service.py: retention prune (raw events + old rollups); rollup stub. - 39 proving tests (models/purge, bot/UA/hash units, collector happy path + 404/403/400/413/429, DNT + per-site override, origin allowlist, CORS reflect, preflight, query-string gate, retention prune). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>