OSM-Beiträge: dog=yes-Erfassung mit GPS/Zeit-Anti-Fraud + Gamification-Zähler

- Tabelle osm_contributions (status pending→submitted→confirmed/rejected).
- Router /api/osm-contrib: POST /dog-friendly (Anti-Fraud: GPS-Beleg über
  kürzliche eigene Tour ≤50m + Verweil-Proxy, Tour-Recency 48h, Tages-Cap,
  Dedup, Positions-Sanity), GET /status (Zähler).
- Settings-UI: Zähler "X Orte eingetragen · noch Y bis Badge/Pro".
- OSM-Changeset-Upload + Pro-Freischaltung + Geräte-Attestierung folgen separat.
This commit is contained in:
rene 2026-06-03 21:20:32 +02:00
parent 46caa05020
commit 1cfaa0264f
4 changed files with 186 additions and 0 deletions

View file

@ -943,6 +943,7 @@ window.Page_settings = (() => {
<svg class="ph-icon" style="color:var(--c-success)" aria-hidden="true"><use href="/icons/phosphor.svg#check-circle"></use></svg>
<span style="font-size:var(--text-sm)">Verknüpft als <strong>${UI.escape(st.osm_name)}</strong></span>
</div>
<div id="settings-osm-count" class="text-sm-muted" style="margin-top:var(--space-3)"></div>
<button id="settings-osm-unlink"
style="margin-top:var(--space-3);background:none;border:none;
color:var(--c-text-muted);font-size:var(--text-xs);cursor:pointer">
@ -952,6 +953,15 @@ window.Page_settings = (() => {
try { await API.post('/osm-auth/unlink', {}); } catch (e) {}
_osmLink();
});
// Gamification-Zähler
API.get('/osm-contrib/status').then(cs => {
const c = document.getElementById('settings-osm-count');
if (!c) return;
const n = cs.verified_count || 0;
const next = n >= cs.pro_at ? 0 : (n < 10 ? 10 - n : cs.pro_at - n);
c.innerHTML = `🐾 <strong>${n}</strong> hundefreundliche Orte eingetragen`
+ (next ? ` · noch ${next} bis ${n < 10 ? 'zum Kartograf-Badge' : '1 Jahr Pro'}` : ' · Ziel erreicht! 🎉');
}).catch(() => { const c = document.getElementById('settings-osm-count'); if (c) c.textContent=''; });
} else {
el.innerHTML = `
<p class="text-sm-muted" style="margin:0 0 var(--space-3);line-height:1.45">