diff --git a/client-v3/src/App.vue b/client-v3/src/App.vue index 85e32afa..456039df 100644 --- a/client-v3/src/App.vue +++ b/client-v3/src/App.vue @@ -94,7 +94,7 @@ - Switch to Classic UI + Switch to Classic UI Help About @@ -362,7 +362,8 @@ async function switchServer(): Promise { if (!isElectronEnv.value) return; const api = window.electronAPI as { clearActiveConnection?: () => Promise } | undefined; await api?.clearActiveConnection?.(); - window.location.href = '/ui-new/electron/server-selector'; + await router.push('/electron/server-selector'); + window.location.reload(); } async function goToLivePage(): Promise { diff --git a/client-v3/src/js/platform/electron.ts b/client-v3/src/js/platform/electron.ts index 0ea18f0f..e2e4bf5d 100644 --- a/client-v3/src/js/platform/electron.ts +++ b/client-v3/src/js/platform/electron.ts @@ -1,13 +1,45 @@ +export interface ElectronConnection { + id: string; + nickname: string; + url: string; + sslEnabled: boolean; +} + +export interface ElectronVersionCheckResult { + compatible: boolean; + serverVersion?: string; + error?: string; +} + +export interface ElectronDiscoveredServer { + name: string; + url: string; + compatible: boolean; + serverVersion?: string; + versionError?: string; +} + declare global { interface Window { electronAPI?: { getServerURLSync?: () => string | null; getAppVersion?: () => string; - getActiveConnection?: () => Promise; + getActiveConnection?: () => Promise; storageGet?: (key: string) => string | null; storageSet?: (key: string, value: string) => void; storageDelete?: (key: string) => void; storageClear?: () => void; + getAllConnections?: () => Promise; + addConnection?: (conn: Omit) => Promise; + updateConnection?: ( + id: string, + updates: Partial + ) => Promise; + deleteConnection?: (id: string) => Promise; + setActiveConnection?: (id: string) => Promise; + clearActiveConnection?: () => Promise; + checkVersion?: (serverUrl: string) => Promise; + discoverServersWithVersionCheck?: (timeout?: number) => Promise; }; } } diff --git a/client-v3/src/router/index.ts b/client-v3/src/router/index.ts index 6bb4d0b8..ba3f5fc9 100644 --- a/client-v3/src/router/index.ts +++ b/client-v3/src/router/index.ts @@ -1,10 +1,12 @@ -import { createRouter, createWebHistory } from 'vue-router'; +import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'; import { isElectron } from '@/js/platform'; import HomeView from '@/views/HomeView.vue'; import NotFoundView from '@/views/NotFoundView.vue'; +const isFileProtocol = typeof window !== 'undefined' && window.location.protocol === 'file:'; + const router = createRouter({ - history: createWebHistory('/ui-new/'), + history: isFileProtocol ? createWebHashHistory() : createWebHistory('/ui-new/'), routes: [ { path: '/electron/server-selector', diff --git a/client-v3/src/views/electron/ServerSelector.vue b/client-v3/src/views/electron/ServerSelector.vue index 20d6690c..c0173090 100644 --- a/client-v3/src/views/electron/ServerSelector.vue +++ b/client-v3/src/views/electron/ServerSelector.vue @@ -1,6 +1,713 @@ + + + + diff --git a/client/src/App.vue b/client/src/App.vue index 55cbdb6e..b8b1d303 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -91,7 +91,7 @@ - Switch to New UI + Switch to New UI Help About diff --git a/electron/main.ts b/electron/main.ts index 0f42ede3..9834627b 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -36,7 +36,7 @@ function createWindow(): void { } else { const staticPath = app.isPackaged ? path.join(process.resourcesPath, 'dist-electron') - : path.join(__dirname, '../client/dist-electron'); + : path.join(__dirname, '../../client/dist-electron'); win.loadURL( url.format({