removed electron
This commit is contained in:
@ -22,7 +22,7 @@ import {
|
||||
VolumeX,
|
||||
} from 'lucide-react';
|
||||
|
||||
const IS_ELECTRON = !!window.electronAPI;
|
||||
const IS_DESKTOP = !!window.desktopAPI;
|
||||
|
||||
type Panel = 'ai' | 'settings' | 'export' | 'silence' | null;
|
||||
|
||||
@ -66,8 +66,8 @@ export default function App() {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (IS_ELECTRON) {
|
||||
window.electronAPI!.getBackendUrl().then(setBackendUrl);
|
||||
if (IS_DESKTOP) {
|
||||
window.desktopAPI!.getBackendUrl().then(setBackendUrl);
|
||||
}
|
||||
// In Tauri on Linux/WebKit2GTK the ipc:// custom protocol is blocked by
|
||||
// WebKit internals; postMessage fallback works but logs noisy warnings.
|
||||
@ -75,11 +75,11 @@ export default function App() {
|
||||
}, [setBackendUrl]);
|
||||
|
||||
const handleLoadProject = async () => {
|
||||
if (!IS_ELECTRON) return;
|
||||
if (!IS_DESKTOP) return;
|
||||
try {
|
||||
const projectPath = await window.electronAPI!.openProject();
|
||||
const projectPath = await window.desktopAPI!.openProject();
|
||||
if (!projectPath) return;
|
||||
const content = await window.electronAPI!.readFile(projectPath);
|
||||
const content = await window.desktopAPI!.readFile(projectPath);
|
||||
const data = JSON.parse(content);
|
||||
useEditorStore.getState().loadProject(data);
|
||||
} catch (err) {
|
||||
@ -89,13 +89,13 @@ export default function App() {
|
||||
};
|
||||
|
||||
const handleSaveProject = async () => {
|
||||
if (!IS_ELECTRON) return;
|
||||
if (!IS_DESKTOP) return;
|
||||
try {
|
||||
const savePath = await window.electronAPI!.saveProject();
|
||||
const savePath = await window.desktopAPI!.saveProject();
|
||||
if (!savePath) return;
|
||||
const data = useEditorStore.getState().saveProject();
|
||||
const path = savePath.endsWith('.aive') ? savePath : `${savePath}.aive`;
|
||||
await window.electronAPI!.writeFile(path, JSON.stringify(data, null, 2));
|
||||
await window.desktopAPI!.writeFile(path, JSON.stringify(data, null, 2));
|
||||
} catch (err) {
|
||||
console.error('Failed to save project:', err);
|
||||
alert(`Failed to save project: ${err}`);
|
||||
@ -103,8 +103,8 @@ export default function App() {
|
||||
};
|
||||
|
||||
const handleOpenFile = async () => {
|
||||
if (IS_ELECTRON) {
|
||||
const path = await window.electronAPI!.openFile();
|
||||
if (IS_DESKTOP) {
|
||||
const path = await window.desktopAPI!.openFile();
|
||||
if (path) {
|
||||
loadVideo(path);
|
||||
await transcribeVideo(path);
|
||||
@ -130,7 +130,7 @@ export default function App() {
|
||||
const transcribeVideo = async (path: string) => {
|
||||
setTranscribing(true, 0, 'Checking model...');
|
||||
try {
|
||||
if (!window.electronAPI?.transcribe) {
|
||||
if (!window.desktopAPI?.transcribe) {
|
||||
throw new Error('Transcription not available');
|
||||
}
|
||||
// Step 1: ensure model is downloaded (may take a while on first run)
|
||||
@ -153,11 +153,11 @@ export default function App() {
|
||||
};
|
||||
const modelLabel = MODEL_SIZES[whisperModel] ?? 'unknown size';
|
||||
setTranscribing(true, 5, `Downloading ${whisperModel} model (${modelLabel})...`);
|
||||
await window.electronAPI.ensureModel(whisperModel);
|
||||
await window.desktopAPI.ensureModel(whisperModel);
|
||||
|
||||
// Step 2: run transcription
|
||||
setTranscribing(true, 20, 'Transcribing audio...');
|
||||
const data = await window.electronAPI.transcribe(path, whisperModel);
|
||||
const data = await window.desktopAPI.transcribe(path, whisperModel);
|
||||
setTranscription(data);
|
||||
} catch (err) {
|
||||
console.error('Transcription error:', err);
|
||||
@ -243,7 +243,7 @@ export default function App() {
|
||||
English-only models are ~10% faster and more accurate for English content.
|
||||
</p>
|
||||
|
||||
{IS_ELECTRON ? (
|
||||
{IS_DESKTOP ? (
|
||||
<div className="flex flex-col items-center gap-3">
|
||||
<button
|
||||
onClick={handleOpenFile}
|
||||
@ -313,9 +313,9 @@ export default function App() {
|
||||
<ToolbarButton
|
||||
icon={<FolderOpen className="w-4 h-4" />}
|
||||
label="Open"
|
||||
onClick={IS_ELECTRON ? handleOpenFile : () => useEditorStore.getState().reset()}
|
||||
onClick={IS_DESKTOP ? handleOpenFile : () => useEditorStore.getState().reset()}
|
||||
/>
|
||||
{IS_ELECTRON && (
|
||||
{IS_DESKTOP && (
|
||||
<ToolbarButton
|
||||
icon={<Save className="w-4 h-4" />}
|
||||
label="Save"
|
||||
@ -323,7 +323,7 @@ export default function App() {
|
||||
disabled={words.length === 0}
|
||||
/>
|
||||
)}
|
||||
{IS_ELECTRON && (
|
||||
{IS_DESKTOP && (
|
||||
<ToolbarButton
|
||||
icon={<FileInput className="w-4 h-4" />}
|
||||
label="Load"
|
||||
|
||||
Reference in New Issue
Block a user