Init renderer, expose settings via ipc, init canary/ptb support
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user