@lingyao037/openclaw-lingyao-cli 1.1.0 → 1.1.1
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 +13 -39
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -37,23 +37,20 @@ const NC = '\x1b[0m';
|
|
|
37
37
|
function getMachineId() {
|
|
38
38
|
try {
|
|
39
39
|
const interfaces = os.networkInterfaces();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
for (const
|
|
43
|
-
const iface = interfaces[name];
|
|
40
|
+
const macs = [];
|
|
41
|
+
|
|
42
|
+
for (const iface of Object.values(interfaces)) {
|
|
44
43
|
if (!iface) continue;
|
|
45
|
-
|
|
46
44
|
for (const alias of iface) {
|
|
47
45
|
if (!alias.internal && alias.mac && alias.mac !== '00:00:00:00:00:00') {
|
|
48
|
-
|
|
46
|
+
macs.push(alias.mac);
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
50
|
+
|
|
51
|
+
if (macs.length > 0) {
|
|
52
|
+
macs.sort();
|
|
53
|
+
const macStr = macs.join('');
|
|
57
54
|
// fallback to simple hash since we can't use top level await here easily in older nodes
|
|
58
55
|
let hash = 0;
|
|
59
56
|
for (let i = 0; i < macStr.length; i++) {
|
|
@@ -395,11 +392,6 @@ class LingyaoInstaller {
|
|
|
395
392
|
|
|
396
393
|
config.plugins.entries.lingyao = {
|
|
397
394
|
enabled: true,
|
|
398
|
-
config: {
|
|
399
|
-
maxOfflineMessages: 100,
|
|
400
|
-
tokenExpiryDays: 30,
|
|
401
|
-
gatewayId,
|
|
402
|
-
}
|
|
403
395
|
};
|
|
404
396
|
|
|
405
397
|
// 写回配置文件
|
|
@@ -678,29 +670,11 @@ class LingyaoInstaller {
|
|
|
678
670
|
}
|
|
679
671
|
}
|
|
680
672
|
|
|
681
|
-
// Save paired device info to
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
join(this.openclawPath, 'openclaw.json'),
|
|
687
|
-
join(this.openclawPath, 'config.json'),
|
|
688
|
-
];
|
|
689
|
-
|
|
690
|
-
for (const file of configFiles) {
|
|
691
|
-
if (!existsSync(file)) continue;
|
|
692
|
-
try {
|
|
693
|
-
const config = JSON.parse(readFileSync(file, 'utf-8'));
|
|
694
|
-
if (config.plugins?.entries?.lingyao?.config) {
|
|
695
|
-
config.plugins.entries.lingyao.config.pairedDevice = deviceInfo;
|
|
696
|
-
writeFileSync(file, JSON.stringify(config, null, 2), 'utf-8');
|
|
697
|
-
this.success('设备信息已保存到配置');
|
|
698
|
-
}
|
|
699
|
-
} catch {
|
|
700
|
-
// Ignore config write errors
|
|
701
|
-
}
|
|
702
|
-
break; // Only write to first found config file
|
|
703
|
-
}
|
|
673
|
+
// Save paired device info (no longer writes to openclaw.json — device info
|
|
674
|
+
// is managed server-side via the relay, not in plugin config).
|
|
675
|
+
saveDeviceInfo(_deviceInfo) {
|
|
676
|
+
// No-op: pairedDevice was previously written to plugins.entries.lingyao.config
|
|
677
|
+
// which violates OpenClaw's additionalProperties:false constraint.
|
|
704
678
|
}
|
|
705
679
|
|
|
706
680
|
// 主安装流程
|
package/package.json
CHANGED