aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/platform.js
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-20 22:21:24 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-20 22:21:24 +0200
commitae52b69b14a6997d01aad66f49fbea7b5ca2dfe6 (patch)
tree26f850a88565846a139868a4b85c715734751a41 /packages/meshbay-hub/src/meshbay_hub/static/platform.js
parentc8af746c846b5dbc792f7e4f0d806647d513cc5c (diff)
parent2e9490ca27047ae03e495d397abbe1aec1b2273a (diff)
downloadmeshbay-ae52b69b14a6997d01aad66f49fbea7b5ca2dfe6.tar.gz
Merge feat/unified-group-management: wizard, public groups, activity sidebar
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/platform.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/platform.js31
1 files changed, 29 insertions, 2 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/platform.js b/packages/meshbay-hub/src/meshbay_hub/static/platform.js
index d379e9d..02107f5 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/platform.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/platform.js
@@ -207,8 +207,35 @@ export const rootPicker = {
async choose() { return bridge && bridge.rootPicker ? bridge.rootPicker.choose() : null; },
};
+/**
+ * The local node, if one is running on this machine.
+ *
+ * Detection probes `127.0.0.1:{ui_port}` with the session token read from the
+ * daemon's data directory. The renderer never sees the token — it names an
+ * operation and the main process executes it, the same trust model as hub:fetch.
+ *
+ * In a browser all calls resolve to a "not available" result, so the interface
+ * can gate features on `node.available` without a build flag.
+ */
+export const node = {
+ available: Boolean(bridge && bridge.node),
+ async detect() {
+ return bridge && bridge.node ? bridge.node.detect() : { detected: false };
+ },
+ async call(method, path, body) {
+ if (!bridge || !bridge.node) throw new Error('Node bridge not available');
+ return bridge.node.call(method, path, body);
+ },
+ async pairingCode() {
+ return bridge && bridge.node ? bridge.node.pairingCode() : null;
+ },
+ async setPairingCode(code) {
+ return bridge && bridge.node ? bridge.node.setPairingCode(code) : false;
+ },
+};
+
export default { isNative, hubBase, capabilities, secrets, nativeSave,
- apiFetch, device, bridgeMessage, folder, rootPicker };
+ apiFetch, device, bridgeMessage, folder, rootPicker, node };
// Also a global, because `transport.js` is loaded as a classic script — it
// predates the module graph and exposes `MeshBayTransport` the same way. The
@@ -217,5 +244,5 @@ export default { isNative, hubBase, capabilities, secrets, nativeSave,
if (typeof window !== 'undefined') {
window.MeshBayPlatform = { isNative, hubBase, capabilities, secrets,
nativeSave, apiFetch, device,
- bridgeMessage, folder, rootPicker };
+ bridgeMessage, folder, rootPicker, node };
}