chore(portable): 回归纯开源 — 移除指纹/自动开户/崩溃上报
去掉不适合开源的商业逻辑,保持一个纯粹的开源 U 盘工具: - 删除设备指纹 (fingerprint.mjs)、虾盘云自动开户 (bootstrap-xiapan.mjs / xiapan-client.mjs)、自动崩溃上报 (report-bug.mjs),portable 和 Electron 两份都删 - 启动脚本去掉绑定指纹调用 + 全部 --auto 自动上报;保留 bonjour 禁用与括号转义 - config-server 删掉 /api/xiapan/* 和 /api/report-bug 端点 - Config.html:虾盘云改为普通「首选」卡片,强调中转站 / 国内外全部大模型, 和其它 provider 一样需用户自填 Key(去 u-claw.org/cloud.html 注册),不再自动开户 - 报 Bug 表单改为指向 GitHub Issue,不再上传日志 - README / release notes / CLAUDE.md 文案改为「选模型填 Key,不绑定设备、不打指纹、不上传数据」 - OPENCLAW_VERSION 跟进最新龙虾版本 2026.6.6 → 2026.6.8 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -393,32 +393,6 @@ const server = http.createServer((req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// API: Xiapan Cloud status (fingerprint + apiKey + balance)
|
||||
if (req.url === '/api/xiapan/status' && req.method === 'GET') {
|
||||
(async () => {
|
||||
try {
|
||||
const fpMod = await import('../lib/fingerprint.mjs');
|
||||
const xpMod = await import('../lib/xiapan-client.mjs');
|
||||
const portableRoot = path.join(__dirname, '..');
|
||||
const fp = await fpMod.getFingerprint(portableRoot);
|
||||
const apiKey = xpMod.buildApiKey(fp.fingerprint);
|
||||
const balance = await xpMod.getBalance(apiKey);
|
||||
const rechargeUrl = xpMod.getRechargeUrl(apiKey);
|
||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({
|
||||
source: fp.source,
|
||||
apiKey,
|
||||
rechargeUrl,
|
||||
balance,
|
||||
}));
|
||||
} catch (err) {
|
||||
res.writeHead(500, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({ error: err.message }));
|
||||
}
|
||||
})();
|
||||
return;
|
||||
}
|
||||
|
||||
// API: Update status — read update-available.json written by check-update.mjs
|
||||
// Returns { available: false } if no info or stale; otherwise the manifest payload.
|
||||
if (req.url === '/api/update-status' && req.method === 'GET') {
|
||||
@@ -463,45 +437,6 @@ const server = http.createServer((req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// API: Re-run bootstrap to inject the uclaw-cloud provider
|
||||
if (req.url === '/api/xiapan/bind' && req.method === 'POST') {
|
||||
(async () => {
|
||||
try {
|
||||
const mod = await import('../lib/bootstrap-xiapan.mjs');
|
||||
const portableRoot = path.join(__dirname, '..');
|
||||
const result = await mod.bootstrapXiapan({
|
||||
configPath: CONFIG_PATH,
|
||||
appRoot: portableRoot,
|
||||
});
|
||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify(result));
|
||||
} catch (err) {
|
||||
res.writeHead(500, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({ error: err.message }));
|
||||
}
|
||||
})();
|
||||
return;
|
||||
}
|
||||
|
||||
// API: Remove uclaw-cloud provider so the next bind regenerates it
|
||||
if (req.url === '/api/xiapan/unbind' && req.method === 'POST') {
|
||||
try {
|
||||
if (fs.existsSync(CONFIG_PATH)) {
|
||||
const config = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
|
||||
if (config.models && config.models.providers && config.models.providers['uclaw-cloud']) {
|
||||
delete config.models.providers['uclaw-cloud'];
|
||||
fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2));
|
||||
}
|
||||
}
|
||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({ ok: true }));
|
||||
} catch (err) {
|
||||
res.writeHead(500, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({ error: err.message }));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// API: Save config
|
||||
if (req.url === '/api/config' && req.method === 'POST') {
|
||||
let body = '';
|
||||
@@ -524,37 +459,6 @@ const server = http.createServer((req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// API: Report a bug — user fills title/description in the web UI; this endpoint
|
||||
// attaches fingerprint/version/logs locally and forwards to api.u-claw.org.
|
||||
if (req.url === '/api/report-bug' && req.method === 'POST') {
|
||||
let body = '';
|
||||
req.on('data', chunk => {
|
||||
body += chunk;
|
||||
if (body.length > 2 * 1024 * 1024) req.destroy(); // 2MB cap on user input
|
||||
});
|
||||
req.on('end', () => {
|
||||
(async () => {
|
||||
try {
|
||||
const data = body ? JSON.parse(body) : {};
|
||||
const mod = await import('../lib/report-bug.mjs');
|
||||
const portableRoot = path.join(__dirname, '..');
|
||||
const result = await mod.submitBugReport({
|
||||
title: data.title,
|
||||
description: data.description,
|
||||
appRoot: portableRoot,
|
||||
includeLogs: data.includeLogs !== false, // 默认带日志,用户可勾掉
|
||||
});
|
||||
res.writeHead(result.ok ? 200 : 400, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify(result));
|
||||
} catch (err) {
|
||||
res.writeHead(500, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({ ok: false, error: err.message }));
|
||||
}
|
||||
})();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Serve static files
|
||||
const filePath = req.url === '/'
|
||||
? path.join(__dirname, 'public/index.html')
|
||||
|
||||
Reference in New Issue
Block a user