Init renderer, expose settings via ipc, init canary/ptb support

This commit is contained in:
Vendicated
2023-04-04 04:40:03 +02:00
parent 18a77d45b8
commit 79d73e23c0
8 changed files with 82 additions and 22 deletions

View File

@@ -1,9 +1,17 @@
import { ipcRenderer } from "electron";
import { RELAUNCH } from "../shared/IpcEvents";
import type { Settings } from "../main/settings";
import { GET_SETTINGS, RELAUNCH, SET_SETTINGS, SHOW_IN_FOLDER } from "../shared/IpcEvents";
export const VencordDesktop = {
app: {
relaunch: () => ipcRenderer.invoke(RELAUNCH)
},
files: {
showInFolder: (path: string) => ipcRenderer.invoke(SHOW_IN_FOLDER, path)
},
settings: {
get: () => ipcRenderer.sendSync(GET_SETTINGS),
set: (settings: typeof Settings) => ipcRenderer.invoke(SET_SETTINGS, settings)
}
}

View File

@@ -1,7 +1,9 @@
import { contextBridge, ipcRenderer } from "electron";
import { GET_PRELOAD_FILE } from "../shared/IpcEvents";
import { contextBridge, ipcRenderer, webFrame } from "electron";
import { GET_RENDERER_SCRIPT, GET_VENCORD_PRELOAD_FILE } from "../shared/IpcEvents";
import { VencordDesktop } from "./VencordDesktop";
contextBridge.exposeInMainWorld("VencordDesktop", VencordDesktop);
require(ipcRenderer.sendSync(GET_PRELOAD_FILE));
require(ipcRenderer.sendSync(GET_VENCORD_PRELOAD_FILE));
webFrame.executeJavaScript(ipcRenderer.sendSync(GET_RENDERER_SCRIPT));