aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/index.ts1
-rw-r--r--src/main/ipcMain.ts2
-rw-r--r--src/main/patcher.ts2
-rw-r--r--src/main/updater/common.ts4
-rw-r--r--src/preload.ts6
5 files changed, 8 insertions, 7 deletions
diff --git a/src/main/index.ts b/src/main/index.ts
index a8b9429..2e1a10e 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -44,6 +44,7 @@ if (IS_VENCORD_DESKTOP || !IS_VANILLA) {
case "renderer.js.map":
case "vencordDesktopRenderer.js.map":
case "preload.js.map":
+ case "vencordDesktopPreload.js.map":
case "patcher.js.map":
case "vencordDesktopMain.js.map":
cb(join(__dirname, url));
diff --git a/src/main/ipcMain.ts b/src/main/ipcMain.ts
index c86268d..625f24f 100644
--- a/src/main/ipcMain.ts
+++ b/src/main/ipcMain.ts
@@ -138,7 +138,7 @@ ipcMain.handle(IpcEvents.OPEN_MONACO_EDITOR, async () => {
autoHideMenuBar: true,
darkTheme: true,
webPreferences: {
- preload: join(__dirname, "preload.js"),
+ preload: join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js"),
contextIsolation: true,
nodeIntegration: false,
sandbox: false
diff --git a/src/main/patcher.ts b/src/main/patcher.ts
index 066cb3d..2259b20 100644
--- a/src/main/patcher.ts
+++ b/src/main/patcher.ts
@@ -71,7 +71,7 @@ if (!IS_VANILLA) {
constructor(options: BrowserWindowConstructorOptions) {
if (options?.webPreferences?.preload && options.title) {
const original = options.webPreferences.preload;
- options.webPreferences.preload = join(__dirname, "preload.js");
+ options.webPreferences.preload = join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js");
options.webPreferences.sandbox = false;
if (settings.frameless) {
options.frame = false;
diff --git a/src/main/updater/common.ts b/src/main/updater/common.ts
index 69832d1..41b9837 100644
--- a/src/main/updater/common.ts
+++ b/src/main/updater/common.ts
@@ -18,9 +18,9 @@
export const VENCORD_FILES = [
IS_DISCORD_DESKTOP ? "patcher.js" : "vencordDesktopMain.js",
- "preload.js",
+ IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js",
IS_DISCORD_DESKTOP ? "renderer.js" : "vencordDesktopRenderer.js",
- "renderer.css"
+ IS_DISCORD_DESKTOP ? "renderer.css" : "vencordDesktopRenderer.css",
];
export function serializeErrors(func: (...args: any[]) => any) {
diff --git a/src/preload.ts b/src/preload.ts
index 5f6c445..2beaf39 100644
--- a/src/preload.ts
+++ b/src/preload.ts
@@ -28,7 +28,7 @@ contextBridge.exposeInMainWorld("VencordNative", VencordNative);
// Discord
if (location.protocol !== "data:") {
// #region cssInsert
- const rendererCss = join(__dirname, "renderer.css");
+ const rendererCss = join(__dirname, IS_VENCORD_DESKTOP ? "vencordDesktopRenderer.css" : "renderer.css");
const style = document.createElement("style");
style.id = "vencord-css-core";
@@ -51,9 +51,9 @@ if (location.protocol !== "data:") {
}
// #endregion
- if (process.env.DISCORD_PRELOAD) {
+ if (IS_DISCORD_DESKTOP) {
webFrame.executeJavaScript(readFileSync(join(__dirname, "renderer.js"), "utf-8"));
- require(process.env.DISCORD_PRELOAD);
+ require(process.env.DISCORD_PRELOAD!);
}
} // Monaco popout
else {