aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/node-page.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/node-page.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/node-page.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/node-page.js b/packages/meshbay-hub/src/meshbay_hub/static/node-page.js
index d242b75..2a0b0d7 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/node-page.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/node-page.js
@@ -53,6 +53,17 @@ function NodeServicePanel({ onChanged }) {
: platform.node.autostart.install()));
}, [act, info]);
+ // Switching mode itself — the installer's own choice is effectively one-shot
+ // (it skips the question once the firewall rules exist for any reason, and
+ // per-user mode sets those up on its own with no Scheduled Task), so this is
+ // the only way back in if service mode was declined, or out if it is no
+ // longer wanted. One elevation, task + firewall together, same script.
+ const toggleServiceMode = useCallback(() => {
+ act('serviceMode', () => (info && info.mode === 'service'
+ ? platform.node.serviceMode.remove()
+ : platform.node.serviceMode.install()));
+ }, [act, info]);
+
if (!platform.node.service.available) return null;
if (!info || info.supported === false) {
return html`<div class="node-service">
@@ -99,6 +110,14 @@ function NodeServicePanel({ onChanged }) {
${' '}${busy === 'autostart' ? t('node.autostart_updating') : t('node.autostart_label')}
</label>
`}
+ ${platform.node.serviceMode.available && typeof info.mode === 'string' && html`
+ <label class="toggle-switch ${busy ? 'toggle-switch-disabled' : ''}">
+ <input type="checkbox" checked=${info.mode === 'service'} disabled=${!!busy}
+ onChange=${toggleServiceMode} />
+ <span class="toggle-switch-track"><span class="toggle-switch-thumb"></span></span>
+ ${' '}${busy === 'serviceMode' ? t('node.service_mode_updating') : t('node.service_mode_label')}
+ </label>
+ `}
</div>`;
}