Add localhost-only stats endpoint with visit analytics

This commit is contained in:
2026-03-26 13:29:55 +01:00
parent a6d7879c26
commit c5e9896e65
3 changed files with 310 additions and 1 deletions

View File

@@ -1,5 +1,17 @@
# Changelog
## 0.5.0 - 2026-03-26
- Added anonymous backend visit logging in SQLite:
- New `visit_logs` table records timestamp, hashed visitor id, and country metadata.
- New `ip_country_cache` table caches IP-to-country lookups to reduce external geo requests.
- Added simple geolocation for public IPs (best-effort) with localhost/private IP fallback labeling.
- Added localhost-only stats endpoint: `GET /stats`.
- `/stats` response now includes:
- `countries`: visit and unique visitor counts grouped by country (last 5 days window).
- `lastHour`: total visits and unique visitors in the last 60 minutes.
- `last5Days`: daily visits and unique visitors for the last 5 UTC calendar days.
- Wired visit recording to `GET /api/catalog` so app opens contribute to stats.
## 0.1.0 - 2026-03-25
- Created initial frontend-only React + TypeScript project scaffold with Vite.
- Added typed Marathon API client for fetching/searching items from `/api/items/all`.