@lingyao037/openclaw-lingyao-cli 0.5.1 → 0.5.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/cli.mjs +3 -3
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import { existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync, readd
|
|
|
16
16
|
import { join, dirname } from 'path';
|
|
17
17
|
import { fileURLToPath } from 'url';
|
|
18
18
|
import https from 'https';
|
|
19
|
+
import os from 'os';
|
|
19
20
|
import QRCode from 'qrcode';
|
|
20
21
|
|
|
21
22
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -410,7 +411,7 @@ class LingyaoInstaller {
|
|
|
410
411
|
httpsPost(path, body) {
|
|
411
412
|
return new Promise((resolve, reject) => {
|
|
412
413
|
const data = JSON.stringify(body);
|
|
413
|
-
const url =
|
|
414
|
+
const url = `${LINGYAO_API}${path}`;
|
|
414
415
|
const headers = { 'Content-Type': 'application/json' };
|
|
415
416
|
if (this.gatewayToken) {
|
|
416
417
|
headers['Authorization'] = `Bearer ${this.gatewayToken}`;
|
|
@@ -431,7 +432,7 @@ class LingyaoInstaller {
|
|
|
431
432
|
|
|
432
433
|
httpsGet(path) {
|
|
433
434
|
return new Promise((resolve, reject) => {
|
|
434
|
-
const url =
|
|
435
|
+
const url = `${LINGYAO_API}${path}`;
|
|
435
436
|
https.get(url, (res) => {
|
|
436
437
|
let chunk = '';
|
|
437
438
|
res.on('data', (c) => chunk += c);
|
|
@@ -445,7 +446,6 @@ class LingyaoInstaller {
|
|
|
445
446
|
|
|
446
447
|
// Generate a stable gateway ID
|
|
447
448
|
generateGatewayId() {
|
|
448
|
-
const os = require('os');
|
|
449
449
|
const host = os.hostname().split('.')[0].replace(/[^a-z0-9]/gi, '').toLowerCase();
|
|
450
450
|
const suffix = Math.random().toString(36).substring(2, 8);
|
|
451
451
|
return `gw_openclaw_${host}_default_${suffix}`;
|
package/package.json
CHANGED