This commit is contained in:
Zack Rauen 2020-02-27 20:18:37 -05:00
parent 6c03d9090c
commit 44ebe6b2f7
3 changed files with 53 additions and 12 deletions

View File

@ -209,15 +209,18 @@ var settings = {
"Dark Mode": {id: "bda-gs-5", info: "Make certain elements dark by default(wip)", implemented: true, hidden: false, cat: "core", category: "modules"},
"Voice Disconnect": {id: "bda-dc-0", info: "Disconnect from voice server when closing Discord", implemented: true, hidden: false, cat: "core", category: "modules"},
"24 Hour Timestamps": {id: "bda-gs-6", info: "Replace 12hr timestamps with proper ones", implemented: true, hidden: false, cat: "core", category: "modules"},
"Colored Text": {id: "bda-gs-7", info: "Make text color the same as role color", implemented: true, hidden: false, cat: "core", category: "modules"},
"Colored Text": {id: "bda-gs-7", info: "Make text color the same as role color", implemented: true, hidden: false, cat: "core", category: "modules"},
"Normalize Classes": {id: "fork-ps-4", info: "Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)", implemented: true, hidden: false, cat: "core", category: "modules"},
/* Content */
"Content Error Modal": {id: "fork-ps-1", info: "Shows a modal with plugin/theme errors", implemented: true, hidden: false, cat: "core", category: "content manager"},
"Content Error Modal": {id: "fork-ps-1", info: "Shows a modal with plugin/theme errors", implemented: true, hidden: false, cat: "core", category: "content manager"},
"Show Toasts": {id: "fork-ps-2", info: "Shows a small notification for important information", implemented: true, hidden: false, cat: "core", category: "content manager"},
"Scroll To Settings": {id: "fork-ps-3", info: "Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)", implemented: true, hidden: false, cat: "core", category: "content manager"},
"Automatic Loading": {id: "fork-ps-5", info: "Automatically loads, reloads, and unloads plugins and themes", implemented: true, hidden: false, cat: "core", category: "content manager"},
/* Donors */
"BBD Beta": {id: "fork-beta", info: "Gives access to BBD beta. (Requires full restart after changing.)", implemented: true, hidden: true, cat: "core", category: "donors"},
/* Developer */
"Developer Mode": {id: "bda-gs-8", info: "Developer Mode", 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"},
@ -271,7 +274,8 @@ var defaultCookie = {
"fork-es-2": false,
"fork-es-3": true,
"fork-wp-1": false,
"fork-wp-2": false
"fork-wp-2": false,
"fork-beta": false
};
@ -4270,6 +4274,19 @@ class V2_SettingsPanel {
// else $("body").removeClass("bd-blue");
// }
if (id == "fork-beta") {
try {
const fs = require("fs");
const path = require("path");
const configPath = path.join(DiscordNative.process.remote.resourcesPath, "app", "betterdiscord", "config.json");
const config = require(configPath);
if (enabled) config.branch = "modularize";
else config.branch = "master";
fs.writeFileSync(configPath, JSON.stringify(config, null, 4));
}
catch (err) {console.error(err);}
}
if (id == "bda-gs-2") {
if (enabled) $("body").addClass("bd-minimal");
else $("body").removeClass("bd-minimal");
@ -4348,6 +4365,15 @@ class V2_SettingsPanel {
}
initializeSettings() {
const checkForBetaAccess = async () => {
const SortedGuildStore = BDV2.WebpackModules.findByUniqueProperties(["getSortedGuilds"]);
const GuildMemberStore = BDV2.WebpackModules.findByUniqueProperties(["getMember"]);
const inServer = SortedGuildStore.getFlattenedGuildIds().includes("292141134614888448");
const userId = BDV2.UserStore.getCurrentUser().id;
const member = GuildMemberStore.getMember("292141134614888448", userId);
const hasRole = inServer && member ? member.roles.includes("452687773678436354") : false;
if (hasRole) settings["BBD Beta"].hidden = false;
};
// if (settingsCookie["bda-gs-b"]) $("body").addClass("bd-blue");
if (settingsCookie["bda-gs-2"]) $("body").addClass("bd-minimal");
@ -4367,6 +4393,8 @@ class V2_SettingsPanel {
if (settingsCookie["bda-gs-8"]) dMode.enable(settingsCookie["fork-dm-1"]);
checkForBetaAccess();
mainCore.saveSettings();
}

4
js/main.min.js vendored

File diff suppressed because one or more lines are too long

27
package-lock.json generated
View File

@ -1544,7 +1544,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -1587,7 +1588,8 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
@ -1598,7 +1600,8 @@
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -1715,7 +1718,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -1727,6 +1731,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -1756,6 +1761,7 @@
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -1774,6 +1780,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -1867,6 +1874,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -1952,7 +1960,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -1988,6 +1997,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -2007,6 +2017,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -2050,12 +2061,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},