Initial Commit

This commit is contained in:
Draculabo committed 2025-12-23 01:38:53 +08:00
commit d0417339c1
158 files changed
+31368

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { ipcRenderer, contextBridge } from 'electron';
import { IPC_CHANNELS } from './constants';
window.addEventListener('message', (event) => {
if (event.data === IPC_CHANNELS.START_ORPC_SERVER) {
const [serverPort] = event.ports;
ipcRenderer.postMessage(IPC_CHANNELS.START_ORPC_SERVER, null, [serverPort]);
}
});
contextBridge.exposeInMainWorld('electron', {
onGoogleAuthCode: (callback: (code: string) => void) => {
const handler = (_event: any, code: string) => callback(code);
ipcRenderer.on('GOOGLE_AUTH_CODE', handler);
return () => ipcRenderer.off('GOOGLE_AUTH_CODE', handler);
},
changeLanguage: (lang: string) => {
ipcRenderer.send(IPC_CHANNELS.CHANGE_LANGUAGE, lang);
},
});