Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client-v3/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</BNavItem>
</BNavbarNav>
<BNavbarNav class="ms-auto">
<BNavItem href="/?_switch=1"> Switch to Classic UI </BNavItem>
<BNavItem v-if="!isElectronEnv" href="/?_switch=1"> Switch to Classic UI </BNavItem>
<BNavItem to="/help"> Help </BNavItem>
<BNavItem to="/about"> About </BNavItem>
<BNavItemDropdown v-if="isElectronEnv" text="Server">
Expand Down Expand Up @@ -362,7 +362,8 @@
if (!isElectronEnv.value) return;
const api = window.electronAPI as { clearActiveConnection?: () => Promise<void> } | undefined;
await api?.clearActiveConnection?.();
window.location.href = '/ui-new/electron/server-selector';
await router.push('/electron/server-selector');
window.location.reload();

Check warning on line 366 in client-v3/src/App.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=dreamteamprod_DigiScript&issues=AZ5VbR_SeDPdaD0YXObU&open=AZ5VbR_SeDPdaD0YXObU&pullRequest=1070
}

async function goToLivePage(): Promise<void> {
Expand Down
34 changes: 33 additions & 1 deletion client-v3/src/js/platform/electron.ts
Original file line number Diff line number Diff line change
@@ -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<boolean>;
getActiveConnection?: () => Promise<ElectronConnection | null>;
storageGet?: (key: string) => string | null;
storageSet?: (key: string, value: string) => void;
storageDelete?: (key: string) => void;
storageClear?: () => void;
getAllConnections?: () => Promise<ElectronConnection[]>;
addConnection?: (conn: Omit<ElectronConnection, 'id'>) => Promise<ElectronConnection>;
updateConnection?: (
id: string,
updates: Partial<ElectronConnection>
) => Promise<ElectronConnection>;
deleteConnection?: (id: string) => Promise<void>;
setActiveConnection?: (id: string) => Promise<void>;
clearActiveConnection?: () => Promise<void>;
checkVersion?: (serverUrl: string) => Promise<ElectronVersionCheckResult>;
discoverServersWithVersionCheck?: (timeout?: number) => Promise<ElectronDiscoveredServer[]>;
};
}
}
Expand Down
6 changes: 4 additions & 2 deletions client-v3/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -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:';

Check warning on line 6 in client-v3/src/router/index.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=dreamteamprod_DigiScript&issues=AZ5VbSG7eDPdaD0YXObo&open=AZ5VbSG7eDPdaD0YXObo&pullRequest=1070

Check warning on line 6 in client-v3/src/router/index.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis.window` over `window`.

See more on https://sonarcloud.io/project/issues?id=dreamteamprod_DigiScript&issues=AZ5VbSG7eDPdaD0YXObn&open=AZ5VbSG7eDPdaD0YXObn&pullRequest=1070

const router = createRouter({
history: createWebHistory('/ui-new/'),
history: isFileProtocol ? createWebHashHistory() : createWebHistory('/ui-new/'),
routes: [
{
path: '/electron/server-selector',
Expand Down
Loading
Loading