From c8af746c846b5dbc792f7e4f0d806647d513cc5c Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 20 Aug 2026 08:56:23 +0200 Subject: feat(node): full Node admin panel — CLI parity, hot-reload, group lifecycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node admin panel (NodePage) now covers every CLI operation over MNP: group attach/detach, roster, member unpin, GEK rotate, denylist, reload. Daemon hot-loads new groups and tears down removed ones on config reload instead of requiring a full restart. Group attach/detach via MNP or local API triggers an automatic reload so the group is live immediately. Fixed GroupPage hang on first visit to a newly created group: the JWT issued at login didn't include the new group, the node rejected with not_a_member, and the token-refresh path returned without re-triggering the connect effect (Boolean(token) didn't change). Now bumps retryKey after a successful refresh so the effect re-runs with the fresh token. NodePage marks groups hosted by the node but absent from the hub with a "not on hub" badge so stale groups are visible and easy to remove. Co-Authored-By: Claude Opus 4.6 --- packages/meshbay-client/src/main.js | 9 + packages/meshbay-client/src/preload.js | 6 + .../meshbay-common/src/meshbay_common/adminop.py | 4 + .../meshbay-common/src/meshbay_common/protocol.py | 18 + packages/meshbay-hub/src/meshbay_hub/static/app.js | 573 ++++++++++++++++++- .../src/meshbay_hub/static/locales/en.js | 57 ++ .../meshbay-hub/src/meshbay_hub/static/platform.js | 10 +- .../meshbay-hub/src/meshbay_hub/static/style.css | 174 ++++++ .../src/meshbay_hub/static/transport.js | 120 +++- packages/meshbay-node/src/meshbay_node/daemon.py | 207 ++++++- packages/meshbay-node/src/meshbay_node/ops.py | 217 ++++++- packages/meshbay-node/src/meshbay_node/roster.py | 2 + .../src/meshbay_node/transport/webrtc_server.py | 310 +++++++++- packages/meshbay-node/src/meshbay_node/ui/app.py | 18 +- packages/meshbay-node/tests/test_cli_dispatch.py | 1 + packages/meshbay-node/tests/test_node_status.py | 625 +++++++++++++++++++++ 16 files changed, 2293 insertions(+), 58 deletions(-) create mode 100644 packages/meshbay-node/tests/test_node_status.py (limited to 'packages') diff --git a/packages/meshbay-client/src/main.js b/packages/meshbay-client/src/main.js index 0ed06d9..e7e7b15 100644 --- a/packages/meshbay-client/src/main.js +++ b/packages/meshbay-client/src/main.js @@ -559,6 +559,15 @@ function registerBridge() { return true; }); + ipcMain.handle('root:choose', async () => { + const result = await dialog.showOpenDialog(mainWindow, { + properties: ['openDirectory', 'createDirectory'], + }); + if (result.canceled || !result.filePaths.length) return null; + const chosen = result.filePaths[0]; + return { path: chosen, name: path.basename(chosen) }; + }); + ipcMain.handle('save:begin', async (_e, suggestedName, opts) => { const wanted = path.basename(String(suggestedName || 'download')); const chosen = chosenDownloadDir(); diff --git a/packages/meshbay-client/src/preload.js b/packages/meshbay-client/src/preload.js index 3804ad3..e3af68f 100644 --- a/packages/meshbay-client/src/preload.js +++ b/packages/meshbay-client/src/preload.js @@ -74,6 +74,12 @@ contextBridge.exposeInMainWorld('meshbay', { forget: () => ipcRenderer.invoke('folder:forget'), }, + // Pick a directory to share as a group root. Returns { path, name } — the + // path is forwarded over MNP to the node, which is the local machine for D5. + rootPicker: { + choose: () => ipcRenderer.invoke('root:choose'), + }, + // A sink that writes to disk as chunks arrive, never a buffer handed over at // the end. `auto` uses the remembered folder without a dialog, which is what // "save automatically" means; without one, or when the person asked to be diff --git a/packages/meshbay-common/src/meshbay_common/adminop.py b/packages/meshbay-common/src/meshbay_common/adminop.py index a793471..73f07d9 100644 --- a/packages/meshbay-common/src/meshbay_common/adminop.py +++ b/packages/meshbay-common/src/meshbay_common/adminop.py @@ -49,6 +49,10 @@ OP_MEMBER_UNPIN = "member_unpin" # setting decides who may write to the operator's disk, so a node that took it # from an unsigned message would let any member re-enable it for everyone. OP_MEMBER_UPLOAD = "member_upload" +OP_ROOT_ADD = "root_add" +OP_ROOT_REMOVE = "root_remove" +OP_GROUP_ATTACH = "group_attach" +OP_GROUP_DETACH = "group_detach" # OP_GEK_BUNDLE_STORE is gone. Members no longer hand the node key material at # all: the node holds the GEK and wraps it itself, for a key the recipient proved # they hold (see `join.py` and docs/invite-pairing-v1.md). The operation existed diff --git a/packages/meshbay-common/src/meshbay_common/protocol.py b/packages/meshbay-common/src/meshbay_common/protocol.py index 1c6dd3e..06acb8b 100644 --- a/packages/meshbay-common/src/meshbay_common/protocol.py +++ b/packages/meshbay-common/src/meshbay_common/protocol.py @@ -97,6 +97,24 @@ class MNP: GEK_ROTATE = "gek_rotate" # operator → node: new group key GEK_ROTATE_ACK = "gek_rotate_ack" INVITE_RESULT = "invite_result" # node → operator: the code, once + NODE_STATUS = "node_status" # operator → node: list all groups + roots + NODE_STATUS_ACK = "node_status_ack" # node → operator: full status + ROOT_ADD = "root_add" # operator → node: add a directory to a group + ROOT_ADD_ACK = "root_add_ack" # node → operator: confirmed + ROOT_REMOVE = "root_remove" # operator → node: remove a root from a group + ROOT_REMOVE_ACK = "root_remove_ack" # node → operator: confirmed + ROSTER_READ = "roster_read" # operator → node: list pinned identities + members + ROSTER_READ_ACK = "roster_read_ack" + DENYLIST_READ = "denylist_read" # operator → node: show denylist entries + DENYLIST_READ_ACK = "denylist_read_ack" + DENYLIST_CLEAR = "denylist_clear" # operator → node: remove denylist entry(ies) + DENYLIST_CLEAR_ACK = "denylist_clear_ack" + GROUP_ATTACH = "group_attach" # operator → node: host a new group + GROUP_ATTACH_ACK = "group_attach_ack" + GROUP_DETACH = "group_detach" # operator → node: stop hosting a group + GROUP_DETACH_ACK = "group_detach_ack" + NODE_RELOAD = "node_reload" # operator → node: re-read node.toml + NODE_RELOAD_ACK = "node_reload_ack" # ── Index entry ─────────────────────────────────────────────────────────────── diff --git a/packages/meshbay-hub/src/meshbay_hub/static/app.js b/packages/meshbay-hub/src/meshbay_hub/static/app.js index 816c0ab..3fdba07 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/app.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/app.js @@ -403,6 +403,9 @@ const ICON_PATHS = { 'bell-off': ['M18 9a6 6 0 0 0-12 0c0 6-2.5 7.5-2.5 7.5h17S18 15 18 9', 'M10.3 20a2 2 0 0 0 3.4 0', 'M4 4l16 16'], + server: ['M4 6.5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2z', + 'M4 15.5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2z', + 'M8 7.5h.01', 'M8 16.5h.01'], }; // The M of the wordmark is a picture; the rest is text. Resolved from this @@ -618,7 +621,7 @@ function Nav({ user, theme, onThemeChange, onLogout, onMenuToggle, unreadCount, // ── Sidebar ────────────────────────────────────────────────────────────────── -function Sidebar({ groups, presence, route, menuOpen, role }) { +function Sidebar({ groups, presence, route, menuOpen, role, hasNodeKey }) { const isStaff = role === 'moderator' || role === 'admin'; return html`