mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-27 00:55:16 -07:00
feat(macos): configuration window + curl-backed macOS updater (#71)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { contextBridge, ipcRenderer } from 'electron';
|
||||
import type {
|
||||
ConfigSettingsAPI,
|
||||
ConfigSettingsPatch,
|
||||
ConfigSettingsSaveResult,
|
||||
ConfigSettingsSnapshot,
|
||||
} from './types/settings';
|
||||
|
||||
const SETTINGS_IPC_CHANNELS = {
|
||||
getSnapshot: 'config:get-settings-snapshot',
|
||||
savePatch: 'config:save-settings-patch',
|
||||
openFile: 'config:open-settings-file',
|
||||
openWindow: 'config:open-settings-window',
|
||||
} as const;
|
||||
|
||||
const configSettingsAPI: ConfigSettingsAPI = {
|
||||
getSnapshot: (): Promise<ConfigSettingsSnapshot> =>
|
||||
ipcRenderer.invoke(SETTINGS_IPC_CHANNELS.getSnapshot),
|
||||
savePatch: (patch: ConfigSettingsPatch): Promise<ConfigSettingsSaveResult> =>
|
||||
ipcRenderer.invoke(SETTINGS_IPC_CHANNELS.savePatch, patch),
|
||||
openSettingsFile: (): Promise<boolean> => ipcRenderer.invoke(SETTINGS_IPC_CHANNELS.openFile),
|
||||
openSettingsWindow: (): Promise<boolean> => ipcRenderer.invoke(SETTINGS_IPC_CHANNELS.openWindow),
|
||||
};
|
||||
|
||||
contextBridge.exposeInMainWorld('configSettingsAPI', configSettingsAPI);
|
||||
Reference in New Issue
Block a user