close sh;able to save/load projects

This commit is contained in:
2026-03-30 18:36:41 -06:00
parent 246d816f84
commit ea3f1d2b23
15 changed files with 44871 additions and 31 deletions

View File

@ -0,0 +1,25 @@
/**
* Dev-only console interceptor.
* Forwards console.error / console.warn to the backend /dev/log endpoint,
* which appends them to webview.log so the agent can read it.
*/
if (import.meta.env.DEV) {
const BACKEND = 'http://127.0.0.1:8000';
type ConsoleFn = (...args: unknown[]) => void;
const forward = (level: string, orig: ConsoleFn): ConsoleFn =>
(...args: unknown[]) => {
orig(...args);
const [first, ...rest] = args;
fetch(`${BACKEND}/dev/log`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ level, message: String(first ?? ''), args: rest.map(String) }),
}).catch(() => {/* backend not running yet */});
};
console.error = forward('error', console.error.bind(console));
console.warn = forward('warn', console.warn.bind(console));
console.log = forward('log', console.log.bind(console));
}

View File

@ -47,8 +47,14 @@ window.electronAPI = {
return typeof result === 'string' ? result : null;
},
saveProject: async (): Promise<string | null> => {
const result = await save({ filters: PROJECT_FILTERS });
return result ?? null;
},
getBackendUrl: (): Promise<string> => {
return invoke<string>('get_backend_url');
// Backend URL is fixed; avoid invoke() which triggers ipc:// CSP errors on Linux/WebKit2GTK
return Promise.resolve('http://127.0.0.1:8000');
},
encryptString: (data: string): Promise<string> => {