feat: configure openclaw allowedOrigins on activation
Made-with: Cursor
This commit is contained in:
@@ -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}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user