Move all platforms to discord_desktop_core
This commit is contained in:
parent
a172baa6c8
commit
497201770b
|
@ -1,7 +1,4 @@
|
||||||
import fs from "fs";
|
|
||||||
import path from "path";
|
|
||||||
import {app} from "electron";
|
import {app} from "electron";
|
||||||
import Module from "module";
|
|
||||||
|
|
||||||
import ipc from "./modules/ipc";
|
import ipc from "./modules/ipc";
|
||||||
import BrowserWindow from "./modules/browserwindow";
|
import BrowserWindow from "./modules/browserwindow";
|
||||||
|
@ -19,8 +16,7 @@ if (!process.argv.includes("--vanilla")) {
|
||||||
|
|
||||||
|
|
||||||
// Remove CSP immediately on linux since they install to discord_desktop_core still
|
// Remove CSP immediately on linux since they install to discord_desktop_core still
|
||||||
if (process.platform == "win32" || process.platform == "darwin") app.once("ready", CSP.remove);
|
CSP.remove();
|
||||||
else CSP.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable DevTools on Stable.
|
// Enable DevTools on Stable.
|
||||||
|
@ -36,17 +32,6 @@ Object.defineProperty(global, "appSettings", {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Use Discord's info to run the app
|
|
||||||
if (process.platform == "win32" || process.platform == "darwin") {
|
|
||||||
const appAsar = path.join(app.getAppPath(), "..", "app.asar");
|
|
||||||
const discordAsar = path.join(app.getAppPath(), "..", "discord.asar");
|
|
||||||
const basePath = fs.existsSync(discordAsar) ? discordAsar : appAsar;
|
|
||||||
const pkg = __non_webpack_require__(path.join(basePath, "package.json"));
|
|
||||||
app.setAppPath(basePath);
|
|
||||||
app.name = pkg.name;
|
|
||||||
Module._load(path.join(basePath, pkg.main), null, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Needs to run this after Discord but before ready()
|
// Needs to run this after Discord but before ready()
|
||||||
if (!process.argv.includes("--vanilla")) {
|
if (!process.argv.includes("--vanilla")) {
|
||||||
const BetterDiscord = require("./modules/betterdiscord").default;
|
const BetterDiscord = require("./modules/betterdiscord").default;
|
||||||
|
|
|
@ -46,16 +46,6 @@ export default class BetterDiscord {
|
||||||
if (!fs.existsSync(path.join(dataPath, "themes"))) fs.mkdirSync(path.join(dataPath, "themes"));
|
if (!fs.existsSync(path.join(dataPath, "themes"))) fs.mkdirSync(path.join(dataPath, "themes"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static async ensureWebpackModules(browserWindow) {
|
|
||||||
await browserWindow.webContents.executeJavaScript(`new Promise(resolve => {
|
|
||||||
const check = function() {
|
|
||||||
if (window.webpackJsonp && window.webpackJsonp.flat().flat().length >= 7000) return resolve();
|
|
||||||
setTimeout(check, 100);
|
|
||||||
};
|
|
||||||
check();
|
|
||||||
});`);
|
|
||||||
}
|
|
||||||
|
|
||||||
static async injectRenderer(browserWindow) {
|
static async injectRenderer(browserWindow) {
|
||||||
const location = path.join(__dirname, "renderer.js");
|
const location = path.join(__dirname, "renderer.js");
|
||||||
if (!fs.existsSync(location)) return; // TODO: cut a fatal log
|
if (!fs.existsSync(location)) return; // TODO: cut a fatal log
|
||||||
|
|
Loading…
Reference in New Issue