Cut product flows over to Coding/Pi and retain only the migration-owned v1 boundary. Promote supported native optional packages because electron-builder omitted pnpm transitive optional closure from the packaged ASAR.
22 lines
920 B
TypeScript
22 lines
920 B
TypeScript
/**
|
|
* Transport-only path classification. Kept free of route imports so the
|
|
* lightweight IPC registration path does not eagerly load every Host API
|
|
* service before the first window is painted.
|
|
*/
|
|
export function shouldUseLoopbackHostApi(path: string, method = 'GET'): boolean {
|
|
const normalizedMethod = method.toUpperCase();
|
|
const pathname = path.split('?', 1)[0] || path;
|
|
if (pathname === '/api/events'
|
|
|| pathname === '/api/coding/events') return true;
|
|
if (pathname === '/api/coding/attachments'
|
|
|| pathname.startsWith('/api/coding/attachments/')) return true;
|
|
if (pathname.startsWith('/api/ai-proxy/')) return true;
|
|
if (pathname.includes('/events') && pathname.startsWith('/api/image-workspace/')) return true;
|
|
if (
|
|
pathname.includes('/assets/')
|
|
&& pathname.endsWith('/content')
|
|
&& (normalizedMethod === 'GET' || normalizedMethod === 'HEAD')
|
|
) return true;
|
|
return false;
|
|
}
|