|
1 | | -const { contextBridge, ipcRenderer } = require("electron"); |
| 1 | +const { contextBridge, ipcRenderer } = require('electron'); |
2 | 2 |
|
3 | | -ipcRenderer.send("preload-ready", { |
| 3 | +ipcRenderer.send('preload-ready', { |
4 | 4 | hasContextBridge: true, |
5 | | - location: "electron/preload.cjs", |
| 5 | + location: 'electron/preload.cjs' |
6 | 6 | }); |
7 | 7 |
|
8 | | -contextBridge.exposeInMainWorld("electronAPI", { |
| 8 | +contextBridge.exposeInMainWorld('electronAPI', { |
9 | 9 | onQrUpdate(cb) { |
10 | | - ipcRenderer.on("qr-update", (_event, data) => cb(data)); |
| 10 | + ipcRenderer.on('qr-update', (_event, data) => cb(data)); |
11 | 11 | }, |
12 | 12 | onQrStatus(cb) { |
13 | | - ipcRenderer.on("qr-status", (_event, status) => cb(status)); |
| 13 | + ipcRenderer.on('qr-status', (_event, status) => cb(status)); |
14 | 14 | }, |
15 | 15 | onAppState(cb) { |
16 | | - ipcRenderer.on("app-state", (_event, state) => cb(state)); |
| 16 | + ipcRenderer.on('app-state', (_event, state) => cb(state)); |
17 | 17 | }, |
18 | 18 | selectDirectory() { |
19 | | - return ipcRenderer.invoke("select-directory"); |
| 19 | + return ipcRenderer.invoke('select-directory'); |
20 | 20 | }, |
21 | 21 | confirmSetup(workingDirectory) { |
22 | | - return ipcRenderer.invoke("confirm-setup", workingDirectory); |
| 22 | + return ipcRenderer.invoke('confirm-setup', workingDirectory); |
23 | 23 | }, |
24 | 24 | getConfig() { |
25 | | - return ipcRenderer.invoke("get-config"); |
| 25 | + return ipcRenderer.invoke('get-config'); |
| 26 | + }, |
| 27 | + getI18nData() { |
| 28 | + return ipcRenderer.invoke('get-i18n-data'); |
| 29 | + }, |
| 30 | + setLocale(locale) { |
| 31 | + return ipcRenderer.invoke('set-locale', locale); |
26 | 32 | }, |
27 | 33 | getDashboardData() { |
28 | | - return ipcRenderer.invoke("get-dashboard-data"); |
| 34 | + return ipcRenderer.invoke('get-dashboard-data'); |
29 | 35 | }, |
30 | 36 | getRecentLogs(maxLines = 120) { |
31 | | - return ipcRenderer.invoke("get-recent-logs", maxLines); |
| 37 | + return ipcRenderer.invoke('get-recent-logs', maxLines); |
32 | 38 | }, |
33 | 39 | setWorkingDirectory(workingDirectory) { |
34 | | - return ipcRenderer.invoke("set-working-directory", workingDirectory); |
| 40 | + return ipcRenderer.invoke('set-working-directory', workingDirectory); |
35 | 41 | }, |
36 | 42 | setPermissionMode(permissionMode) { |
37 | | - return ipcRenderer.invoke("set-permission-mode", permissionMode); |
| 43 | + return ipcRenderer.invoke('set-permission-mode', permissionMode); |
38 | 44 | }, |
39 | 45 | setModel(model) { |
40 | | - return ipcRenderer.invoke("set-model", model); |
| 46 | + return ipcRenderer.invoke('set-model', model); |
41 | 47 | }, |
42 | 48 | resolvePermission(allowed) { |
43 | | - return ipcRenderer.invoke("resolve-permission", allowed); |
| 49 | + return ipcRenderer.invoke('resolve-permission', allowed); |
44 | 50 | }, |
45 | 51 | openWorkingDirectory() { |
46 | | - return ipcRenderer.invoke("open-working-directory"); |
| 52 | + return ipcRenderer.invoke('open-working-directory'); |
47 | 53 | }, |
48 | 54 | openLogDirectory() { |
49 | | - return ipcRenderer.invoke("open-log-directory"); |
| 55 | + return ipcRenderer.invoke('open-log-directory'); |
50 | 56 | }, |
51 | 57 | relogin() { |
52 | | - return ipcRenderer.invoke("relogin"); |
| 58 | + return ipcRenderer.invoke('relogin'); |
53 | 59 | }, |
54 | 60 | showMainWindow() { |
55 | | - return ipcRenderer.invoke("show-main-window"); |
56 | | - }, |
| 61 | + return ipcRenderer.invoke('show-main-window'); |
| 62 | + } |
57 | 63 | }); |
0 commit comments