@clawlabz/clawnetwork 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +17 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -975,6 +975,7 @@ function buildUiHtml(cfg: PluginConfig): string {
|
|
|
975
975
|
</div>
|
|
976
976
|
<div class="node-controls">
|
|
977
977
|
<button class="btn primary" id="startBtn" onclick="doAction('start')">▶ Start Node</button>
|
|
978
|
+
<button class="btn" id="restartBtn" onclick="doRestart()" style="background:var(--accent);color:#000;font-weight:600">↻ Restart</button>
|
|
978
979
|
<button class="btn danger" id="stopBtn" onclick="doAction('stop')">■ Stop Node</button>
|
|
979
980
|
</div>
|
|
980
981
|
</div>
|
|
@@ -1413,6 +1414,19 @@ function buildUiHtml(cfg: PluginConfig): string {
|
|
|
1413
1414
|
} catch (e) { toast('Error: ' + e.message); }
|
|
1414
1415
|
}
|
|
1415
1416
|
|
|
1417
|
+
async function doRestart() {
|
|
1418
|
+
toast('Stopping node...');
|
|
1419
|
+
try {
|
|
1420
|
+
await fetch(API + '/api/action/stop', { method: 'POST' });
|
|
1421
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
1422
|
+
toast('Starting node...');
|
|
1423
|
+
const res = await fetch(API + '/api/action/start', { method: 'POST' });
|
|
1424
|
+
const data = await res.json();
|
|
1425
|
+
toast(data.message || 'Restarted');
|
|
1426
|
+
setTimeout(fetchStatus, 2000);
|
|
1427
|
+
} catch (e) { toast('Error: ' + e.message); }
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1416
1430
|
async function refreshLogs() {
|
|
1417
1431
|
try {
|
|
1418
1432
|
const res = await fetch(API + '/api/logs');
|
|
@@ -1811,7 +1825,7 @@ async function handle(req, res) {
|
|
|
1811
1825
|
newVersion = require('child_process').execFileSync(path.join(binDir, binName), ['--version'], { encoding: 'utf8', timeout: 5000 }).trim();
|
|
1812
1826
|
} catch {}
|
|
1813
1827
|
|
|
1814
|
-
json(200, { message: 'Upgraded to ' + newVersion + '. Restart
|
|
1828
|
+
json(200, { message: 'Upgraded to ' + newVersion + '. Click Restart to apply.', newVersion });
|
|
1815
1829
|
} catch (e) { json(500, { error: e.message }); }
|
|
1816
1830
|
return;
|
|
1817
1831
|
}
|
|
@@ -2335,6 +2349,8 @@ export default function register(api: OpenClawApi) {
|
|
|
2335
2349
|
if (state.running) {
|
|
2336
2350
|
api.logger?.info?.(`[clawnetwork] node already running (pid=${state.pid}), skipping node start`)
|
|
2337
2351
|
startHealthCheck(cfg, api)
|
|
2352
|
+
// Start UI dashboard (may have been lost on gateway restart)
|
|
2353
|
+
startUiServer(cfg, api)
|
|
2338
2354
|
// Still need to ensure heartbeat loop is running (may have been lost on gateway restart)
|
|
2339
2355
|
const wallet = ensureWallet(cfg.network, api)
|
|
2340
2356
|
await sleep(5_000)
|
package/openclaw.plugin.json
CHANGED