openclawsetup 2.4.4 → 2.4.5

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.
Files changed (2) hide show
  1. package/bin/cli.mjs +14 -4
  2. package/package.json +1 -1
package/bin/cli.mjs CHANGED
@@ -200,9 +200,9 @@ function getConfigInfo() {
200
200
  try {
201
201
  const raw = readFileSync(configPath, 'utf8');
202
202
  const json = JSON.parse(raw);
203
- const token = json.token || json.gatewayToken || '';
204
- const port = Number(json.port || json.gatewayPort || 18789);
205
- const bind = json.bind || json.gatewayBind || '';
203
+ const token = json.gateway?.auth?.token || json.token || json.gatewayToken || '';
204
+ const port = Number(json.gateway?.port || json.port || json.gatewayPort || 18789);
205
+ const bind = json.gateway?.bind || json.bind || json.gatewayBind || '';
206
206
  return { configDir: cfg.dir, configPath, token, port, bind, raw };
207
207
  } catch {
208
208
  try {
@@ -227,7 +227,17 @@ function getConfigInfo() {
227
227
  }
228
228
 
229
229
  function detectVps() {
230
- return existsSync('/etc/cloud') || existsSync('/var/lib/cloud') || existsSync('/sys/hypervisor');
230
+ if (platform() !== 'linux') return false;
231
+ // Cloud provider markers
232
+ if (existsSync('/etc/cloud') || existsSync('/var/lib/cloud') || existsSync('/sys/hypervisor')) return true;
233
+ // SSH session = remote server
234
+ if (process.env.SSH_CLIENT || process.env.SSH_TTY || process.env.SSH_CONNECTION) return true;
235
+ // systemd-detect-virt
236
+ const virt = safeExec('systemd-detect-virt 2>/dev/null');
237
+ if (virt.ok && virt.output.trim() && virt.output.trim() !== 'none') return true;
238
+ // Headless Linux (no display) likely a server
239
+ if (!process.env.DISPLAY && !process.env.WAYLAND_DISPLAY) return true;
240
+ return false;
231
241
  }
232
242
 
233
243
  function getServerIp() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclawsetup",
3
- "version": "2.4.4",
3
+ "version": "2.4.5",
4
4
  "description": "OpenClaw 安装向导 - 智能安装、诊断、自动修复",
5
5
  "type": "module",
6
6
  "bin": {