galaxy-opc 0.3.2 → 0.3.3
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/bin/cli.mjs +11 -5
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -360,9 +360,15 @@ async function cmdSetup() {
|
|
|
360
360
|
console.log(yellow(`\n 已跳过,稍后手动编辑: ${gray(CONFIG_PATH)}`));
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
// Gateway Token
|
|
364
|
-
|
|
365
|
-
|
|
363
|
+
// Gateway Token — 写入 openclaw.json(openclaw 从这里读取鉴权 token)
|
|
364
|
+
const existingToken = newConfig.gateway?.auth?.token;
|
|
365
|
+
const gatewayToken = (existingToken && existingToken !== "change-me-to-a-long-random-token")
|
|
366
|
+
? existingToken
|
|
367
|
+
: crypto.randomBytes(16).toString("hex");
|
|
368
|
+
newConfig = deepMerge(newConfig, {
|
|
369
|
+
gateway: { auth: { mode: "token", token: gatewayToken } },
|
|
370
|
+
});
|
|
371
|
+
if (!existingToken || existingToken === "change-me-to-a-long-random-token") {
|
|
366
372
|
console.log(green("\n ✓ 已自动生成 Gateway 访问令牌"));
|
|
367
373
|
}
|
|
368
374
|
|
|
@@ -377,8 +383,8 @@ async function cmdSetup() {
|
|
|
377
383
|
启动命令:
|
|
378
384
|
${cyan("openclaw gateway")}
|
|
379
385
|
|
|
380
|
-
|
|
381
|
-
${cyan(
|
|
386
|
+
管理后台(需带 token):
|
|
387
|
+
${cyan(`http://localhost:18789/opc/admin?token=${gatewayToken}`)}
|
|
382
388
|
|
|
383
389
|
后台驻守(开机自启):
|
|
384
390
|
${cyan("openclaw onboard --install-daemon")}
|