add get platform API
This commit is contained in:
parent
18fbabe56c
commit
7d3c0b3c09
|
@ -27,6 +27,15 @@ export const openDirectory = async (dirPath: string): Promise<void> => {
|
|||
}
|
||||
};
|
||||
|
||||
export const getPlatform = async (): Promise<'mac' | 'windows' | 'linux'> => {
|
||||
try {
|
||||
return await ipcRenderer.invoke('get-platform');
|
||||
} catch (e) {
|
||||
logError(e, 'failed to get platform');
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
logToDisk,
|
||||
openLogDirectory,
|
||||
|
|
|
@ -41,6 +41,7 @@ import {
|
|||
getAppVersion,
|
||||
openDirectory,
|
||||
updateOptOutOfCrashReports,
|
||||
getPlatform,
|
||||
} from './api/common';
|
||||
import { fixHotReloadNext12 } from './utils/preload';
|
||||
import {
|
||||
|
@ -117,4 +118,5 @@ windowObject['ElectronAPIs'] = {
|
|||
updateOptOutOfCrashReports,
|
||||
computeImageEmbedding,
|
||||
computeTextEmbedding,
|
||||
getPlatform,
|
||||
};
|
||||
|
|
|
@ -31,6 +31,7 @@ import {
|
|||
computeImageEmbedding,
|
||||
computeTextEmbedding,
|
||||
} from '../services/clipService';
|
||||
import { getPlatform } from './common/platform';
|
||||
|
||||
export default function setupIpcComs(
|
||||
tray: Tray,
|
||||
|
@ -176,4 +177,7 @@ export default function setupIpcComs(
|
|||
ipcMain.handle('compute-text-embedding', (_, text) => {
|
||||
return computeTextEmbedding(text);
|
||||
});
|
||||
ipcMain.handle('get-platform', () => {
|
||||
return getPlatform();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue