mirror of
https://github.com/Lightcord/Lightcord.git
synced 2025-04-12 00:55:40 +02:00
devtools
This commit is contained in:
parent
2d42789c44
commit
f706be5211
16
BetterDiscordApp/dist/index.js
vendored
16
BetterDiscordApp/dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
BetterDiscordApp/dist/index.min.js
vendored
2
BetterDiscordApp/dist/index.min.js
vendored
File diff suppressed because one or more lines are too long
@ -45,7 +45,6 @@ export const settings = {
|
||||
/* Developer */
|
||||
"Developer Mode": {id: "bda-gs-8", info: "Developer Mode Toggle", implemented: true, hidden: false, cat: "core", category: "developer settings"},
|
||||
"Copy Selector": {id: "fork-dm-1", info: "Adds a \"Copy Selector\" option to context menus when developer mode is active", implemented: true, hidden: false, cat: "core", category: "developer settings"},
|
||||
"React DevTools": {id: "reactDevTools", info: "Adds react developer tools to the devtools. Must be installed in Google Chrome on your pc.", implemented: true, hidden: true, cat: "core", category: "developer settings"},
|
||||
|
||||
/** Lightcord */
|
||||
"Disable BetterDiscord": {id: "bd-disable", info: "Disable Betterdiscord (plugins, themes, etc) (Not implemented).", implemented: false, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
@ -101,7 +100,6 @@ export const defaultCookie = {
|
||||
"fork-wp-1": false,
|
||||
"fork-wp-2": false,
|
||||
"fork-beta": true,
|
||||
"reactDevTools": false,
|
||||
"lightcord-1": false,
|
||||
"lightcord-2": true,
|
||||
"lightcord-presence-1": false,
|
||||
|
@ -1,48 +0,0 @@
|
||||
import Utils from "./utils";
|
||||
import {settings} from "../0globals";
|
||||
|
||||
const electron = require("electron");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const BrowserWindow = electron.remote.BrowserWindow;
|
||||
const webContents = electron.remote.getCurrentWebContents();
|
||||
|
||||
|
||||
export default new class reactDevTools {
|
||||
constructor() {
|
||||
let extensionPath = "";
|
||||
if (process.platform === "win32") extensionPath = path.resolve(process.env.LOCALAPPDATA, "Google/Chrome/User Data");
|
||||
else if (process.platform === "linux") extensionPath = path.resolve(process.env.HOME, ".config/google-chrome");
|
||||
else if (process.platform === "darwin") extensionPath = path.resolve(process.env.HOME, "Library/Application Support/Google/Chrome");
|
||||
else extensionPath = path.resolve(process.env.HOME, ".config/chromium");
|
||||
extensionPath += "/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/";
|
||||
if (fs.existsSync(extensionPath)) {
|
||||
const versions = fs.readdirSync(extensionPath);
|
||||
extensionPath = path.resolve(extensionPath, versions[versions.length - 1]);
|
||||
}
|
||||
this.extensionPath = extensionPath;
|
||||
this.isExtensionInstalled = fs.existsSync(extensionPath);
|
||||
this.listener = this.listener.bind(this);
|
||||
|
||||
settings["React DevTools"].hidden = !this.isExtensionInstalled;
|
||||
}
|
||||
|
||||
listener() {
|
||||
if (!this.isExtensionInstalled) return;
|
||||
BrowserWindow.removeDevToolsExtension("React Developer Tools");
|
||||
const didInstall = BrowserWindow.addDevToolsExtension(this.extensionPath);
|
||||
|
||||
if (didInstall) Utils.log("React DevTools", "Successfully installed react devtools.");
|
||||
else Utils.err("React DevTools", "Couldn't find react devtools in chrome extensions!");
|
||||
}
|
||||
|
||||
start() {
|
||||
setImmediate(() => webContents.on("devtools-opened", this.listener));
|
||||
if (webContents.isDevToolsOpened()) this.listener();
|
||||
}
|
||||
|
||||
stop() {
|
||||
webContents.removeListener("devtools-opened", this.listener);
|
||||
}
|
||||
};
|
@ -180,10 +180,6 @@ export default new class V2_SettingsPanel {
|
||||
else dMode.stopCopySelector();
|
||||
}
|
||||
|
||||
if (id === "reactDevTools") {
|
||||
if (enabled) reactDevTools.start();
|
||||
else reactDevTools.stop();
|
||||
}
|
||||
if (id === "lightcord-1") {
|
||||
if (enabled) window.Lightcord.Settings.devMode = true
|
||||
else window.Lightcord.Settings.devMode = false
|
||||
@ -268,7 +264,6 @@ export default new class V2_SettingsPanel {
|
||||
}
|
||||
|
||||
async initializeSettings() {
|
||||
if (settingsCookie.reactDevTools) reactDevTools.start();
|
||||
if (settingsCookie["bda-gs-2"]) DOM.addClass(document.body, "bd-minimal");
|
||||
if (settingsCookie["bda-gs-3"]) DOM.addClass(document.body, "bd-minimal-chan");
|
||||
if (settingsCookie["bda-gs-1"]) publicServersModule.addButton();
|
||||
|
Loading…
x
Reference in New Issue
Block a user