@@ -0,0 +1,24 @@
|
||||
// Repair only our Node/Playwright verification helper while preserving the user's authenticated browser.
|
||||
// No credentials, cookie values, request bodies or MFA values are read or exported.
|
||||
const fs = require('node:fs');
|
||||
const expressionFile = process.argv[2];
|
||||
(async () => {
|
||||
const endpoints = await (await fetch('http://127.0.0.1:9229/json/list')).json();
|
||||
const endpoint = endpoints.find(e => e.title === 'tools/portal-stability-activation-browser.cjs');
|
||||
if (!endpoint) throw new Error('Own verification helper not found');
|
||||
const socket = new WebSocket(endpoint.webSocketDebuggerUrl);
|
||||
await new Promise((resolve, reject) => { socket.onopen = resolve; socket.onerror = reject; });
|
||||
let nextId = 0;
|
||||
const waiting = new Map();
|
||||
socket.onmessage = event => { const message = JSON.parse(event.data); if (message.id) { waiting.get(message.id)?.(message); waiting.delete(message.id); } };
|
||||
const expression = fs.readFileSync(expressionFile, 'utf8');
|
||||
const response = await new Promise(resolve => {
|
||||
const id = ++nextId; waiting.set(id, resolve);
|
||||
socket.send(JSON.stringify({id, method: 'Runtime.evaluate', params: {expression, returnByValue: true, awaitPromise: true}}));
|
||||
});
|
||||
if (response.result?.exceptionDetails || response.error) {
|
||||
console.error('Own helper instrumentation failed; no application performed');
|
||||
process.exitCode = 1;
|
||||
} else console.log(JSON.stringify(response.result?.result?.value));
|
||||
socket.close();
|
||||
})().catch(() => { console.error('Own helper instrumentation unavailable'); process.exitCode = 1; });
|
||||
Reference in New Issue
Block a user