归档 artalk-cf 评论后端 + rss-robot 到 blog-admin(含技术选型/模块分布 README)
Deploy to Production / pre-check (push) Successful in 58s
Deploy to Production / build (push) Successful in 4m3s
Deploy to Production / deploy-edgeone (push) Successful in 3m48s
Deploy to Production / finalize (push) Successful in 26s
Deploy to Production / notify-failure (push) Skipped
Deploy to Production / pre-check (push) Successful in 58s
Deploy to Production / build (push) Successful in 4m3s
Deploy to Production / deploy-edgeone (push) Successful in 3m48s
Deploy to Production / finalize (push) Successful in 26s
Deploy to Production / notify-failure (push) Skipped
This commit is contained in:
1 parent
855a001046
commit
a74b3c7127
98 files changed
+15657
No files matched your search
@@ -0,0 +1,58 @@
|
||||
// 量「重新加载按钮」与 footer border-top 的真实间距
|
||||
import { spawn } from 'node:child_process';
|
||||
import { mkdtempSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const CHROME = 'C:/Users/QunLIn/.agent-browser/browsers/chrome-154.0.8037.92/chrome.exe';
|
||||
const PORT = 9409;
|
||||
const URL_ = process.argv[2] || 'http://127.0.0.1:1313/comment.html';
|
||||
const OUT = process.argv[3] || 'C:/Users/QunLIn/WorkBuddy/2026-10-02-15-13-24/.workbuddy/ftgap.json';
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
const userDir = mkdtempSync(join(tmpdir(), 'cdp-ft3-'));
|
||||
|
||||
const chrome = spawn(CHROME, [
|
||||
'--headless=new', `--remote-debugging-port=${PORT}`, `--user-data-dir=${userDir}`,
|
||||
'--no-first-run', '--disable-gpu', '--window-size=1280,1400', 'about:blank',
|
||||
], { stdio: 'ignore' });
|
||||
|
||||
try {
|
||||
for (let i = 0; i < 40; i++) {
|
||||
try { const r = await fetch(`http://127.0.0.1:${PORT}/json/version`); if (r.ok) break; } catch { /* */ }
|
||||
await sleep(300);
|
||||
}
|
||||
const tab = await (await fetch(`http://127.0.0.1:${PORT}/json/new?${encodeURIComponent(URL_)}`, { method: 'PUT' })).json();
|
||||
const ws = new WebSocket(tab.webSocketDebuggerUrl);
|
||||
let id = 0; const pending = new Map();
|
||||
ws.addEventListener('message', (ev) => { const m = JSON.parse(ev.data); if (m.id && pending.has(m.id)) { pending.get(m.id)(m); pending.delete(m.id); } });
|
||||
await new Promise((res) => ws.addEventListener('open', res));
|
||||
const send = (method, params = {}) => new Promise((res) => { const mid = ++id; pending.set(mid, res); ws.send(JSON.stringify({ id: mid, method, params })); });
|
||||
const ev = async (expr) => {
|
||||
const r = await send('Runtime.evaluate', { expression: expr, returnByValue: true, awaitPromise: true });
|
||||
return r.result?.result?.value ?? r.result?.value ?? null;
|
||||
};
|
||||
|
||||
await send('Runtime.enable');
|
||||
await send('Page.enable');
|
||||
await sleep(9000);
|
||||
|
||||
const out = await ev(`(() => {
|
||||
const btn = document.querySelector('.atk-err-retry');
|
||||
const ft = document.querySelector('.footer');
|
||||
if (!btn || !ft) return JSON.stringify({ btn: !!btn, footer: !!ft });
|
||||
const b = btn.getBoundingClientRect();
|
||||
const f = ft.getBoundingClientRect();
|
||||
return JSON.stringify({
|
||||
btnBottom: Math.round(b.bottom + scrollY),
|
||||
footerBorderTop: Math.round(f.top + scrollY),
|
||||
gap: Math.round(f.top - b.bottom),
|
||||
layerMargin: getComputedStyle(document.querySelector('.atk-error-layer')).margin
|
||||
}, null, 1);
|
||||
})()`);
|
||||
writeFileSync(OUT, String(out));
|
||||
ws.close();
|
||||
} catch (e) {
|
||||
writeFileSync(OUT, 'ERR ' + e.message);
|
||||
} finally {
|
||||
chrome.kill();
|
||||
}
|
||||
Reference in new issue
Block a user