Publish, edit, renew and delete listings from the web UI

- Form at #/mine/new and #/mine/<id>/edit: coordinates pasted and encoded
  to a precision-6 geohash in the browser (about 1 km, OSM link to check, no
  map tiles), euro price parsing, optional exact address saved on the node only
- Region guard: refuses places the node does not follow; region fixed on edit
- Owner view: days left with a warning under 5 days, manual Renew (30 days),
  Edit, Delete with confirmation
- Tests (jsdom and pure logic), docs, rebuilt web/dist

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 20:18:08 +01:00
co-authored by Claude Sonnet 5.5
parent 7348067350
commit d021989f09
16 changed files with 1846 additions and 87 deletions
+22 -2
View File
@@ -382,7 +382,27 @@ needed to change the UI (`cd web && npm ci && npm run build`).
- **Untrusted text.** Listing text is only ever inserted with `textContent`.
The CSP is `default-src 'none'; script-src 'self'; style-src 'self'; ...`
(no inline script or style), plus `nosniff` and `no-referrer`.
- Publishing is not in the UI yet; it stays on the token-protected API.
- **Publishing** (owner only, after the login link): `#/mine/new` creates a
listing, `#/mine/<id>/edit` changes one, and the owner view offers Renew and
Delete. The form maps to the draft of `POST`/`PUT /api/v1/listings`:
- *Location*: the owner pastes coordinates (`53.5511, 9.9937`, German decimal
comma with `;`, or an OpenStreetMap/Google Maps link). The browser encodes a
precision-6 geohash itself, shows its size (about 1 km) and an
OpenStreetMap link to check it; no map tiles are loaded. "Use my location"
appears only where the browser allows geolocation. A place outside the
regions the node follows is refused client-side, since the node would not
receive messages for it; a region cannot change on edit.
- *Price*: entered in euros (`1.150,50`, `1,150.50`, `1150`), sent as cents;
the period follows the offer (month for rent, once for sale).
- *Exact address*, phone and email: optional, only when creating. They are
saved with `PUT .../address` after the listing exists and never enter the
listing. Later they are edited on the request screen.
- *Renewal* is manual: Renew re-publishes the listing unchanged with a
fresh 30-day term (a new `seq`). Cards show the days left and warn under
5 days. There is no auto-renew; an unattended node's listings simply expire.
- *Delete* asks first, then publishes a tombstone.
- The node mines the proof-of-work while the request is open, so the form
shows a "publishing" state for a few seconds.
## Running a node (`cmd/node`)
@@ -401,6 +421,6 @@ Proof-of-work per listing and per revocation, plus subscribable blocklists
Abuse reporting for messages, reciprocity rules, anti-
discrimination (AGG) content rules, blocklists, peer scoring and rate limits,
incremental sync and anti-entropy, DHT discovery, UI publishing, image hosting,
incremental sync and anti-entropy, DHT discovery, image hosting,
recovering listings onto a fresh machine with an empty database, a helper to
turn a place name into a region.