Let the owner change regions by place name, without a restart

The p2p node can now add and drop regions while running (SetRegions):
topics, validators, subscriptions and per-region peer discovery start and
stop with them, and a newly followed region catches up by sync.

PUT /api/v1/regions (owner token) applies a change and the node saves it in
regions.json, which wins over --region from then on. The owner's browser
gets a "Regions" page: search a place by name (GeoNames cities, offline,
CC BY 4.0), follow its cell plus any cell within about 40 km.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-18 10:28:16 +01:00
co-authored by Claude Sonnet 5.5
parent e7bec4fb63
commit fd439710df
24 changed files with 70080 additions and 42 deletions
+382 -20
View File
@@ -212,6 +212,31 @@ var de = {
"own.login": "Anmelden",
"own.loginBad": "Der Knoten hat den Token abgelehnt.",
"own.logout": "Abmelden",
"reg.title": "Regionen",
"reg.intro": "Dein Knoten h\xE4lt die Anzeigen dieser Regionen bereit und gibt sie an andere weiter. Suche einen Ort, zum Beispiel Bonn oder Hamburg. Die \xC4nderung gilt sofort und bleibt nach einem Neustart erhalten.",
"reg.search": "Ort suchen",
"reg.placeholder": "z. B. Bonn, K\xF6ln, Hamburg",
"reg.results": "Gefundene Orte",
"reg.none": "Dazu habe ich keinen Ort gefunden. Pr\xFCfe die Schreibweise, oder gib unten ein Regionsk\xFCrzel ein.",
"reg.noPlaces": "Die Ortsliste konnte nicht geladen werden. Du kannst unten Regionsk\xFCrzel eingeben.",
"reg.cellsTitle": "Regionen rund um {place}",
"reg.cellsHelp": "Eine Region ist ein Gebiet von etwa 100 bis 150 km Breite. Liegt der Ort nahe am Rand, kommt die Nachbarregion dazu, damit dir Anzeigen gleich hinter der Grenze nicht fehlen. Nimm den Haken heraus, was du nicht brauchst.",
"reg.here": "hier",
"reg.add": "Hinzuf\xFCgen",
"reg.chosen": "Ausgew\xE4hlte Regionen",
"reg.nothing": "Noch keine Region ausgew\xE4hlt.",
"reg.remove": "{region} entfernen",
"reg.codes": "Oder Regionsk\xFCrzel eingeben",
"reg.codesHelp": "F\xFCr alle, die sie kennen: drei Zeichen wie u1j, mehrere mit Komma getrennt.",
"reg.badCode": "\u201E{code}\u201C ist keine Region: es m\xFCssen genau 3 Zeichen sein (Ziffern und Buchstaben au\xDFer a, i, l, o).",
"reg.needOne": "W\xE4hle mindestens eine Region.",
"reg.tooMany": "Das sind zu viele Regionen (h\xF6chstens {max}).",
"reg.save": "Speichern",
"reg.saving": "Speichert \u2026",
"reg.saved": "Gespeichert. Der Knoten folgt jetzt diesen Regionen.",
"reg.failed": "Das hat nicht geklappt.",
"reg.signedOut": "Du bist abgemeldet. Melde dich unter \u201EMeine Anzeigen\u201C neu an.",
"reg.credit": "Ortsnamen: GeoNames (geonames.org), Lizenz CC BY 4.0.",
"own.listings": "Deine Anzeigen",
"own.none": "Dein Knoten hat keine aktiven Anzeigen.",
"own.perMonth": "/ Monat",
@@ -436,6 +461,31 @@ var en = {
"own.login": "Sign in",
"own.loginBad": "The node rejected the token.",
"own.logout": "Sign out",
"reg.title": "Regions",
"reg.intro": "Your node keeps the listings of these regions and passes them on to others. Search for a place, for example Bonn or Hamburg. A change applies at once and survives a restart.",
"reg.search": "Search for a place",
"reg.placeholder": "e.g. Bonn, Cologne, Hamburg",
"reg.results": "Places found",
"reg.none": "I found no place for that. Check the spelling, or enter a region code below.",
"reg.noPlaces": "The list of places could not be loaded. You can enter region codes below.",
"reg.cellsTitle": "Regions around {place}",
"reg.cellsHelp": "A region is an area roughly 100 to 150 km across. If the place is near an edge, the neighbouring region is included so you do not miss listings just across the border. Untick what you do not need.",
"reg.here": "here",
"reg.add": "Add",
"reg.chosen": "Chosen regions",
"reg.nothing": "No region chosen yet.",
"reg.remove": "Remove {region}",
"reg.codes": "Or enter region codes",
"reg.codesHelp": "For those who know them: three characters like u1j, several separated by commas.",
"reg.badCode": "\u201C{code}\u201D is not a region: it must be exactly 3 characters (digits and letters except a, i, l, o).",
"reg.needOne": "Choose at least one region.",
"reg.tooMany": "That is too many regions (at most {max}).",
"reg.save": "Save",
"reg.saving": "Saving \u2026",
"reg.saved": "Saved. The node now follows these regions.",
"reg.failed": "That did not work.",
"reg.signedOut": "You are signed out. Sign in again under \u201CMy listings\u201D.",
"reg.credit": "Place names: GeoNames (geonames.org), licence CC BY 4.0.",
"own.listings": "Your listings",
"own.none": "Your node has no active listings.",
"own.perMonth": "/ month",
@@ -711,7 +761,7 @@ function keepFresh(alive, run, ms = FOREGROUND_MS, doc = document) {
schedule();
}
// node_modules/@noble/ciphers/utils.js
// ../../web/node_modules/@noble/ciphers/utils.js
/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
function isBytes(a) {
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
@@ -890,7 +940,7 @@ function copyBytes(bytes2) {
return Uint8Array.from(abytes(bytes2));
}
// node_modules/@noble/ciphers/_arx.js
// ../../web/node_modules/@noble/ciphers/_arx.js
var encodeStr = (str) => Uint8Array.from(str.split(""), (c) => c.charCodeAt(0));
var sigma16_32 = /* @__PURE__ */ (() => swap32IfBE(u32(encodeStr("expand 16-byte k"))))();
var sigma32_32 = /* @__PURE__ */ (() => swap32IfBE(u32(encodeStr("expand 32-byte k"))))();
@@ -1020,7 +1070,7 @@ function createCipher(core, opts) {
};
}
// node_modules/@noble/ciphers/_poly1305.js
// ../../web/node_modules/@noble/ciphers/_poly1305.js
function u8to16(a, i) {
return a[i++] & 255 | (a[i++] & 255) << 8;
}
@@ -1271,7 +1321,7 @@ var Poly1305 = class {
};
var poly1305 = /* @__PURE__ */ wrapMacConstructor(32, (key) => new Poly1305(key));
// node_modules/@noble/ciphers/chacha.js
// ../../web/node_modules/@noble/ciphers/chacha.js
function chachaCore(s, k, n, out, cnt, rounds = 20) {
let y00 = s[0], y01 = s[1], y02 = s[2], y03 = s[3], y04 = k[0], y05 = k[1], y06 = k[2], y07 = k[3], y08 = k[4], y09 = k[5], y10 = k[6], y11 = k[7], y12 = cnt, y13 = n[0], y14 = n[1], y15 = n[2];
let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;
@@ -1421,7 +1471,7 @@ var chacha20poly1305 = /* @__PURE__ */ wrapCipher(
/* @__PURE__ */ _poly1305_aead(chacha20)
);
// node_modules/@noble/hashes/_u64.js
// ../../web/node_modules/@noble/hashes/_u64.js
var U32_MASK64 = /* @__PURE__ */ (() => BigInt(2 ** 32 - 1))();
var _32n = /* @__PURE__ */ BigInt(32);
function fromBig(n, le = false) {
@@ -1464,7 +1514,7 @@ var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0
var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
// node_modules/@noble/hashes/utils.js
// ../../web/node_modules/@noble/hashes/utils.js
function isBytes2(a) {
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
}
@@ -1629,7 +1679,7 @@ var oidNist = (suffix) => ({
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
});
// node_modules/@noble/hashes/_md.js
// ../../web/node_modules/@noble/hashes/_md.js
function Chi(a, b, c) {
return a & b ^ ~a & c;
}
@@ -1760,7 +1810,7 @@ var SHA512_IV = /* @__PURE__ */ Uint32Array.from([
327033209
]);
// node_modules/@noble/hashes/sha2.js
// ../../web/node_modules/@noble/hashes/sha2.js
var SHA256_K = /* @__PURE__ */ Uint32Array.from([
1116352408,
1899447441,
@@ -2157,7 +2207,7 @@ var sha512 = /* @__PURE__ */ createHasher(
/* @__PURE__ */ oidNist(3)
);
// node_modules/@noble/curves/utils.js
// ../../web/node_modules/@noble/curves/utils.js
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
function aarray(item, title, inner = () => {
}) {
@@ -2278,7 +2328,7 @@ function validateObject(object, fields = {}, optFields = {}, title = "object") {
iter(optFields, true);
}
// node_modules/@noble/curves/abstract/modular.js
// ../../web/node_modules/@noble/curves/abstract/modular.js
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
var _0n2 = /* @__PURE__ */ BigInt(0);
var _1n2 = /* @__PURE__ */ BigInt(1);
@@ -2708,7 +2758,7 @@ function Field(ORDER, opts = {}) {
return new _Field(ORDER, opts);
}
// node_modules/@noble/curves/abstract/curve.js
// ../../web/node_modules/@noble/curves/abstract/curve.js
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
var _0n3 = /* @__PURE__ */ BigInt(0);
var _1n3 = /* @__PURE__ */ BigInt(1);
@@ -3096,7 +3146,7 @@ function createKeygen(randomSecretKey, getPublicKey) {
};
}
// node_modules/@noble/curves/abstract/edwards.js
// ../../web/node_modules/@noble/curves/abstract/edwards.js
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
var _0n4 = /* @__PURE__ */ BigInt(0);
var _1n4 = /* @__PURE__ */ BigInt(1);
@@ -3548,7 +3598,7 @@ function eddsa(Point, cHash, eddsaOpts = {}) {
});
}
// node_modules/@noble/curves/abstract/montgomery.js
// ../../web/node_modules/@noble/curves/abstract/montgomery.js
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
var _0n5 = /* @__PURE__ */ BigInt(0);
var _1n5 = /* @__PURE__ */ BigInt(1);
@@ -3696,7 +3746,7 @@ function montgomery(curveDef) {
});
}
// node_modules/@noble/curves/ed25519.js
// ../../web/node_modules/@noble/curves/ed25519.js
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
var _0n6 = /* @__PURE__ */ BigInt(0);
var _1n6 = /* @__PURE__ */ BigInt(1);
@@ -3797,7 +3847,7 @@ var x25519 = /* @__PURE__ */ (() => {
});
})();
// node_modules/@noble/hashes/hmac.js
// ../../web/node_modules/@noble/hashes/hmac.js
var _HMAC = class {
oHash;
iHash;
@@ -3874,7 +3924,7 @@ var hmac = /* @__PURE__ */ (() => {
return hmac_;
})();
// node_modules/@noble/hashes/hkdf.js
// ../../web/node_modules/@noble/hashes/hkdf.js
var HKDF_COUNTER = /* @__PURE__ */ Uint8Array.of(0);
var EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
function expand(hash, prk, info, length = 32, _recycled) {
@@ -4815,6 +4865,9 @@ async function putAddress(listing, a) {
async function deleteAddress(listing) {
await call("DELETE", `/api/v1/listings/${e(listing)}/address`);
}
async function setRegions(regions) {
return (await call("PUT", "/api/v1/regions", { regions })).regions;
}
async function createListing(d) {
return await call("POST", "/api/v1/listings", d);
}
@@ -4885,7 +4938,7 @@ async function showOwner(listingId, thread) {
let threads = [];
let msgs = [];
let filter = "all";
let loaded2 = false;
let loaded3 = false;
const notice = h("p", { class: "error", role: "alert" });
const listingsBox = h("div", { class: "olist" });
const listingsPane = h(
@@ -4894,6 +4947,7 @@ async function showOwner(listingId, thread) {
h("h2", { class: "pane-title" }, t("own.listings")),
h("p", null, h("a", { class: "btn primary", href: "#/mine/new" }, t("own.new"))),
listingsBox,
h("p", null, h("a", { class: "btn", href: "#/mine/regions" }, t("reg.title"))),
h("p", null, h("button", { type: "button", class: "btn", onclick: logout }, t("own.logout")))
);
const reqTitle = h("h2", { class: "pane-title" });
@@ -4937,7 +4991,7 @@ async function showOwner(listingId, thread) {
const kindLabel = (k) => k === "rent" || k === "sale" ? t(`kind.${k}`) : k ?? "";
function renderListings() {
clear(listingsBox);
if (loaded2 && mine2.length === 0) listingsBox.append(h("p", { class: "muted" }, t("own.none")));
if (loaded3 && mine2.length === 0) listingsBox.append(h("p", { class: "muted" }, t("own.none")));
for (const m of mine2) {
const sub = [kindLabel(m.kind), m.price ? price({ price: m.price }) : ""].filter(Boolean).join(" \xB7 ");
listingsBox.append(
@@ -4994,7 +5048,7 @@ async function showOwner(listingId, thread) {
}
const shown = threads.filter((x) => filter === "all" || (filter === "reply" ? x.needs_reply : x.hidden > 0));
clear(reqBox);
if (loaded2 && shown.length === 0) reqBox.append(h("p", { class: "muted" }, t("own.noMatch")));
if (loaded3 && shown.length === 0) reqBox.append(h("p", { class: "muted" }, t("own.noMatch")));
for (const th of shown) {
reqBox.append(
h(
@@ -5047,7 +5101,7 @@ async function showOwner(listingId, thread) {
}
if (gen !== state.generation) return;
notice.textContent = "";
loaded2 = true;
loaded3 = true;
renderAll();
}
renderListings();
@@ -5679,6 +5733,313 @@ async function showPublish(editId) {
syncKind();
}
// src/places.ts
function fold(s) {
return s.normalize("NFD").replace(/\p{M}/gu, "").replace(/ß/g, "ss").toLowerCase();
}
function unTranslit(s) {
return s.replace(/ae/g, "a").replace(/oe/g, "o").replace(/ue/g, "u");
}
function parsePlaces(tsv) {
const out = [];
for (const line of tsv.split("\n")) {
if (!line) continue;
const [name, ascii, lat, lon, cc, pop, alt] = line.split(" ");
if (!name || lat === void 0 || lon === void 0) continue;
const alts = alt ? alt.split("|") : [];
const keys = [name, ...alts].map(fold);
if (ascii) keys.push(fold(ascii));
out.push({ name, lat: Number(lat), lon: Number(lon), cc: cc ?? "", population: Number(pop) || 0, alts, keys });
}
return out;
}
function score(key, q) {
if (key === q) return 0;
if (key.startsWith(q)) return 1;
if (key.split(/[\s-]+/).some((w) => w.startsWith(q))) return 2;
return q.length >= 3 && key.includes(q) ? 3 : 4;
}
function searchPlaces(places, query, limit = 8) {
const q1 = fold(query.trim());
if (q1.length < 2) return [];
const qs = [.../* @__PURE__ */ new Set([q1, unTranslit(q1)])];
const hits = [];
for (const p of places) {
let best = 4;
let bestKey = 0;
for (let i = 0; i < p.keys.length; i++) {
for (const q of qs) {
const s = score(p.keys[i], q);
if (s < best) [best, bestKey] = [s, i];
}
}
if (best < 4) {
const matched = bestKey >= 1 && bestKey <= p.alts.length ? p.alts[bestKey - 1] : null;
hits.push({ m: { place: p, matched }, s: best });
}
}
hits.sort((a, b) => a.s - b.s || b.m.place.population - a.m.place.population);
return hits.slice(0, limit).map((h2) => h2.m);
}
var KM_PER_DEGREE = 111.2;
function cellsNear(lat, lon, km = 40) {
const cell = (la, lo) => encodeGeohash(Math.max(-89.999, Math.min(89.999, la)), ((lo + 180) % 360 + 360) % 360 - 180, 3);
const out = [cell(lat, lon)];
const dLat = 1 / KM_PER_DEGREE;
const dLon = 1 / (KM_PER_DEGREE * Math.max(0.05, Math.cos(lat * Math.PI / 180)));
for (const r of [km / 2, km]) {
for (let i = 0; i < 16; i++) {
const a = i / 16 * 2 * Math.PI;
const c = cell(lat + Math.sin(a) * r * dLat, lon + Math.cos(a) * r * dLon);
if (!out.includes(c)) out.push(c);
}
}
return out;
}
function biggestPlaceByCell(places) {
const by = /* @__PURE__ */ new Map();
for (const p of places) {
const c = encodeGeohash(p.lat, p.lon, 3);
const cur = by.get(c);
if (!cur || p.population > cur.population) by.set(c, p);
}
return by;
}
var loaded2 = null;
function loadPlaces() {
loaded2 ??= fetch("places.tsv").then((r) => {
if (!r.ok) throw new Error(`${r.status}`);
return r.text();
}).then(parsePlaces).catch((e2) => {
loaded2 = null;
throw e2;
});
return loaded2;
}
// src/regions.ts
var CODE = /^[0-9bcdefghjkmnpqrstuvwxyz]{3}$/;
var MAX_REGIONS = 20;
function countryName(cc) {
try {
return new Intl.DisplayNames([lang], { type: "region" }).of(cc) ?? cc;
} catch {
return cc;
}
}
function errText(e2) {
if (e2 instanceof Unauthorized) return t("reg.signedOut");
if (e2 && typeof e2 === "object" && "message" in e2) return String(e2.message);
return typeof e2 === "string" ? e2 : t("reg.failed");
}
function regionPicker(opts) {
const chosen = [...opts.initial];
let places = [];
let biggest = /* @__PURE__ */ new Map();
const label2 = (code) => {
const p = biggest.get(code);
return p ? `${code} \xB7 ${p.name}` : code;
};
const chips = h("ul", { class: "rp-chips", "aria-label": t("reg.chosen") });
const drawChips = () => {
clear(chips);
if (chosen.length === 0) append(chips, [h("li", { class: "muted" }, t("reg.nothing"))]);
for (const code of chosen) {
append(chips, [
h(
"li",
{ class: "rp-chip" },
h("span", null, label2(code)),
h(
"button",
{
type: "button",
class: "rp-chip-x",
"aria-label": t("reg.remove", { region: label2(code) }),
onclick: () => {
chosen.splice(chosen.indexOf(code), 1);
drawChips();
}
},
"\xD7"
)
)
]);
}
};
const results = h("ul", { class: "rp-results", role: "listbox", "aria-label": t("reg.results") });
const cellsBox = h("div", { class: "rp-cells" });
const hint = h("p", { class: "muted small", "aria-live": "polite" });
const showCells = (place) => {
clear(cellsBox);
clear(results);
const cells = cellsNear(place.lat, place.lon);
const boxes = cells.map((code, i) => {
const box = h("input", { type: "checkbox", name: `cell-${code}`, checked: true, "aria-label": code });
return { code, box, row: h("label", { class: "rp-cell" }, box, h("span", null, `${label2(code)}${i === 0 ? ` (${t("reg.here")})` : ""}`)) };
});
append(cellsBox, [
h("h2", null, t("reg.cellsTitle", { place: place.name })),
h("p", { class: "muted small" }, t("reg.cellsHelp")),
...boxes.map((b) => b.row),
h(
"div",
{ class: "actions" },
h(
"button",
{
type: "button",
class: "btn",
onclick: () => {
for (const b of boxes) if (b.box.checked && !chosen.includes(b.code)) chosen.push(b.code);
clear(cellsBox);
search2.value = "";
drawChips();
}
},
t("reg.add")
)
)
]);
};
const showMatches = (matches) => {
clear(results);
for (const m of matches) {
const p = m.place;
append(results, [
h(
"li",
{ role: "option" },
h(
"button",
{ type: "button", class: "rp-result", onclick: () => showCells(p) },
h("strong", null, p.name),
m.matched ? ` (${m.matched})` : "",
h("span", { class: "muted" }, ` \xB7 ${countryName(p.cc)}`)
)
)
]);
}
};
const search2 = h("input", {
type: "search",
name: "place",
autocomplete: "off",
spellcheck: "false",
placeholder: t("reg.placeholder"),
"aria-label": t("reg.search"),
disabled: true
// until the list of places has loaded: an early search would find nothing
});
search2.addEventListener("input", () => {
clear(cellsBox);
const q = search2.value;
if (q.trim().length < 2) {
clear(results);
hint.textContent = "";
return;
}
const found = searchPlaces(places, q);
showMatches(found);
hint.textContent = found.length === 0 ? t("reg.none") : "";
});
void loadPlaces().then(
(p) => {
places = p;
biggest = biggestPlaceByCell(p);
search2.disabled = false;
drawChips();
},
() => {
hint.textContent = t("reg.noPlaces");
}
);
const codes = h("input", { type: "text", name: "regions", placeholder: "u1j", autocomplete: "off", spellcheck: "false", "aria-label": t("reg.codes") });
const problem = h("p", { class: "error", role: "alert" });
const go = h("button", { type: "submit", class: "btn primary" }, opts.submitLabel);
const form = h(
"form",
{
class: "stack regions",
onsubmit: (ev) => {
ev.preventDefault();
problem.textContent = "";
for (const raw of codes.value.split(/[\s,;]+/).filter(Boolean)) {
const code = raw.toLowerCase();
if (!CODE.test(code)) {
problem.textContent = t("reg.badCode", { code: raw });
return;
}
if (!chosen.includes(code)) chosen.push(code);
}
codes.value = "";
drawChips();
if (chosen.length === 0) {
problem.textContent = t("reg.needOne");
return;
}
if (chosen.length > MAX_REGIONS) {
problem.textContent = t("reg.tooMany", { max: MAX_REGIONS });
return;
}
go.disabled = true;
const label3 = go.textContent;
go.textContent = t("reg.saving");
opts.onSubmit([...chosen]).catch((e2) => {
problem.textContent = errText(e2);
go.disabled = false;
go.textContent = label3;
});
}
},
h("label", null, t("reg.search"), search2),
hint,
results,
cellsBox,
h("h2", null, t("reg.chosen")),
chips,
h("label", null, t("reg.codes"), codes),
h("p", { class: "muted small" }, t("reg.codesHelp")),
problem,
h("div", { class: "actions" }, go),
h("p", { class: "muted small" }, t("reg.credit"))
);
drawChips();
return form;
}
function showRegions(message = "") {
const root = document.getElementById("app");
document.body.classList.remove("wide");
clear(root);
if (!getToken()) {
location.hash = "#/mine";
return;
}
const picker = regionPicker({
initial: state.node?.regions ?? [],
submitLabel: t("reg.save"),
onSubmit: async (regions) => {
const now = await setRegions(regions);
if (state.node) state.node.regions = now;
const statusEl2 = document.getElementById("status");
if (statusEl2 && state.node) {
statusEl2.textContent = t("status.line", { listings: state.node.listings, peers: state.node.peers, regions: now.join(", ") });
}
showRegions(t("reg.saved"));
}
});
append(root, [
h(
"section",
{ class: "panel" },
h("h1", null, t("reg.title")),
h("p", { class: "muted" }, t("reg.intro")),
h("p", { class: "ok", role: "status" }, message),
picker
)
]);
}
// src/main.ts
var PAGE = 20;
var GEOHASH_PREFIX = /^[0-9bcdefghjkmnpqrstuvwxyz]{1,6}$/;
@@ -5980,6 +6341,7 @@ function route() {
} else if (m) void showDetail(m[1], m[2]);
else if (c) void showConversation(c[1], c[2], c[3]);
else if (path === "/messages") showInbox();
else if (path === "/mine/regions") showRegions();
else if (path === "/mine/new") void showPublish();
else if (edit) void showPublish(edit[1]);
else if (own) void showOwner(own[1], own[2]);