so uhhh
This commit is contained in:
parent
46b2f02af1
commit
04dbcb20a0
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -89,13 +89,14 @@ export const settings = {
|
|||
|
||||
/** Lightcord */
|
||||
"Disable BetterDiscord": {id: "bd-disable", info: "Disable Betterdiscord (plugins, themes, etc) (Not implemented).", implemented: false, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Blur Personnal Informations":{id: "lightcord-6", info: "Blur sensitive informations like email, payment infos and more.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Blur Personal Information": {id: "lightcord-6", info: "Blur sensitive informations like email, payment infos and more.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Calling Ring Beat": {id: "lightcord-2", info: "Enable Discord's special calling beat.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Developer Options": {id: "lightcord-1", info: "Enable Discord's & Lightcord's Internal Developer Options. This allow the \"Experiments\" tab, the \"Developer Options\" tab and the \"Api Components\" tab.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Ad Block": {id: "lightcord-4", info: "Block any BOT that dms you with an invite link. Even in an embed.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Enable Lightcord Servers": {id: "lightcord-5", info: "Enable Lightcord's servers. Disabling this will disable custom badges.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Disable typing": {id: "lightcord-7", info: "Don't let other see you're typing.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Lightcord Tabs": {id: "lightcord-8", info: "Allows you to launch multiple instances of Lightcord in the same window (EXPERIMENTAL).", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"No Window Bounds": {id: "no_window_bound", info: "Disable Window Bounds. Can be useful if you use a window manager.", implemented: true, hidden: process.platform == "linux", cat: "lightcord", category: "Lightcord"},
|
||||
|
||||
/** Lightcord Window */
|
||||
"Always-on-Top": {id: "lightcord-3", info: "Enable window's Always-on-Top mode, where Lightcord stays on top of other applications.", implemented: true, hidden: false, cat: "lightcord", category: "Window"},
|
||||
|
@ -147,6 +148,7 @@ export const defaultCookie = {
|
|||
"lightcord-6": true,
|
||||
"lightcord-7": false,
|
||||
"lightcord-8": false,
|
||||
"no_window_bound": false,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ export default new class V2_SettingsPanel {
|
|||
}
|
||||
|
||||
updateSettings(id, enabled, sidebar) {
|
||||
if(!["lightcord-8"].includes(id))settingsCookie[id] = enabled;
|
||||
if(!["lightcord-8", "no_window_bound"].includes(id))settingsCookie[id] = enabled;
|
||||
|
||||
if (id == "bda-gs-2") {
|
||||
if (enabled) DOM.addClass(document.body, "bd-minimal");
|
||||
|
@ -266,6 +266,13 @@ export default new class V2_SettingsPanel {
|
|||
remote.app.relaunch()
|
||||
remote.app.exit()
|
||||
}
|
||||
if (id === "no_window_bound"){
|
||||
let appSettings = remote.getGlobal("appSettings")
|
||||
appSettings.set("NO_WINDOWS_BOUND", enabled)
|
||||
appSettings.save()
|
||||
remote.app.relaunch()
|
||||
remote.app.exit()
|
||||
}
|
||||
|
||||
this.saveSettings();
|
||||
}
|
||||
|
@ -327,6 +334,7 @@ export default new class V2_SettingsPanel {
|
|||
section.settings.map(setting => {
|
||||
let isChecked = settingsCookie[setting.id]
|
||||
if(setting.id === "lightcord-8")isChecked = appSettings.get("isTabs", false);
|
||||
if(setting.id === "no_window_bound")isChecked = appSettings.get("NO_WINDOWS_BOUND", false)
|
||||
let returnValue = BDV2.react.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: isChecked, onChange: (id, checked) => {
|
||||
this.onChange(id, checked, sidebar);
|
||||
}})
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,11 @@
|
|||
export default function cloneNullProto<Obj=any>(obj:Obj):Obj{ // recreate object without __proto__
|
||||
let o = Object.create(null)
|
||||
Object.keys(obj).forEach(k => {
|
||||
o[k] = obj[k]
|
||||
})
|
||||
return o
|
||||
/**
|
||||
* Recreate the given object without the __proto__. Useful for better formatting when output in console.
|
||||
* @param obj The object to recreate
|
||||
*/
|
||||
export default function cloneNullProto<Obj=any>(obj:Obj):Obj{
|
||||
let o = Object.create(null)
|
||||
Object.keys(obj).forEach(k => {
|
||||
o[k] = obj[k]
|
||||
})
|
||||
return o
|
||||
}
|
|
@ -19,12 +19,19 @@ async function processNextDir(dir, zip, bpath, platform){
|
|||
.map(async file => {
|
||||
let path = __path.join(dir, file.name)
|
||||
if(file.isDirectory()){
|
||||
return await processNextDir(path, zip, bpath)
|
||||
return await processNextDir(path, zip, bpath, platform)
|
||||
}else if(file.isFile()){
|
||||
console.log(file.name)
|
||||
if((file.name.endsWith("_linux.node") && platform === "win") || (file.name.endsWith(".node") && !file.name.endsWith("_linux.node") && platform === "lin")){
|
||||
return
|
||||
if(!path.includes("node_modules")){
|
||||
if(platform === "win"){
|
||||
if(file.name.endsWith("_linux.node"))return
|
||||
}else if(platform === "lin"){
|
||||
if(file.name.endsWith(".node")){
|
||||
if(!file.name.endsWith("_linux.node"))return
|
||||
}
|
||||
if(file.name.endsWith(".dll"))return
|
||||
}
|
||||
}
|
||||
console.log("Adding "+file.name+" to "+platform)
|
||||
let stat = fs.statSync(path)
|
||||
zip.addBuffer(await fsAsync.readFile(path), __path.relative(bpath, path), {
|
||||
mode: stat.mode,
|
||||
|
|
53
build.js
53
build.js
|
@ -3,7 +3,6 @@ const path = require("path")
|
|||
const terser = require("terser")
|
||||
const util = require("util")
|
||||
|
||||
/** Super noisy if production is on. */
|
||||
const production = true
|
||||
|
||||
let fs = require("fs")
|
||||
|
@ -23,14 +22,15 @@ async function main(){
|
|||
await fs.promises.mkdir(__dirname+"/distApp/dist", {"recursive": true})
|
||||
|
||||
console.info("Executing command `npm run compile`")
|
||||
//console.log(child_process.execSync("npm run compile", {encoding: "binary"}))
|
||||
console.log(child_process.execSync("npm run compile", {encoding: "binary"}))
|
||||
|
||||
let startDir = path.join(__dirname, "./dist")
|
||||
let newDir = path.join(__dirname, "./distApp/dist")
|
||||
console.info("No error detected. Copying files from "+startDir+".")
|
||||
await fs.promises.mkdir(startDir, {recursive: true})
|
||||
|
||||
async function processNextDir(folder, folders, predicate, compile){
|
||||
async function processNextDir(folder, folders, predicate, compile, ignoreModules){
|
||||
if(typeof ignoreModules === "undefined")ignoreModules = false
|
||||
for(let file of fs.readdirSync(folder, {withFileTypes: true})){
|
||||
if(file.isFile()){
|
||||
let filepath = path.join(folder, file.name)
|
||||
|
@ -40,6 +40,7 @@ async function main(){
|
|||
await fs.promises.copyFile(filepath, filepath.replace(folders.startDir, folders.newDir))
|
||||
}
|
||||
}else if(file.isDirectory()){
|
||||
if(ignoreModules && file.name === "node_modules")continue
|
||||
await fs.promises.mkdir(path.join(folder, file.name).replace(folders.startDir, folders.newDir), {recursive: true})
|
||||
await processNextDir(path.join(folder, file.name), ...Array.from(arguments).slice(1))
|
||||
}
|
||||
|
@ -66,16 +67,36 @@ async function main(){
|
|||
startDir: path.join(__dirname, "modules"),
|
||||
newDir: path.join(__dirname, "distApp", "modules")
|
||||
}, ((filepath) => filepath.endsWith(".js") && (!production ? !filepath.includes("node_modules") : true)), async (filepath, newpath) => {
|
||||
if(filepath.includes("node_modules"))return // don't minify node_modules, and don't include them at all. Installing later
|
||||
console.info(`Minifying ${filepath} to ${newpath}`)
|
||||
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
|
||||
}).then(() => {
|
||||
}, true).then(() => {
|
||||
console.info(`Copied files and minified them from ${path.join(__dirname, "modules")}.`)
|
||||
})
|
||||
|
||||
await Promise.all((await fs.promises.readdir(path.join(__dirname, "distApp", "modules"))).map(async mdl => {
|
||||
let dir = path.join(__dirname, "distApp", "modules", mdl)
|
||||
|
||||
if(!fs.existsSync(path.join(dir, "package.json"))){
|
||||
if(mdl === "discord_desktop_core"){
|
||||
dir = path.join(dir, "core")
|
||||
}else{
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
console.info(`Installing modules for ${mdl}`)
|
||||
console.log(child_process.execSync("npm install --only=prod", {
|
||||
encoding: "binary",
|
||||
cwd: dir
|
||||
}))
|
||||
}))
|
||||
|
||||
await processNextDir(path.join(__dirname, "LightcordApi"), {
|
||||
startDir: path.join(__dirname, "LightcordApi"),
|
||||
newDir: path.join(__dirname, "distApp", "LightcordApi")
|
||||
}, ((filepath) => filepath.endsWith(".js") && (!production ? !filepath.includes("node_modules") : true)), async (filepath, newpath) => {
|
||||
if(filepath.includes("node_modules"))return // don't minify node_modules, and don't include them at all. Installing later
|
||||
console.info(`Minifying ${filepath} to ${newpath}`)
|
||||
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
|
||||
}).then(() => {
|
||||
|
@ -83,13 +104,20 @@ async function main(){
|
|||
})
|
||||
|
||||
await fs.promises.rmdir(path.join(__dirname, "distApp", "LightcordApi", "src"), {"recursive": true})
|
||||
await fs.promises.rmdir(path.join(__dirname, "distApp", "LightcordApi", "dist"), {"recursive": true})
|
||||
await fs.promises.unlink(path.join(__dirname, "distApp", "LightcordApi", "webpack.config.js"))
|
||||
await fs.promises.unlink(path.join(__dirname, "distApp", "LightcordApi", "tsconfig.json"))
|
||||
|
||||
console.log(child_process.execSync("npm install --only=prod", {
|
||||
encoding: "binary",
|
||||
cwd: path.join(__dirname, "distApp", "LightcordApi")
|
||||
}))
|
||||
|
||||
await processNextDir(path.join(__dirname, "DiscordJS"), {
|
||||
startDir: path.join(__dirname, "DiscordJS"),
|
||||
newDir: path.join(__dirname, "distApp", "DiscordJS")
|
||||
}, ((filepath) => filepath.endsWith(".js") && (!production ? !filepath.includes("node_modules") : true)), async (filepath, newpath) => {
|
||||
if(filepath.includes("node_modules"))return // don't minify node_modules, and don't include them at all
|
||||
console.info(`Minifying ${filepath} to ${newpath}`)
|
||||
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
|
||||
}).then(() => {
|
||||
|
@ -100,6 +128,11 @@ async function main(){
|
|||
await fs.promises.unlink(path.join(__dirname, "distApp", "DiscordJS", "webpack.config.js"))
|
||||
await fs.promises.unlink(path.join(__dirname, "distApp", "DiscordJS", "tsconfig.json"))
|
||||
|
||||
console.log(child_process.execSync("npm install --only=prod", {
|
||||
encoding: "binary",
|
||||
cwd: path.join(__dirname, "distApp", "LightcordApi")
|
||||
}))
|
||||
|
||||
fs.mkdirSync(path.join(__dirname, "distApp", "BetterDiscordApp", "js"), {recursive: true})
|
||||
fs.mkdirSync(path.join(__dirname, "distApp", "BetterDiscordApp", "css"), {recursive: true})
|
||||
const BDPackageJSON = require("./BetterDiscordApp/package.json")
|
||||
|
@ -122,22 +155,14 @@ async function main(){
|
|||
}).then(() => {
|
||||
console.info(`Copied files and minified them from ${path.join(__dirname, "splash")}.`)
|
||||
})
|
||||
|
||||
/*
|
||||
await processNextDir(startDir, {
|
||||
startDir,
|
||||
newDir
|
||||
}, ((filepath) => false), ()=>{}).then(() => {
|
||||
console.info(`Copied files and minified them from ${startDir}.`)
|
||||
}).catch(console.error)*/
|
||||
|
||||
let packageJSON = require("./package.json")
|
||||
packageJSON.scripts.build = packageJSON.scripts.build.replace("./distApp", ".")
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, "distApp", "package.json"), JSON.stringify(packageJSON), "utf8")
|
||||
|
||||
console.info(`Installing ${Object.keys(packageJSON.dependencies).length + Object.keys(packageJSON.devDependencies).length} packages...`)
|
||||
console.log(child_process.execSync("npm i", {
|
||||
console.info(`Installing ${Object.keys(packageJSON.dependencies).length} packages...`)
|
||||
console.log(child_process.execSync("npm install --only=prod", {
|
||||
encoding: "binary",
|
||||
cwd: path.join(__dirname, "distApp")
|
||||
}))
|
||||
|
|
|
@ -369,7 +369,7 @@ function launchMainAppWindow(isVisible) {
|
|||
mainWindowOptions.frame = false;
|
||||
}
|
||||
|
||||
applyWindowBoundsToConfig(mainWindowOptions);
|
||||
if(!settings.get("NO_WINDOWS_BOUND", false))applyWindowBoundsToConfig(mainWindowOptions);
|
||||
|
||||
mainWindow = new electron.BrowserWindow(mainWindowOptions);
|
||||
mainWindowId = mainWindow.id;
|
||||
|
@ -389,12 +389,14 @@ function launchMainAppWindow(isVisible) {
|
|||
|
||||
mainWindow.setMenuBarVisibility(false);
|
||||
|
||||
if (settings.get('IS_MAXIMIZED')) {
|
||||
mainWindow.maximize();
|
||||
}
|
||||
|
||||
if (settings.get('IS_MINIMIZED')) {
|
||||
mainWindow.minimize();
|
||||
if(!settings.get("NO_WINDOWS_BOUND", false)){
|
||||
if (settings.get('IS_MAXIMIZED')) {
|
||||
mainWindow.maximize();
|
||||
}
|
||||
|
||||
if (settings.get('IS_MINIMIZED')) {
|
||||
mainWindow.minimize();
|
||||
}
|
||||
}
|
||||
|
||||
mainWindow.webContents.on('new-window', (e, windowURL, frameName, disposition, options) => {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "discord_spellcheck",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1
|
||||
}
|
|
@ -3,8 +3,7 @@
|
|||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
"run": "electron .",
|
||||
"build": "npm run build:minify && npm run build:electron && npm run build:after",
|
||||
"build:electron": "npm run build:electron_win && npm run build:electron_linux",
|
||||
"build:electron_win": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts)\" --arch=ia32 --win32metadata.ProductName=\"Lightcord\" --win32metadata.CompanyName=\"Lightcord\" --protocol=discord --platform=\"win32\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack=*.{node,dll} --overwrite",
|
||||
"build:electron_linux": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts)\" --arch=x64 --protocol=discord --platform=\"linux\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack=*.{node,dll,so.4} --overwrite",
|
||||
"build:electron_win": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts|\\.so\\.4)\" --arch=ia32 --win32metadata.ProductName=\"Lightcord\" --win32metadata.CompanyName=\"Lightcord\" --protocol=discord --platform=\"win32\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack=*.{node,dll} --overwrite",
|
||||
"build:electron_linux": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts|\\.dll)\" --arch=x64 --protocol=discord --platform=\"linux\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack=*.{node,so.4} --overwrite",
|
||||
"build:minify": "node build.js",
|
||||
"build:after": "node afterbuild.js",
|
||||
"devInstall": "npm i -g --arch=ia32 electron@8.4.0 && npm i -g typescript && npm i --save-dev @types/node@12.12.39 && npm i --save-dev --arch=ia32 electron@8.4.0 && node installSubModules.js && echo \"Everything is installed. You should be able to do `npm run test` to compile everything and launch.\"",
|
||||
|
|
181
src/index.ts
181
src/index.ts
|
@ -1,89 +1,94 @@
|
|||
/** Glasstron */
|
||||
import * as glasstron from "glasstron"
|
||||
glasstron.init()
|
||||
|
||||
/** Modules */
|
||||
import * as electron from "electron"
|
||||
import requireNativeDiscordModule from "./requireNative";
|
||||
import appSettings from "./appSettings"
|
||||
import autoStart from "./autoStart"
|
||||
import * as buildInfo from "./buildInfo"
|
||||
import * as Constants from "./Constants"
|
||||
import * as GPUSettings from "./GPUSettings"
|
||||
import * as moduleUpdater from "./common/moduleUpdater"
|
||||
import * as paths from "./common/paths"
|
||||
import { create } from "./singleInstance";
|
||||
import * as splashScreen from "./splashScreen"
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
// Some people are reporting audio problems on Linux that are fixed by setting
|
||||
// an environment variable PULSE_LATENCY_MSEC=30 -- the "real" fix is to see
|
||||
// what conditions require this and set this then (also to set it directly in
|
||||
// our webrtc setup code rather than here) but this should fix the bug for now.
|
||||
if (process.env.PULSE_LATENCY_MSEC === undefined) {
|
||||
process.env.PULSE_LATENCY_MSEC = "30";
|
||||
}
|
||||
}
|
||||
|
||||
paths.init(buildInfo)
|
||||
electron.app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');
|
||||
electron.app.commandLine.appendSwitch("no-force-async-hooks-checks");
|
||||
|
||||
function setupHardwareAcceleration() {
|
||||
const settings = appSettings.getSettings();
|
||||
//@ts-ignore
|
||||
const electronMajor = parseInt(process.versions.electron.split('.')[0]);
|
||||
const allowed = process.env.DISCORD_ENABLE_HARDWARE_ACCELERATION || buildInfo.releaseChannel === 'development' || !(electronMajor === 7 && process.platform === 'darwin');
|
||||
// TODO: this is a copy of gpuSettings.getEnableHardwareAcceleration
|
||||
if (!allowed || !settings.get('enableHardwareAcceleration', true)) {
|
||||
electron.app.disableHardwareAcceleration();
|
||||
}
|
||||
}
|
||||
|
||||
global["releaseChannel"] = "stable"
|
||||
|
||||
setupHardwareAcceleration();
|
||||
function hasArgvFlag(flag) {
|
||||
return (process.argv || []).slice(1).includes(flag);
|
||||
}
|
||||
|
||||
//Transform main thread into async
|
||||
(async function Main(){
|
||||
await electron.app.whenReady()
|
||||
|
||||
console.log(`Initializing Lightcord.`)
|
||||
console.log(`Version: ${buildInfo.version}
|
||||
releaseChannel: ${buildInfo.releaseChannel}
|
||||
commit: ${buildInfo.commit}`)
|
||||
|
||||
if(!electron.app.commandLine.hasSwitch('enable-transparent-visuals'))electron.app.commandLine.appendSwitch('enable-transparent-visuals');
|
||||
electron.app.setAppUserModelId(Constants.APP_ID);
|
||||
|
||||
let coreModule
|
||||
create(() => {
|
||||
const startMinimized = hasArgvFlag('--start-minimized');
|
||||
|
||||
coreModule = requireNativeDiscordModule('discord_desktop_core');
|
||||
coreModule.startup({
|
||||
paths,
|
||||
splashScreen,
|
||||
moduleUpdater,
|
||||
autoStart,
|
||||
buildInfo,
|
||||
appSettings,
|
||||
Constants,
|
||||
GPUSettings
|
||||
});
|
||||
|
||||
coreModule.setMainWindowVisible(!startMinimized)
|
||||
}, (args) => {
|
||||
if (args != null && args.length > 0 && args[0] === '--squirrel-uninstall') {
|
||||
electron.app.quit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (coreModule) {
|
||||
coreModule.handleSingleInstance(args);
|
||||
}
|
||||
})
|
||||
/** Glasstron */
|
||||
import * as glasstron from "glasstron"
|
||||
glasstron.init()
|
||||
|
||||
/** Modules */
|
||||
import * as electron from "electron"
|
||||
import requireNativeDiscordModule from "./requireNative";
|
||||
import appSettings from "./appSettings"
|
||||
import autoStart from "./autoStart"
|
||||
import * as buildInfo from "./buildInfo"
|
||||
import * as Constants from "./Constants"
|
||||
import * as GPUSettings from "./GPUSettings"
|
||||
import * as moduleUpdater from "./common/moduleUpdater"
|
||||
import * as paths from "./common/paths"
|
||||
import { create } from "./singleInstance";
|
||||
import * as splashScreen from "./splashScreen"
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
// Some people are reporting audio problems on Linux that are fixed by setting
|
||||
// an environment variable PULSE_LATENCY_MSEC=30 -- the "real" fix is to see
|
||||
// what conditions require this and set this then (also to set it directly in
|
||||
// our webrtc setup code rather than here) but this should fix the bug for now.
|
||||
if (process.env.PULSE_LATENCY_MSEC === undefined) {
|
||||
process.env.PULSE_LATENCY_MSEC = "30";
|
||||
}
|
||||
}
|
||||
|
||||
paths.init(buildInfo)
|
||||
electron.app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');
|
||||
electron.app.commandLine.appendSwitch("no-force-async-hooks-checks");
|
||||
|
||||
function setupHardwareAcceleration() {
|
||||
const settings = appSettings.getSettings();
|
||||
//@ts-ignore
|
||||
const electronMajor = parseInt(process.versions.electron.split('.')[0]);
|
||||
const allowed = process.env.DISCORD_ENABLE_HARDWARE_ACCELERATION || buildInfo.releaseChannel === 'development' || !(electronMajor === 7 && process.platform === 'darwin');
|
||||
// TODO: this is a copy of gpuSettings.getEnableHardwareAcceleration
|
||||
if (!allowed || !settings.get('enableHardwareAcceleration', true)) {
|
||||
electron.app.disableHardwareAcceleration();
|
||||
}
|
||||
}
|
||||
|
||||
global["releaseChannel"] = "stable"
|
||||
|
||||
setupHardwareAcceleration();
|
||||
function hasArgvFlag(flag) {
|
||||
return (process.argv || []).slice(1).includes(flag);
|
||||
}
|
||||
|
||||
//Transform main thread into async
|
||||
(async function Main(){
|
||||
await electron.app.whenReady()
|
||||
|
||||
console.log(`Initializing Lightcord.`)
|
||||
console.log(`Version: ${buildInfo.version}
|
||||
releaseChannel: ${buildInfo.releaseChannel}
|
||||
commit: ${buildInfo.commit}`)
|
||||
|
||||
if(!electron.app.commandLine.hasSwitch('enable-transparent-visuals'))electron.app.commandLine.appendSwitch('enable-transparent-visuals');
|
||||
electron.app.setAppUserModelId(Constants.APP_ID);
|
||||
|
||||
let coreModule
|
||||
create(() => {
|
||||
const startMinimized = hasArgvFlag('--start-minimized');
|
||||
|
||||
coreModule = requireNativeDiscordModule('discord_desktop_core');
|
||||
coreModule.startup({
|
||||
paths,
|
||||
splashScreen,
|
||||
moduleUpdater,
|
||||
autoStart,
|
||||
buildInfo,
|
||||
appSettings,
|
||||
Constants,
|
||||
GPUSettings
|
||||
});
|
||||
|
||||
coreModule.setMainWindowVisible(!startMinimized)
|
||||
}, (args) => {
|
||||
if (args != null && args.length > 0 && args[0] === '--squirrel-uninstall') {
|
||||
electron.app.quit();
|
||||
return;
|
||||
}
|
||||
|
||||
if(args.length === 1 && args[0] === "--overlay-host"){ // this is a patch for Lightcord that focus itself
|
||||
//console.warn("OVERLAY HOST DÉTECTÉ. EVENNEMENT IGNORÉ MAIS POURRAIT CAUSER UN PROBLÈME.")
|
||||
return
|
||||
}
|
||||
|
||||
if (coreModule) {
|
||||
coreModule.handleSingleInstance(args);
|
||||
}
|
||||
})
|
||||
})()
|
Loading…
Reference in New Issue