Choose even the first region in the browser; update Docker and Nix
A node now starts without any region (it only helps others connect, and prints a hint). The owner's sign-in link leads straight to the Regions page when none is followed, visitors get a notice instead of an empty search, and status always lists regions as an array. The Docker image no longer pins Bonn, the NixOS module no longer requires regions, and the VM test now starts without any, chooses the first region over the API and checks it survives a restart. README and the init hint follow. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
+23
-9
@@ -1,6 +1,6 @@
|
||||
import { getListing, getStatus, search } from "./api.ts";
|
||||
import { append, clear, h } from "./dom.ts";
|
||||
import { date, price, rooms, shortKey } from "./format.ts";
|
||||
import { date, price, rooms, shortKey, statusLine } from "./format.ts";
|
||||
import { decodeGeohash } from "./geohash.ts";
|
||||
import { lang, t, type Key } from "./i18n.ts";
|
||||
import { contactPanel, showConversation, showInbox } from "./chat.ts";
|
||||
@@ -191,7 +191,19 @@ function showSearch(params: URLSearchParams): void {
|
||||
const gen = state.generation;
|
||||
clear(app);
|
||||
const results = h("div", { class: "results", "aria-live": "polite" });
|
||||
app.append(h("p", { class: "tagline" }, t("app.tagline")), searchForm(params), results);
|
||||
app.append(h("p", { class: "tagline" }, t("app.tagline")));
|
||||
if (state.node && state.node.regions.length === 0) {
|
||||
app.append(
|
||||
h(
|
||||
"p",
|
||||
{ class: "notice", role: "status" },
|
||||
t("search.noRegions"),
|
||||
" ",
|
||||
getToken() ? h("a", { href: "#/mine/regions" }, t("search.chooseRegions")) : null,
|
||||
),
|
||||
);
|
||||
}
|
||||
app.append(searchForm(params), results);
|
||||
|
||||
const prefix = params.get("geohash")?.trim().toLowerCase();
|
||||
if (prefix && !GEOHASH_PREFIX.test(prefix)) {
|
||||
@@ -353,8 +365,14 @@ function route(): void {
|
||||
if (login) {
|
||||
// The token came in the URL fragment: keep it for this tab and take it out of the address bar.
|
||||
setToken(login[1]!);
|
||||
history.replaceState(null, "", location.pathname + location.search + "#/mine");
|
||||
void showOwner();
|
||||
if (state.node && state.node.regions.length === 0) {
|
||||
// A node that follows nothing has nothing to show: the first thing to do is choose.
|
||||
history.replaceState(null, "", location.pathname + location.search + "#/mine/regions");
|
||||
showRegions();
|
||||
} else {
|
||||
history.replaceState(null, "", location.pathname + location.search + "#/mine");
|
||||
void showOwner();
|
||||
}
|
||||
} 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();
|
||||
@@ -372,11 +390,7 @@ async function boot(): Promise<void> {
|
||||
document.getElementById("foot")!.textContent = t("footer.text");
|
||||
try {
|
||||
state.node = await getStatus();
|
||||
statusEl.textContent = t("status.line", {
|
||||
listings: state.node.listings,
|
||||
peers: state.node.peers,
|
||||
regions: state.node.regions.join(", "),
|
||||
});
|
||||
statusEl.textContent = statusLine(state.node);
|
||||
} catch {
|
||||
statusEl.textContent = t("status.unreachable");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user