From 1e8eae1f3de765fcd8163716de6e5fe5aab5a034 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 15 Oct 2026 09:33:28 +0200 Subject: feat(hub): one account, several linked nodes An account links up to MAX_NODES_PER_ACCOUNT node keys (node_keys table) instead of the one users.pk_node_ed25519; the migration carries each account's key over and the downgrade keeps the last one linked. /v1/nodes/auth accepts any linked key, and its token names the key that won it (nk). PUT /me/node_key adds a key, idempotently, 409 past the limit; DELETE /me/node_key names the key: a browser session any of its own, a node only its own. Unlinking a key closes that node's socket and refuses its tokens at once, on REST and on the socket; the account's other nodes are untouched. /pubkeys no longer gives a node key to other accounts, and gives the caller its last linked one, which installed desktop apps read. The node reports waiting_for_node_key while its key is unlinked and signs in again as soon as the hub says so, so a key linked again is back within seconds; unlinking itself signs in first to hold a token naming its key. Profile -> Linked nodes lists each node (connected, last seen, IP, linked since, This machine in the desktop app) with Copy and Unlink, and adds a key by hand. The Node page banner, Create group and the desktop app add this machine's key instead of replacing another's. Messages that pointed at Settings -> Link Node point at Profile -> Linked nodes. Co-Authored-By: Claude Opus 5.5 --- .../meshbay-hub/src/meshbay_hub/static/style.css | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/style.css') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/style.css b/packages/meshbay-hub/src/meshbay_hub/static/style.css index a14bdc3..07780a2 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/style.css +++ b/packages/meshbay-hub/src/meshbay_hub/static/style.css @@ -3782,6 +3782,48 @@ h2 .gn-owner, h3 .gn-owner { font-size: 0.55em; } overflow-wrap: anywhere; margin-right: 8px; } +/* Profile → the account's linked nodes, one row per machine. The actions wrap + under the key on a phone rather than squeezing it: the key is what a person + compares against `meshbay-node status`. */ +.node-keys { list-style: none; margin: 4px 0 0; padding: 0; } +.node-keys-item { + display: flex; align-items: center; gap: 10px; flex-wrap: wrap; + padding: 10px 0; border-top: 1px solid var(--border); +} +.node-keys-item:first-child { border-top: none; } +.node-keys-dot { + flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; + background: var(--text-dim); +} +.node-keys-dot.on { background: var(--success); } +.node-keys-main { flex: 1 1 200px; min-width: 0; } +.node-keys-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } +.node-keys-key { font-size: 0.85em; color: var(--text); overflow-wrap: anywhere; } +.node-keys-badge { + font-size: 0.72em; padding: 1px 7px; border-radius: 999px; + background: var(--accent-bg); color: var(--accent); white-space: nowrap; +} +.node-keys-meta { + margin-top: 2px; font-size: 0.8em; color: var(--text-secondary); + overflow-wrap: anywhere; +} +.node-keys-actions { display: flex; gap: 8px; margin-left: auto; } +.node-keys-empty { font-size: 0.9em; color: var(--text-secondary); margin: 4px 0 0; } +.node-keys-add { display: flex; gap: 8px; margin-top: 12px; align-items: center; } +/* A whole key fits: 44 characters, wider than .admin-search's search-box cap. */ +.node-keys-input { + flex: 1 1 auto; min-width: 0; max-width: 46ch; + font-family: monospace; font-size: 0.85em; +} +.node-keys-count { margin: 6px 0 0; } +.node-keys-status { margin-top: 6px; font-size: 0.85em; } +.node-keys-status.ok { color: var(--success); } +.node-keys-status.error { color: var(--error); } +@media (max-width: 480px) { + .node-keys-actions { margin-left: 18px; } + .node-keys-add { flex-wrap: wrap; } + .node-keys-add .admin-btn { flex: 1 1 100%; } +} /* Audit rows: keep the fixed-shape columns on one line (the IP must never be clipped); only the free-text detail column wraps. */ .node-table-audit td, -- cgit v1.2.3