Fix tunnels:list error handling; move ts-node to dependencies

This commit is contained in:
Rokojori 2026-07-16 15:05:10 +02:00
parent 07abc028aa
commit 580dbd4756
1 changed files with 7 additions and 3 deletions

View File

@ -195,9 +195,13 @@ function registerIPC(): void
// List tunnels // List tunnels
ipcMain.handle( 'tunnels:list', async () => ipcMain.handle( 'tunnels:list', async () =>
{ {
const res = await apiFetch( '/api/tunnels' ); const res = await apiFetch( '/api/tunnels' );
const tunnels = await res.json() as Array<Record<string, unknown>>; const data = await res.json();
return tunnels.map( t => ( { ...t, agentActive: agents.get( t.id as string )?.isActive() ?? false } ) ); if ( !res.ok || !Array.isArray( data ) )
throw new Error( ( data as Record<string, string> )?.error ?? `HTTP ${ res.status }` );
return ( data as Array<Record<string, unknown>> ).map( t => ( {
...t, agentActive: agents.get( t.id as string )?.isActive() ?? false,
} ) );
} ); } );
// Connect // Connect