Files
u-claw/u-claw-app/scripts/sync-lib.js
hfshfg 9ecbbd445c feat: 内置虾盘云 + 设备指纹绑定 + Release 流水线
- 新增 portable/lib/{fingerprint,xiapan-client,bootstrap-xiapan}.mjs:
  跨平台设备指纹(Win USB/disk + Mac UUID + Linux machine-id + seed 兜底)
  生成 sk-uc-{fingerprint} 形式的虾盘云 apiKey,启动时 merge 到 openclaw.json
- Config.html 顶部新增「已绑定虾盘云」横幅:指纹来源 + Key + 余额 + 充值/解绑
- config-server 增加 /api/xiapan/{status,bind,unbind} 三个端点
- Electron app 在 whenReady 调 bootstrap,新增 sync-lib.js 让 build 前自动同步
- 锁 OpenClaw 版本到 2026.4.29(OPENCLAW_VERSION 单一来源)
- 删除死代码 portable/充值.html
- 新增 .github/workflows/release.yml:tag 触发,出 portable zip + Electron exe/dmg
- README 增加内置虾盘云说明 + 直接下载发行版指引
2026-05-02 17:07:42 +08:00

28 lines
1.2 KiB
JavaScript

// Sync portable/ -> u-claw-app/ before dev/build.
// Single source of truth lives under portable/ (used by Windows-Start.bat,
// Mac-Start.command, and config-server). The Electron desktop app embeds a
// runtime copy because asar packaging cannot reach across siblings.
const fs = require('node:fs');
const path = require('node:path');
const APP_DIR = path.resolve(__dirname, '..');
const PORTABLE_DIR = path.resolve(APP_DIR, '..', 'portable');
const COPIES = [
{ from: path.join(PORTABLE_DIR, 'lib', 'fingerprint.mjs'), to: path.join(APP_DIR, 'src', 'lib', 'fingerprint.mjs') },
{ from: path.join(PORTABLE_DIR, 'lib', 'xiapan-client.mjs'), to: path.join(APP_DIR, 'src', 'lib', 'xiapan-client.mjs') },
{ from: path.join(PORTABLE_DIR, 'lib', 'bootstrap-xiapan.mjs'), to: path.join(APP_DIR, 'src', 'lib', 'bootstrap-xiapan.mjs') },
{ from: path.join(PORTABLE_DIR, 'Config.html'), to: path.join(APP_DIR, 'resources', 'Config.html') },
];
for (const { from, to } of COPIES) {
if (!fs.existsSync(from)) {
console.error(`[sync-lib] Missing ${from}`);
process.exit(1);
}
fs.mkdirSync(path.dirname(to), { recursive: true });
fs.copyFileSync(from, to);
console.log(`[sync-lib] ${path.relative(APP_DIR, to)}`);
}