web: 'Invite someone' page with the command to join through this node
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
Vendored
+76
-1
@@ -193,6 +193,15 @@ var de = {
|
||||
"detail.map": "Auf OpenStreetMap ansehen (externe Seite)",
|
||||
"detail.contact": "Kontakt",
|
||||
"nav.messages": "Meine Nachrichten",
|
||||
"nav.invite": "Jemanden einladen",
|
||||
"invite.title": "Jemanden einladen",
|
||||
"invite.intro": "Wer \xFCber diesen Knoten ins Netz kommen m\xF6chte, startet seinen eigenen Knoten mit diesem Befehl:",
|
||||
"invite.copy": "Befehl kopieren",
|
||||
"invite.copied": "Kopiert.",
|
||||
"invite.copyFailed": "Kopieren ging nicht. Markiere den Befehl und kopiere ihn von Hand.",
|
||||
"invite.more": "Weitere Adressen dieses Knotens (eine gen\xFCgt):",
|
||||
"invite.note": "Die Adresse gilt, solange dieser Knoten l\xE4uft. Hinter einem Router l\xE4uft der Weg \xFCber ein Relay, das sich \xE4ndern kann.",
|
||||
"invite.none": "Dieser Knoten hat noch keine Adresse, die andere erreichen k\xF6nnen. Hinter einem Router dauert das eine Weile, bis er seine \xF6ffentliche Adresse kennt oder ein Relay hat; versuche es in einer Minute noch einmal. Bleibt es leer, hat der Knoten weder eine \xF6ffentliche Adresse noch ein Relay (siehe --public und --announce).",
|
||||
"contact.title": "Anbieter kontaktieren",
|
||||
"contact.intro": "Deine Nachricht wird verschl\xFCsselt. Das Netzwerk sieht nur, dass jemand zu dieser Anzeige geschrieben hat, nicht wer und nicht was. Du brauchst kein Konto. Die genaue Adresse gibt der Anbieter selbst frei.",
|
||||
"contact.rules": "Die erste Nachricht muss kurz sein und darf keine Links enthalten. Das sch\xFCtzt vor Betrug; nach der ersten Antwort des Anbieters entf\xE4llt es.",
|
||||
@@ -491,6 +500,15 @@ var en = {
|
||||
"detail.map": "View on OpenStreetMap (external site)",
|
||||
"detail.contact": "Contact",
|
||||
"nav.messages": "My messages",
|
||||
"nav.invite": "Invite someone",
|
||||
"invite.title": "Invite someone",
|
||||
"invite.intro": "Someone who wants to join the network through this node starts their own node with this command:",
|
||||
"invite.copy": "Copy command",
|
||||
"invite.copied": "Copied.",
|
||||
"invite.copyFailed": "Copying failed. Select the command and copy it by hand.",
|
||||
"invite.more": "Other addresses of this node (one is enough):",
|
||||
"invite.note": "The address works while this node runs. Behind a router the way in goes through a relay, which can change.",
|
||||
"invite.none": "This node has no address yet that others can reach. Behind a router it takes a while until it knows its public address or has a relay; try again in a minute. If it stays empty, the node has neither a public address nor a relay (see --public and --announce).",
|
||||
"contact.title": "Contact the owner",
|
||||
"contact.intro": "Your message is encrypted. The network only sees that someone wrote about this listing, not who and not what. You need no account. The owner releases the exact address themselves.",
|
||||
"contact.rules": "The first message must be short and must not contain links. This protects against scams; it ends once the owner has replied.",
|
||||
@@ -6207,6 +6225,61 @@ async function showPublish(editId) {
|
||||
syncKind();
|
||||
}
|
||||
|
||||
// src/invite.ts
|
||||
async function showInvite() {
|
||||
const root = document.getElementById("app");
|
||||
document.body.classList.remove("wide");
|
||||
clear(root);
|
||||
const generation = state.generation;
|
||||
let share = [];
|
||||
let failed = false;
|
||||
try {
|
||||
const st = await getStatus();
|
||||
share = Array.isArray(st.share) ? st.share.filter((a) => typeof a === "string") : [];
|
||||
} catch {
|
||||
failed = true;
|
||||
}
|
||||
if (generation !== state.generation) return;
|
||||
const panel = h("section", { class: "panel" }, h("h1", null, t("invite.title")));
|
||||
if (failed) {
|
||||
append(panel, [h("p", { class: "error" }, t("status.unreachable"))]);
|
||||
} else if (share.length === 0) {
|
||||
append(panel, [h("p", null, t("invite.none"))]);
|
||||
} else {
|
||||
const command = `allmende run --bootstrap ${share[0]}`;
|
||||
const status = h("span", { class: "ok", role: "status" });
|
||||
append(panel, [
|
||||
h("p", { class: "muted" }, t("invite.intro")),
|
||||
h("pre", { class: "invite-command" }, command),
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
onclick: async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(command);
|
||||
status.textContent = t("invite.copied");
|
||||
} catch {
|
||||
status.textContent = t("invite.copyFailed");
|
||||
}
|
||||
}
|
||||
},
|
||||
t("invite.copy")
|
||||
),
|
||||
" ",
|
||||
status
|
||||
]);
|
||||
if (share.length > 1) {
|
||||
append(panel, [
|
||||
h("p", { class: "muted" }, t("invite.more")),
|
||||
h("ul", null, ...share.slice(1).map((a) => h("li", null, h("code", null, a))))
|
||||
]);
|
||||
}
|
||||
append(panel, [h("p", { class: "muted" }, t("invite.note"))]);
|
||||
}
|
||||
append(root, [panel]);
|
||||
}
|
||||
|
||||
// src/places.ts
|
||||
function fold(s) {
|
||||
return s.normalize("NFD").replace(/\p{M}/gu, "").replace(/ß/g, "ss").toLowerCase();
|
||||
@@ -6804,7 +6877,8 @@ function renderNav() {
|
||||
clear(nav);
|
||||
append(nav, [
|
||||
h("a", { href: "#/messages" }, t("nav.messages")),
|
||||
getToken() && h("a", { href: "#/mine" }, t("nav.owner"))
|
||||
getToken() && h("a", { href: "#/mine" }, t("nav.owner")),
|
||||
getToken() && h("a", { href: "#/invite" }, t("nav.invite"))
|
||||
]);
|
||||
}
|
||||
function route() {
|
||||
@@ -6832,6 +6906,7 @@ function route() {
|
||||
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 === "/invite") void showInvite();
|
||||
else if (path === "/mine/reports") void showReports();
|
||||
else if (path === "/mine/new") void showPublish();
|
||||
else if (edit) void showPublish(edit[1]);
|
||||
|
||||
Reference in New Issue
Block a user