Оптимизация ядра, исправление гонки потоков при получении версии

This commit is contained in:
RoyceDa
2026-02-20 16:34:54 +02:00
parent f01ed34285
commit 2e18d489be
17 changed files with 196 additions and 101 deletions

View File

@@ -4,46 +4,25 @@ import api from './api'
const exposeContext = async () => {
let version = await ipcRenderer.invoke("get-core-version");
let appPath = await ipcRenderer.invoke("get-app-path");
let arch = await ipcRenderer.invoke("get-arch");
let deviceName = await ipcRenderer.invoke("device:name");
let deviceId = await ipcRenderer.invoke("device:id");
let downloadsPath = await ipcRenderer.invoke("get-downloads-path");
if (process.contextIsolated) {
try {
contextBridge.exposeInMainWorld('electron', electronAPI)
contextBridge.exposeInMainWorld('api', api)
contextBridge.exposeInMainWorld('version', version);
contextBridge.exposeInMainWorld('platform', process.platform);
contextBridge.exposeInMainWorld('appPath', appPath);
contextBridge.exposeInMainWorld('arch', arch);
contextBridge.exposeInMainWorld('deviceName', deviceName);
contextBridge.exposeInMainWorld('deviceId', deviceId);
contextBridge.exposeInMainWorld('shell', {
openExternal: (url: string) => {
ipcRenderer.invoke('openExternal', url);
ipcRenderer.invoke('ipcCore:openExternal', url);
},
showItemInFolder: (fullPath: string) => {
ipcRenderer.invoke('showItemInFolder', fullPath);
ipcRenderer.invoke('ipcCore:showItemInFolder', fullPath);
}
});
contextBridge.exposeInMainWorld('downloadsPath', downloadsPath)
} catch (error) {
console.error(error)
}
} else {
window.electron = electronAPI
window.api = api
window.version = version;
window.platform = process.platform;
window.appPath = appPath;
window.arch = arch;
window.api = api;
window.shell = shell;
window.downloadsPath = downloadsPath;
window.deviceName = deviceName;
window.deviceId = deviceId;
}
}