- Platsrutan: MapLibre GL 6.11 (självhostad, verifierad mot npm) med globprojektion, dag-/nattskugga i realtid med mjuk skymning, Natural Earth-konturer, röd nål, scroll- och knappzoom - "Spara som min plats" (bara i webbläsaren) i stället för automatisk sparning - "Dela min pin": öppet anonymt index i Cloudflare D1. Servern avrundar till 0,1°, slår själv upp stad/land (ingen fritext), en pin per ägare, borttagbar, spärr via saltad IP-hash som går ut - vendor/ markerad som -text i .gitattributes (filerna hålls byte-exakta) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
17 lines
1.0 KiB
SQL
17 lines
1.0 KiB
SQL
-- Shared pins: city level only. No free text; city/country come from the server's own reverse geocoding.
|
|
CREATE TABLE IF NOT EXISTS pins (
|
|
id TEXT PRIMARY KEY, -- random id
|
|
token_hash TEXT NOT NULL, -- sha-256 of the owner's secret (the secret itself only lives in their browser)
|
|
lat REAL NOT NULL, -- rounded to 0.1° (~11 km)
|
|
lng REAL NOT NULL,
|
|
city TEXT NOT NULL,
|
|
country TEXT NOT NULL,
|
|
cc TEXT NOT NULL, -- ISO country code
|
|
created INTEGER NOT NULL -- unix ms
|
|
);
|
|
CREATE INDEX IF NOT EXISTS pins_city ON pins (cc, city);
|
|
-- Rate limit: hashed IP (with a secret salt), expires after a few minutes. Nothing else about the visitor is stored.
|
|
CREATE TABLE IF NOT EXISTS ratelimit (k TEXT PRIMARY KEY, until INTEGER NOT NULL);
|
|
-- Server-side reverse-geocode cache per rounded position (keeps Nominatim traffic tiny)
|
|
CREATE TABLE IF NOT EXISTS geocache (k TEXT PRIMARY KEY, city TEXT, country TEXT, cc TEXT, created INTEGER NOT NULL);
|