trying to fix export issue and waveform load

This commit is contained in:
2026-04-15 21:51:05 -06:00
parent 168676a9e9
commit 0c7a4c94c2
6 changed files with 157 additions and 45 deletions

View File

@ -11,6 +11,9 @@ import { invoke } from '@tauri-apps/api/core';
import { open, save } from '@tauri-apps/plugin-dialog';
import { readTextFile, writeTextFile } from '@tauri-apps/plugin-fs';
const backendPort = import.meta.env.VITE_BACKEND_PORT || '8642';
const backendUrl = `http://127.0.0.1:${backendPort}`;
const VIDEO_FILTERS = [
{ name: 'Audio and Video Files', extensions: ['mp4', 'avi', 'mov', 'mkv', 'webm', 'm4a', 'wav', 'mp3', 'flac'] },
{ name: 'All Files', extensions: ['*'] },
@ -35,9 +38,13 @@ window.electronAPI = {
return typeof result === 'string' ? result : null;
},
saveFile: async (_options?: Record<string, unknown>): Promise<string | null> => {
void _options;
const result = await save({ filters: EXPORT_FILTERS });
saveFile: async (options?: Record<string, unknown>): Promise<string | null> => {
const result = await save({
defaultPath: typeof options?.defaultPath === 'string' ? options.defaultPath : undefined,
filters: Array.isArray(options?.filters)
? (options.filters as Array<{ name: string; extensions: string[] }>)
: EXPORT_FILTERS,
});
return result ?? null;
},
@ -61,8 +68,8 @@ window.electronAPI = {
},
getBackendUrl: (): Promise<string> => {
// Backend URL is fixed; avoid invoke() which triggers ipc:// CSP errors on Linux/WebKit2GTK
return Promise.resolve('http://127.0.0.1:8000');
// Avoid invoke() here because Linux/WebKit2GTK can log noisy ipc:// CSP warnings.
return Promise.resolve(backendUrl);
},
encryptString: (data: string): Promise<string> => {