|
|
|
@ -42,6 +42,7 @@ require.main!.filename = join(asarPath, discordPkg.main);
|
|
|
|
|
// @ts-ignore Untyped method? Dies from cringe
|
|
|
|
|
app.setAppPath(asarPath);
|
|
|
|
|
|
|
|
|
|
if (!process.argv.includes("--vanilla")) {
|
|
|
|
|
// Repatch after host updates on Windows
|
|
|
|
|
if (process.platform === "win32")
|
|
|
|
|
require("./patchWin32Updater");
|
|
|
|
@ -121,19 +122,22 @@ electron.app.whenReady().then(() => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
electron.session.defaultSession.webRequest.onHeadersReceived(({ responseHeaders, url }, cb) => {
|
|
|
|
|
electron.session.defaultSession.webRequest.onHeadersReceived(({ responseHeaders, resourceType }, cb) => {
|
|
|
|
|
if (responseHeaders) {
|
|
|
|
|
if (resourceType === "mainFrame")
|
|
|
|
|
patchCsp(responseHeaders, "content-security-policy");
|
|
|
|
|
patchCsp(responseHeaders, "content-security-policy-report-only");
|
|
|
|
|
|
|
|
|
|
// Fix hosts that don't properly set the content type, such as
|
|
|
|
|
// Fix hosts that don't properly set the css content type, such as
|
|
|
|
|
// raw.githubusercontent.com
|
|
|
|
|
if (url.endsWith(".css"))
|
|
|
|
|
if (resourceType === "stylesheet")
|
|
|
|
|
responseHeaders["content-type"] = ["text/css"];
|
|
|
|
|
}
|
|
|
|
|
cb({ cancel: false, responseHeaders });
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
console.log("[Vencord] Running in vanilla mode. Not loading Vencord");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("[Vencord] Loading original Discord app.asar");
|
|
|
|
|
// Legacy Vencord Injector requires "../app.asar". However, because we
|
|
|
|
|