feat: prefill isolated issue-only reporter for clients without Git
This commit is contained in:
1 parent
6c708224d2
commit
e9b77186dc
15 files changed
+435
-20
No files matched your search
+9
-3
@@ -2,9 +2,15 @@
|
||||
import {writeFile} from 'node:fs/promises';
|
||||
|
||||
export async function connect(port=9226) {
|
||||
const targets=await fetch(`http://127.0.0.1:${port}/json`).then(r=>r.json());
|
||||
const target=targets.find(x=>x.type==='page');
|
||||
if(!target) throw Error('The embedded DSH page has not opened');
|
||||
let target;
|
||||
const deadline=Date.now()+45000;
|
||||
while(Date.now()<deadline){
|
||||
const targets=await fetch(`http://127.0.0.1:${port}/json`,{signal:AbortSignal.timeout(3000)}).then(r=>r.json());
|
||||
target=targets.find(x=>x.type==='page'&&x.url?.startsWith('http://127.0.0.1:'));
|
||||
if(target)break;
|
||||
await new Promise(resolve=>setTimeout(resolve,100));
|
||||
}
|
||||
if(!target) throw Error('The embedded DSH page did not navigate to the owned local runtime');
|
||||
const socket=new WebSocket(target.webSocketDebuggerUrl);
|
||||
await new Promise((resolve,reject)=>{socket.onopen=resolve;socket.onerror=reject;});
|
||||
let sequence=0;
|
||||
|
||||
Reference in new issue
Block a user