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

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

62
app/hooks/useCore.ts Normal file
View File

@@ -0,0 +1,62 @@
export function useCore() {
const openExternal = (url: string) => {
window.shell.openExternal(url);
};
const showItemInFolder = (fullPath: string) => {
window.shell.showItemInFolder(fullPath);
};
const getCoreVersion = async () => {
const version = await window.electron.ipcRenderer.invoke('ipcCore:getCoreVersion');
return version;
}
const getArch = async () => {
const arch = await window.electron.ipcRenderer.invoke('ipcCore:getArch');
return arch;
}
const getUserDir = async () => {
const userDir = await window.electron.ipcRenderer.invoke('ipcCore:getUserDir');
return userDir;
}
const getAppPath = async () => {
const appPath = await window.electron.ipcRenderer.invoke('ipcCore:getAppPath');
return appPath;
}
const getDownloadsPath = async () => {
const downloadsPath = await window.electron.ipcRenderer.invoke('ipcCore:getDownloadsPath');
return downloadsPath;
}
const getPlatform = async () => {
const platform = await window.electron.ipcRenderer.invoke('ipcCore:getPlatform');
return platform;
}
const getDeviceName = async () => {
const deviceName = await window.electron.ipcRenderer.invoke('device:name');
return deviceName;
}
const getDeviceId = async () => {
const deviceId = await window.electron.ipcRenderer.invoke('device:id');
return deviceId;
}
return {
openExternal,
showItemInFolder,
getCoreVersion,
getArch,
getUserDir,
getAppPath,
getDownloadsPath,
getPlatform,
getDeviceName,
getDeviceId
}
}