aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-10-22 18:34:29 +0200
committerVendicated <vendicated@riseup.net>2022-10-22 18:34:29 +0200
commit0328966e0f7eca242afaf2a57f6dfadddd609d1f (patch)
treebca88ef9cef632d41e2c8f07a9911f1d52f917d7 /src
parent2eb8f3ae19b4c8e1a23c0a234457bea86a902884 (diff)
downloadVencord-0328966e0f7eca242afaf2a57f6dfadddd609d1f.tar.gz
Vencord-0328966e0f7eca242afaf2a57f6dfadddd609d1f.tar.bz2
Vencord-0328966e0f7eca242afaf2a57f6dfadddd609d1f.zip
Unbrick OpenAsar installs
Diffstat (limited to 'src')
-rw-r--r--src/patcher.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/patcher.ts b/src/patcher.ts
index 542fba5..16c4728 100644
--- a/src/patcher.ts
+++ b/src/patcher.ts
@@ -29,11 +29,13 @@ console.log("[Vencord] Starting up...");
// Our injector file at app/index.js
const injectorPath = require.main!.filename;
// The original app.asar
-const discordPath = join(dirname(injectorPath), "..", "app.asar");
-// Full main path Discord uses
-require.main!.filename = join(discordPath, "app_bootstrap/index.js");
+const asarPath = join(dirname(injectorPath), "..", "app.asar");
+
+const discordPkg = require(join(asarPath, "package.json"));
+require.main!.filename = join(asarPath, discordPkg.main);
+
// @ts-ignore Untyped method? Dies from cringe
-app.setAppPath(discordPath);
+app.setAppPath(asarPath);
// Repatch after host updates on Windows
if (process.platform === "win32")
@@ -121,5 +123,6 @@ if (readFileSync(injectorPath, "utf-8").includes('require("../app.asar")')) {
return loadModule.apply(this, arguments);
};
} else {
- require(discordPath);
+ console.log(require.main!.filename);
+ require(require.main!.filename);
}