refactor: remove legacy Tauri desktop support

Electron updater now uses Electron release metadata only
Removed legacy Tauri package and migration workflow
Replaced Tauri shim usage with the desktop bridge
This commit is contained in:
Bohdan Triapitsyn
2026-06-03 02:42:00 +03:00
parent e80bd15dd9
commit c7bc026b4b
81 changed files with 269 additions and 16914 deletions
+6 -60
View File
@@ -1,30 +1,15 @@
import { isDesktopShell } from '@/lib/desktop';
import { hasDesktopInvoke, invokeDesktop, isDesktopShell } from '@/lib/desktop';
type InvokeArgs = Record<string, unknown>;
const isElectronDesktop = (): boolean => {
return typeof window !== 'undefined' && Boolean((window as { __OPENCHAMBER_ELECTRON__?: unknown }).__OPENCHAMBER_ELECTRON__);
};
const getInvoke = () => {
if (typeof window === 'undefined') {
return null;
}
const tauri = (window as unknown as {
__TAURI__?: { core?: { invoke?: (cmd: string, args?: InvokeArgs) => Promise<unknown> } };
}).__TAURI__;
return typeof tauri?.core?.invoke === 'function' ? tauri.core.invoke : null;
};
export const invokeDesktopCommand = async <TValue = unknown>(
command: string,
args?: InvokeArgs,
): Promise<TValue> => {
const invoke = getInvoke();
if (!invoke) {
if (!hasDesktopInvoke()) {
throw new Error('Desktop runtime is not available');
}
return invoke(command, args) as Promise<TValue>;
return invokeDesktop<TValue>(command, args) as Promise<TValue>;
};
export const startDesktopWindowDrag = async (): Promise<void> => {
@@ -33,13 +18,7 @@ export const startDesktopWindowDrag = async (): Promise<void> => {
}
try {
if (isElectronDesktop()) {
await invokeDesktopCommand('desktop_start_window_drag');
return;
}
const { getCurrentWindow } = await import('@tauri-apps/api/window');
await getCurrentWindow().startDragging();
await invokeDesktopCommand('desktop_start_window_drag');
} catch {
// ignore
}
@@ -51,11 +30,6 @@ export const isDesktopWindowFullscreen = async (): Promise<boolean> => {
}
try {
if (!isElectronDesktop()) {
const { getCurrentWindow } = await import('@tauri-apps/api/window');
return await getCurrentWindow().isFullscreen();
}
return Boolean(await invokeDesktopCommand('desktop_is_window_fullscreen'));
} catch {
return false;
@@ -77,12 +51,6 @@ export const setDesktopWindowTitle = async (title: string): Promise<void> => {
}
try {
if (!isElectronDesktop()) {
const { getCurrentWindow } = await import('@tauri-apps/api/window');
await getCurrentWindow().setTitle(title);
return;
}
await invokeDesktopCommand('desktop_set_window_title', { title });
} catch {
// ignore
@@ -98,12 +66,6 @@ export const setDesktopWindowTheme = async (
}
try {
if (!isElectronDesktop()) {
const { invoke } = await import('@tauri-apps/api/core');
await invoke('desktop_set_window_theme', { themeMode, themeVariant });
return;
}
await invokeDesktopCommand('desktop_set_window_theme', { themeMode, themeVariant });
} catch {
// ignore
@@ -116,11 +78,6 @@ export const getDesktopAppVersion = async (): Promise<string | null> => {
}
try {
if (!isElectronDesktop()) {
const { getVersion } = await import('@tauri-apps/api/app');
return await getVersion();
}
const version = await invokeDesktopCommand('desktop_get_app_version');
return typeof version === 'string' && version.trim().length > 0 ? version : null;
} catch {
@@ -146,17 +103,6 @@ export const listenDesktopNativeDragDrop = async (
return null;
}
// Electron uses the renderer's native DOM drag/drop events instead of a
// separate webview drag listener.
if (isElectronDesktop()) {
return null;
}
try {
const { getCurrentWebviewWindow } = await import('@tauri-apps/api/webviewWindow');
const webviewWindow = getCurrentWebviewWindow();
return await webviewWindow.onDragDropEvent(handler as never);
} catch {
return null;
}
void handler;
return null;
};