mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-15 21:00:42 -07:00
- Replaced direct Tauri API calls with a unified platform context across multiple components, enhancing code maintainability and readability. - Removed the deprecated tauri.ts file, consolidating platform-related logic into the new PlatformContext. - Updated components such as App, AudioPlayer, and ServerSettings to utilize the new platform context for lifecycle management and server interactions. - Improved platform detection and handling for audio playback and system audio capture functionalities. - Ensured consistent error handling and user feedback across the application when interacting with platform-specific features.
28 lines
796 B
TypeScript
28 lines
796 B
TypeScript
import type { PlatformLifecycle } from '@/platform/types';
|
|
|
|
class WebLifecycle implements PlatformLifecycle {
|
|
onServerReady?: () => void;
|
|
|
|
async startServer(_remote = false): Promise<string> {
|
|
// Web assumes server is running externally
|
|
// Return a default URL - this should be configured via env vars
|
|
const serverUrl = import.meta.env.VITE_SERVER_URL || 'http://localhost:17493';
|
|
this.onServerReady?.();
|
|
return serverUrl;
|
|
}
|
|
|
|
async stopServer(): Promise<void> {
|
|
// No-op for web - server is managed externally
|
|
}
|
|
|
|
async setKeepServerRunning(_keep: boolean): Promise<void> {
|
|
// No-op for web
|
|
}
|
|
|
|
async setupWindowCloseHandler(): Promise<void> {
|
|
// No-op for web - no window close handling needed
|
|
}
|
|
}
|
|
|
|
export const webLifecycle = new WebLifecycle();
|