vault backup: 2026-11-06 20:19:57
This commit is contained in:
1 parent
8901e4f4db
commit
2c6569dbdf
35 files changed
+17455
-326
No files matched your search
@@ -0,0 +1,28 @@
|
||||
// 桥接客户端:node cdb.mjs <exprFile> [saveAs] [matchRegex] [createUrl] [waitMs]
|
||||
// 通过常驻桥发指令,不会触发新的 Chrome 授权弹窗。
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const [, , exprFile, saveAs, match, createUrl, waitMs] = process.argv;
|
||||
if (!exprFile) { console.error('usage: node cdb.mjs <exprFile> [saveAs] [matchRegex] [createUrl] [waitMs]'); process.exit(1); }
|
||||
|
||||
const portFile = path.resolve('.cdp/bridge-port.txt');
|
||||
if (!fs.existsSync(portFile)) { console.error('桥接未启动:缺少 .cdp/bridge-port.txt'); process.exit(1); }
|
||||
const port = fs.readFileSync(portFile, 'utf8').trim();
|
||||
const expr = fs.readFileSync(path.resolve(exprFile), 'utf8');
|
||||
|
||||
const body = {
|
||||
expr,
|
||||
saveAs: saveAs || null,
|
||||
match: match || 'seller\\.goofish\\.com',
|
||||
createUrl: createUrl || undefined,
|
||||
waitMs: waitMs ? Number(waitMs) : 6000,
|
||||
};
|
||||
|
||||
const res = await fetch(`http://127.0.0.1:${port}/eval`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json; charset=utf-8' },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
const out = await res.json();
|
||||
console.log(JSON.stringify(out, null, 2));
|
||||
Reference in new issue
Block a user