Skip to content

Commit 17f7bd1

Browse files
committed
Inject the desktop version & server token via desktopApi
1 parent 1953785 commit 17f7bd1

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,4 +602,9 @@ registerContextMenu({
602602
});
603603

604604
// Enable custom context menus, for special cases where the UI wants to define the options available
605-
ipcMain.handle('open-context-menu', (_event: {}, options: ContextMenuDefinition) => openContextMenu(options));
605+
ipcMain.handle('open-context-menu', (_event: {}, options: ContextMenuDefinition) =>
606+
openContextMenu(options)
607+
);
608+
609+
ipcMain.handle('get-desktop-version', () => DESKTOP_VERSION);
610+
ipcMain.handle('get-server-auth-token', () => AUTH_TOKEN);

src/preload.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import { contextBridge, ipcRenderer } from 'electron';
33
import type { ContextMenuDefinition } from './context-menu';
44

55
contextBridge.exposeInMainWorld('desktopApi', {
6-
7-
selectApplication: () => ipcRenderer.invoke('select-application'),
8-
9-
openContextMenu: (options: ContextMenuDefinition) => ipcRenderer.invoke('open-context-menu', options)
10-
6+
desktopVersion: () =>
7+
ipcRenderer.invoke('get-desktop-version'),
8+
serverAuthToken: () =>
9+
ipcRenderer.invoke('get-server-auth-token'),
10+
selectApplication: () =>
11+
ipcRenderer.invoke('select-application'),
12+
openContextMenu: (options: ContextMenuDefinition) =>
13+
ipcRenderer.invoke('open-context-menu', options)
1114
});

0 commit comments

Comments
 (0)