feat: configure openclaw allowedOrigins on activation

Made-with: Cursor
This commit is contained in:
stswangzhiping
2026-03-24 11:38:58 +08:00
parent ffa13b7c81
commit cefbab28b7

View File

@@ -391,6 +391,25 @@ class ClawClient {
led.status.setApps(); led.status.setApps();
led.display.showTime(); led.display.showTime();
log.info('clawd', `已激活 claw_id = ${this._cfg.claw_id}`); log.info('clawd', `已激活 claw_id = ${this._cfg.claw_id}`);
this._configureOpenClaw(this._cfg.claw_id);
}
}
// ── OpenClaw 配置 ────────────────────────────────────────────────────────────
_configureOpenClaw(clawId) {
try {
const origins = JSON.stringify([
'http://0.0.0.0:18789',
`https://${clawId}.claw.cutos.ai`,
]);
execFileSync('openclaw', ['config', 'set', 'gateway.controlUi.allowedOrigins', origins], {
timeout: 5000,
stdio: 'ignore',
});
log.info('clawd', `openclaw allowedOrigins 已配置: ${clawId}.claw.cutos.ai`);
} catch (e) {
log.warn('clawd', `openclaw 配置失败(可能未安装): ${e.message}`);
} }
} }