mirror of
https://github.com/Lightcord/Lightcord.git
synced 2025-04-12 00:55:40 +02:00
Auto refresh sidebar
This commit is contained in:
parent
42dd6a6a15
commit
21c6a6fbc8
File diff suppressed because one or more lines are too long
@ -1,173 +1,173 @@
|
||||
import { remote } from "electron";
|
||||
import BDV2 from "./modules/v2";
|
||||
import WebpackModules from "./modules/webpackModules";
|
||||
|
||||
export const minimumDiscordVersion = "0.0.306";
|
||||
export const currentDiscordVersion = (window.DiscordNative && window.DiscordNative.remoteApp && window.DiscordNative.remoteApp.getVersion && window.DiscordNative.remoteApp.getVersion()) || "0.0.306";
|
||||
export const minSupportedVersion = "0.3.0";
|
||||
export const bbdVersion = "0.3.4";
|
||||
export const LCChanelog = {
|
||||
description: "Lightcord's changelog",
|
||||
changes: [
|
||||
{
|
||||
title: "What's New?",
|
||||
items: [
|
||||
"Lightcord is now available !",
|
||||
"We removed emotes. That's sad for people who were actually using it, but it was leading to more loading time and some basic words were emote."
|
||||
]
|
||||
}
|
||||
],
|
||||
image: "https://i.imgur.com/sfNhqwP.png",
|
||||
title: "Lightcord",
|
||||
subtitle: "v"+remote.getGlobal("BuildInfo").version,
|
||||
footer: (function(){
|
||||
const TextElement = WebpackModules.findByDisplayName("Text");
|
||||
const ModalStack = WebpackModules.findByProps("push", "update", "pop", "popWithKey");
|
||||
if(!TextElement || !ModalStack)return null
|
||||
|
||||
const Anchor = WebpackModules.find(m => m.displayName == "Anchor");
|
||||
const AnchorClasses = WebpackModules.findByProps("anchorUnderlineOnHover") || {anchor: "anchor-3Z-8Bb", anchorUnderlineOnHover: "anchorUnderlineOnHover-2ESHQB"};
|
||||
const joinSupportServer = (click) => {
|
||||
click.preventDefault();
|
||||
click.stopPropagation();
|
||||
ModalStack.pop();
|
||||
BDV2.joinLC();
|
||||
};
|
||||
const supportLink = Anchor ? BDV2.React.createElement(Anchor, {onClick: joinSupportServer}, "Join our Discord Server.") : BDV2.React.createElement("a", {className: `${AnchorClasses.anchor} ${AnchorClasses.anchorUnderlineOnHover}`, onClick: joinSupportServer}, "Join our Discord Server.");
|
||||
return BDV2.React.createElement(TextElement, {size: TextElement.Sizes.SMALL, color: TextElement.Colors.STANDARD}, "Need support? ", supportLink);
|
||||
})()
|
||||
}
|
||||
export const bbdChangelog = {
|
||||
description: "BBD's changelog.",
|
||||
changes: [
|
||||
{
|
||||
title: "What's New?",
|
||||
items: [
|
||||
"**Lightcord** is now using BandagedBD. That means all plugins you were using can be used too !",
|
||||
"**Window Transparency** changes were made to more compatible with external window managers and addons like Glasscord.",
|
||||
"Initialization sequence has once again been changed slightly to hopefully improve loading times."
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Bug Fixes",
|
||||
type: "fixed",
|
||||
items: [
|
||||
"Some fixes related to showing modals in the `BdApi`."
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const settings = {
|
||||
"Custom css live update": {id: "bda-css-0", info: "", implemented: true, hidden: true, cat: "core"},
|
||||
"Custom css auto udpate": {id: "bda-css-1", info: "", implemented: true, hidden: true, cat: "core"},
|
||||
"BetterDiscord Blue": {id: "bda-gs-b", info: "Replace Discord blue with BD Blue", implemented: false, hidden: false, cat: "core"},
|
||||
|
||||
/* Core */
|
||||
/* ====== */
|
||||
"Public Servers": {id: "bda-gs-1", info: "Display public servers button", implemented: true, hidden: false, cat: "core", category: "modules"},
|
||||
"Minimal Mode": {id: "bda-gs-2", info: "Hide elements and reduce the size of elements.", implemented: true, hidden: false, cat: "core", category: "modules"},
|
||||
"Voice Mode": {id: "bda-gs-4", info: "Only show voice chat", implemented: true, hidden: false, cat: "core", category: "modules"},
|
||||
"Hide Channels": {id: "bda-gs-3", info: "Hide channels in minimal mode", implemented: true, hidden: false, cat: "core", category: "modules"},
|
||||
"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"},
|
||||
"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"},
|
||||
"Scan Plugins": {id: "fork-ps-6", info: "Scan plugins for any threat that can be hidden inside.", 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"},
|
||||
|
||||
/* 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"},
|
||||
"Blur Personnal Informations":{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. (must reopen settings)", 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 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"},
|
||||
|
||||
/** RichPresence */
|
||||
"Enable": {id: "lightcord-presence-1", info: "Enable RichPresence below.", implemented: true, hidden: false, cat: "status"}
|
||||
};
|
||||
|
||||
export const defaultCookie = {
|
||||
"bda-gs-1": true,
|
||||
"bda-gs-2": false,
|
||||
"bda-gs-3": false,
|
||||
"bda-gs-4": false,
|
||||
"bda-gs-5": true,
|
||||
"bda-gs-6": false,
|
||||
"bda-gs-7": false,
|
||||
"bda-gs-8": true,
|
||||
"bda-es-0": true,
|
||||
"bda-es-1": true,
|
||||
"bda-es-2": true,
|
||||
"bda-es-4": false,
|
||||
"bda-es-6": true,
|
||||
"bda-es-7": true,
|
||||
"bda-gs-b": false,
|
||||
"bda-es-8": true,
|
||||
"bda-dc-0": false,
|
||||
"bda-css-0": false,
|
||||
"bda-css-1": false,
|
||||
"bda-es-9": true,
|
||||
"fork-dm-1": false,
|
||||
"fork-ps-1": true,
|
||||
"fork-ps-2": true,
|
||||
"fork-ps-3": true,
|
||||
"fork-ps-4": true,
|
||||
"fork-ps-5": true,
|
||||
"fork-ps-6": true,
|
||||
"fork-es-2": false,
|
||||
"fork-es-3": true,
|
||||
"fork-wp-1": false,
|
||||
"fork-wp-2": false,
|
||||
"fork-beta": true,
|
||||
"reactDevTools": false,
|
||||
"lightcord-1": false,
|
||||
"lightcord-2": true,
|
||||
"lightcord-presence-1": false,
|
||||
"lightcord-3": false,
|
||||
"lightcord-4": false,
|
||||
"lightcord-5": true,
|
||||
"lightcord-6": true,
|
||||
"lightcord-7": false,
|
||||
};
|
||||
|
||||
|
||||
export const settingsCookie = {};
|
||||
|
||||
export const settingsRPC = {};
|
||||
export const defaultRPC = {
|
||||
"name": "Lightcord",
|
||||
"application_id": "711416957718757418",
|
||||
"state": "Lightcord Client",
|
||||
"details": "Browsing Discord",
|
||||
"timestamps.start": Date.now(),
|
||||
"assets.small": null,
|
||||
"assets.large": "712323821037682791"
|
||||
}
|
||||
|
||||
export const bdpluginErrors = [];
|
||||
export const bdthemeErrors = []; // define for backwards compatibility
|
||||
|
||||
export const bdConfig = Object.create(BetterDiscordConfig);
|
||||
|
||||
export const bdthemes = {};
|
||||
export const bdplugins = {};
|
||||
|
||||
export const pluginCookie = {};
|
||||
import { remote } from "electron";
|
||||
import BDV2 from "./modules/v2";
|
||||
import WebpackModules from "./modules/webpackModules";
|
||||
|
||||
export const minimumDiscordVersion = "0.0.306";
|
||||
export const currentDiscordVersion = (window.DiscordNative && window.DiscordNative.remoteApp && window.DiscordNative.remoteApp.getVersion && window.DiscordNative.remoteApp.getVersion()) || "0.0.306";
|
||||
export const minSupportedVersion = "0.3.0";
|
||||
export const bbdVersion = "0.3.4";
|
||||
export const LCChanelog = {
|
||||
description: "Lightcord's changelog",
|
||||
changes: [
|
||||
{
|
||||
title: "What's New?",
|
||||
items: [
|
||||
"Lightcord is now available !",
|
||||
"We removed emotes. That's sad for people who were actually using it, but it was leading to more loading time and some basic words were emote."
|
||||
]
|
||||
}
|
||||
],
|
||||
image: "https://i.imgur.com/sfNhqwP.png",
|
||||
title: "Lightcord",
|
||||
subtitle: "v"+remote.getGlobal("BuildInfo").version,
|
||||
footer: (function(){
|
||||
const TextElement = WebpackModules.findByDisplayName("Text");
|
||||
const ModalStack = WebpackModules.findByProps("push", "update", "pop", "popWithKey");
|
||||
if(!TextElement || !ModalStack)return null
|
||||
|
||||
const Anchor = WebpackModules.find(m => m.displayName == "Anchor");
|
||||
const AnchorClasses = WebpackModules.findByProps("anchorUnderlineOnHover") || {anchor: "anchor-3Z-8Bb", anchorUnderlineOnHover: "anchorUnderlineOnHover-2ESHQB"};
|
||||
const joinSupportServer = (click) => {
|
||||
click.preventDefault();
|
||||
click.stopPropagation();
|
||||
ModalStack.pop();
|
||||
BDV2.joinLC();
|
||||
};
|
||||
const supportLink = Anchor ? BDV2.React.createElement(Anchor, {onClick: joinSupportServer}, "Join our Discord Server.") : BDV2.React.createElement("a", {className: `${AnchorClasses.anchor} ${AnchorClasses.anchorUnderlineOnHover}`, onClick: joinSupportServer}, "Join our Discord Server.");
|
||||
return BDV2.React.createElement(TextElement, {size: TextElement.Sizes.SMALL, color: TextElement.Colors.STANDARD}, "Need support? ", supportLink);
|
||||
})()
|
||||
}
|
||||
export const bbdChangelog = {
|
||||
description: "BBD's changelog.",
|
||||
changes: [
|
||||
{
|
||||
title: "What's New?",
|
||||
items: [
|
||||
"**Lightcord** is now using BandagedBD. That means all plugins you were using can be used too !",
|
||||
"**Window Transparency** changes were made to more compatible with external window managers and addons like Glasscord.",
|
||||
"Initialization sequence has once again been changed slightly to hopefully improve loading times."
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Bug Fixes",
|
||||
type: "fixed",
|
||||
items: [
|
||||
"Some fixes related to showing modals in the `BdApi`."
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const settings = {
|
||||
"Custom css live update": {id: "bda-css-0", info: "", implemented: true, hidden: true, cat: "core"},
|
||||
"Custom css auto udpate": {id: "bda-css-1", info: "", implemented: true, hidden: true, cat: "core"},
|
||||
"BetterDiscord Blue": {id: "bda-gs-b", info: "Replace Discord blue with BD Blue", implemented: false, hidden: false, cat: "core"},
|
||||
|
||||
/* Core */
|
||||
/* ====== */
|
||||
"Public Servers": {id: "bda-gs-1", info: "Display public servers button", implemented: true, hidden: false, cat: "core", category: "modules"},
|
||||
"Minimal Mode": {id: "bda-gs-2", info: "Hide elements and reduce the size of elements.", implemented: true, hidden: false, cat: "core", category: "modules"},
|
||||
"Voice Mode": {id: "bda-gs-4", info: "Only show voice chat", implemented: true, hidden: false, cat: "core", category: "modules"},
|
||||
"Hide Channels": {id: "bda-gs-3", info: "Hide channels in minimal mode", implemented: true, hidden: false, cat: "core", category: "modules"},
|
||||
"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"},
|
||||
"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"},
|
||||
"Scan Plugins": {id: "fork-ps-6", info: "Scan plugins for any threat that can be hidden inside.", 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"},
|
||||
|
||||
/* 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"},
|
||||
"Blur Personnal Informations":{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 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"},
|
||||
|
||||
/** RichPresence */
|
||||
"Enable": {id: "lightcord-presence-1", info: "Enable RichPresence below.", implemented: true, hidden: false, cat: "status"}
|
||||
};
|
||||
|
||||
export const defaultCookie = {
|
||||
"bda-gs-1": true,
|
||||
"bda-gs-2": false,
|
||||
"bda-gs-3": false,
|
||||
"bda-gs-4": false,
|
||||
"bda-gs-5": true,
|
||||
"bda-gs-6": false,
|
||||
"bda-gs-7": false,
|
||||
"bda-gs-8": true,
|
||||
"bda-es-0": true,
|
||||
"bda-es-1": true,
|
||||
"bda-es-2": true,
|
||||
"bda-es-4": false,
|
||||
"bda-es-6": true,
|
||||
"bda-es-7": true,
|
||||
"bda-gs-b": false,
|
||||
"bda-es-8": true,
|
||||
"bda-dc-0": false,
|
||||
"bda-css-0": false,
|
||||
"bda-css-1": false,
|
||||
"bda-es-9": true,
|
||||
"fork-dm-1": false,
|
||||
"fork-ps-1": true,
|
||||
"fork-ps-2": true,
|
||||
"fork-ps-3": true,
|
||||
"fork-ps-4": true,
|
||||
"fork-ps-5": true,
|
||||
"fork-ps-6": true,
|
||||
"fork-es-2": false,
|
||||
"fork-es-3": true,
|
||||
"fork-wp-1": false,
|
||||
"fork-wp-2": false,
|
||||
"fork-beta": true,
|
||||
"reactDevTools": false,
|
||||
"lightcord-1": false,
|
||||
"lightcord-2": true,
|
||||
"lightcord-presence-1": false,
|
||||
"lightcord-3": false,
|
||||
"lightcord-4": false,
|
||||
"lightcord-5": true,
|
||||
"lightcord-6": true,
|
||||
"lightcord-7": false,
|
||||
};
|
||||
|
||||
|
||||
export const settingsCookie = {};
|
||||
|
||||
export const settingsRPC = {};
|
||||
export const defaultRPC = {
|
||||
"name": "Lightcord",
|
||||
"application_id": "711416957718757418",
|
||||
"state": "Lightcord Client",
|
||||
"details": "Browsing Discord",
|
||||
"timestamps.start": Date.now(),
|
||||
"assets.small": null,
|
||||
"assets.large": "712323821037682791"
|
||||
}
|
||||
|
||||
export const bdpluginErrors = [];
|
||||
export const bdthemeErrors = []; // define for backwards compatibility
|
||||
|
||||
export const bdConfig = Object.create(BetterDiscordConfig);
|
||||
|
||||
export const bdthemes = {};
|
||||
export const bdplugins = {};
|
||||
|
||||
export const pluginCookie = {};
|
||||
export const themeCookie = {};
|
File diff suppressed because it is too large
Load Diff
@ -1,407 +1,412 @@
|
||||
import {settings, settingsCookie, settingsRPC} from "../0globals";
|
||||
import DataStore from "./dataStore";
|
||||
import V2_SettingsPanel_Sidebar from "./settingsPanelSidebar";
|
||||
import Utils from "./utils";
|
||||
import BDV2 from "./v2";
|
||||
import ContentManager from "./contentManager";
|
||||
import coloredText from "./coloredText";
|
||||
import tfHour from "./24hour";
|
||||
import DOM from "./domtools";
|
||||
|
||||
import publicServersModule from "./publicServers";
|
||||
import voiceMode from "./voiceMode";
|
||||
import ClassNormalizer from "./classNormalizer";
|
||||
import dMode from "./devMode";
|
||||
|
||||
import SectionedSettingsPanel from "../ui/sectionedSettingsPanel";
|
||||
import CssEditor from "../ui/cssEditor";
|
||||
import CardList from "../ui/addonlist";
|
||||
import V2C_PresenceSettings from "../ui/presenceSettings";
|
||||
import CustomRichPresence from "./CustomRichPresence";
|
||||
import V2C_AccountInfos from "../ui/AccountInfos";
|
||||
import { remote } from "electron";
|
||||
import AntiAdDM from "./AntiAdDM";
|
||||
import blurPrivate from "./blurPrivate";
|
||||
import disableTyping from "./disableTyping";
|
||||
import ApiPreview from "../ui/ApiPreview";
|
||||
import Switch from "../ui/switch";
|
||||
import MarginTop from "../ui/margintop";
|
||||
import webpackModules from "./webpackModules";
|
||||
import tooltipWrap from "../ui/tooltipWrap";
|
||||
import History from "../ui/icons/history";
|
||||
|
||||
class BDSidebarHeader extends React.PureComponent {
|
||||
render(){
|
||||
let sidebarComponents = webpackModules.find(e => e.Separator && e.Header && e.Item)
|
||||
|
||||
const changelogButton = React.createElement(tooltipWrap, {color: "black", side: "top", text: "Changelog"},
|
||||
React.createElement("span", {style: {float: "right", cursor: "pointer"}, className: "bd-changelog-button", onClick: () => {Utils.showChangelogModal(bbdChangelog);}},
|
||||
React.createElement(History, {className: "bd-icon", size: "16px"})
|
||||
)
|
||||
);
|
||||
let rendered = new sidebarComponents.Header({
|
||||
children: React.createElement("span", null, "Bandaged BD", changelogButton),
|
||||
className: "ui-tab-bar-header"
|
||||
})
|
||||
return rendered
|
||||
}
|
||||
}
|
||||
|
||||
export default new class V2_SettingsPanel {
|
||||
|
||||
constructor() {
|
||||
this.onChange = this.onChange.bind(this);
|
||||
this.updateSettings = this.updateSettings.bind(this);
|
||||
this.sidebar = new V2_SettingsPanel_Sidebar();
|
||||
|
||||
this.registerComponents()
|
||||
}
|
||||
|
||||
registerComponents(){
|
||||
/** Lightcord */
|
||||
this.sidebar.register("lightcord", makeComponent(this.lightcordComponent.bind(this)))
|
||||
this.sidebar.register("status", makeComponent(this.PresenceComponent.bind(this)))
|
||||
this.sidebar.register("accountinfo", makeComponent(this.AccountInfosComponent.bind(this)))
|
||||
this.sidebar.register("lcapipreview", makeComponent(this.ApiPreviewComponent.bind(this)))
|
||||
|
||||
/* Bandaged BD */
|
||||
this.sidebar.register("BDChangelogTitle", makeComponent(() => {
|
||||
return new BDSidebarHeader().render()
|
||||
}))
|
||||
this.sidebar.register("core", makeComponent(this.coreComponent.bind(this)))
|
||||
this.sidebar.register("customcss", makeComponent(this.customCssComponent.bind(this)))
|
||||
this.sidebar.register("plugins", makeComponent(this.renderAddonPane("plugins")))
|
||||
this.sidebar.register("themes", makeComponent(this.renderAddonPane("themes")))
|
||||
}
|
||||
|
||||
get root() {
|
||||
const _root = DOM.query("#bd-settingspane-container");
|
||||
if (!_root) {
|
||||
if (!this.injectRoot()) return null;
|
||||
return this.root;
|
||||
}
|
||||
return _root;
|
||||
}
|
||||
|
||||
injectRoot() {
|
||||
let [
|
||||
classNameLayer,
|
||||
classSidebar
|
||||
] = [
|
||||
BDModules.get(e => e.layer && e.animating)[0].layer.split(" ")[0],
|
||||
BDModules.get(e => e.standardSidebarView)[0]
|
||||
]
|
||||
const sidebar = DOM.query("."+classNameLayer+" ."+classSidebar.standardSidebarView.split(" ")[0]+", ."+classNameLayer+" .ui-standard-sidebar-view");
|
||||
if (!sidebar) return false;
|
||||
const root = DOM.createElement(`<div id="bd-settingspane-container" class="${classSidebar.contentRegion} content-region">`);
|
||||
sidebar.append(root);
|
||||
|
||||
Utils.onRemoved(root, () => {
|
||||
BDV2.reactDom.unmountComponentAtNode(root);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
get coreSettings() {
|
||||
const settings = this.getSettings("core");
|
||||
const categories = [...new Set(settings.map(s => s.category))];
|
||||
const sections = categories.map(c => {return {title: c, settings: settings.filter(s => s.category == c)};});
|
||||
return sections;
|
||||
}
|
||||
|
||||
get lightcordSettings() {
|
||||
const settings = this.getSettings("lightcord");
|
||||
const categories = [...new Set(settings.map(s => s.category))];
|
||||
const sections = categories.map(c => {return {title: c, settings: settings.filter(s => s.category == c)};});
|
||||
return sections;
|
||||
}
|
||||
|
||||
get PresenceSettings() {
|
||||
return this.getSettings("status")
|
||||
}
|
||||
|
||||
get MsgLogSettings() {
|
||||
return this.getSettings("msglog")
|
||||
}
|
||||
|
||||
getSettings(category) {
|
||||
return Object.keys(settings).reduce((arr, key) => {
|
||||
const setting = settings[key];
|
||||
if (setting.cat === category && setting.implemented && !setting.hidden) {
|
||||
setting.text = key;
|
||||
arr.push(setting);
|
||||
}
|
||||
return arr;
|
||||
}, []);
|
||||
}
|
||||
|
||||
onClick() {}
|
||||
|
||||
onChange(id, checked) {
|
||||
this.updateSettings(id, checked);
|
||||
}
|
||||
|
||||
updateSettings(id, enabled) {
|
||||
settingsCookie[id] = enabled;
|
||||
|
||||
if (id == "bda-gs-2") {
|
||||
if (enabled) DOM.addClass(document.body, "bd-minimal");
|
||||
else DOM.removeClass(document.body, "bd-minimal");
|
||||
}
|
||||
|
||||
if (id == "bda-gs-3") {
|
||||
if (enabled) DOM.addClass(document.body, "bd-minimal-chan");
|
||||
else DOM.removeClass(document.body, "bd-minimal-chan");
|
||||
}
|
||||
|
||||
if (id == "bda-gs-1") {
|
||||
if (enabled) publicServersModule.addButton();
|
||||
else publicServersModule.removeButton();
|
||||
}
|
||||
|
||||
if (id == "bda-gs-4") {
|
||||
if (enabled) voiceMode.start();
|
||||
else voiceMode.stop();
|
||||
}
|
||||
|
||||
if (id == "bda-gs-5") {
|
||||
if (enabled) DOM.addClass(DOM.query("#app-mount"), "bda-dark");
|
||||
else DOM.removeClass(DOM.query("#app-mount"), "bda-dark");
|
||||
}
|
||||
|
||||
if (enabled && id == "bda-gs-6") tfHour.inject24Hour();
|
||||
|
||||
if (id == "bda-gs-7") {
|
||||
if (enabled) coloredText.injectColoredText();
|
||||
else coloredText.removeColoredText();
|
||||
}
|
||||
|
||||
if (id == "fork-ps-4") {
|
||||
if (enabled) ClassNormalizer.start();
|
||||
else ClassNormalizer.stop();
|
||||
}
|
||||
|
||||
if (id == "fork-ps-5") {
|
||||
if (enabled) {
|
||||
ContentManager.watchContent("plugin");
|
||||
ContentManager.watchContent("theme");
|
||||
}
|
||||
else {
|
||||
ContentManager.unwatchContent("plugin");
|
||||
ContentManager.unwatchContent("theme");
|
||||
}
|
||||
}
|
||||
|
||||
if (id == "fork-wp-1") {
|
||||
Utils.setWindowPreference("transparent", enabled);
|
||||
if (enabled) Utils.setWindowPreference("backgroundColor", null);
|
||||
else Utils.setWindowPreference("backgroundColor", "#2f3136");
|
||||
}
|
||||
|
||||
|
||||
if (id == "bda-gs-8") {
|
||||
if (enabled) dMode.startDebugListener();
|
||||
else dMode.stopDebugListener();
|
||||
}
|
||||
|
||||
if (id == "fork-dm-1") {
|
||||
if (enabled) dMode.startCopySelector();
|
||||
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
|
||||
}
|
||||
if (id === "lightcord-2") {
|
||||
if (enabled) window.Lightcord.Settings.callRingingBeat = true
|
||||
else window.Lightcord.Settings.callRingingBeat = false
|
||||
}
|
||||
if (id === "lightcord-presence-1") {
|
||||
if (enabled) {
|
||||
CustomRichPresence.enable()
|
||||
const settingsStore = BDModules.get(e => e.default && typeof e.default === "object" && "showCurrentGame" in e.default)[0]
|
||||
if(settingsStore && !settingsStore.default.showCurrentGame){
|
||||
BDModules.get(e => e.default && e.default.updateRemoteSettings)[0].default.updateRemoteSettings({
|
||||
showCurrentGame: true
|
||||
})
|
||||
}
|
||||
}
|
||||
else CustomRichPresence.disable()
|
||||
}
|
||||
if (id === "lightcord-3") {
|
||||
if (enabled) remote.getCurrentWindow().setAlwaysOnTop(true)
|
||||
else remote.getCurrentWindow().setAlwaysOnTop(false)
|
||||
}
|
||||
if (id === "lightcord-4") {
|
||||
if(enabled){
|
||||
AntiAdDM.enable()
|
||||
}else{
|
||||
AntiAdDM.disable()
|
||||
}
|
||||
}
|
||||
if (id === "lightcord-6") {
|
||||
if(enabled){
|
||||
blurPrivate.enable()
|
||||
}else{
|
||||
blurPrivate.disable()
|
||||
}
|
||||
}
|
||||
if (id === "lightcord-7") {
|
||||
if(enabled){
|
||||
disableTyping.enable()
|
||||
}else{
|
||||
disableTyping.disable()
|
||||
}
|
||||
}
|
||||
|
||||
this.saveSettings();
|
||||
}
|
||||
|
||||
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();
|
||||
if (settingsCookie["bda-gs-4"]) voiceMode.start();
|
||||
if (settingsCookie["bda-gs-5"]) DOM.addClass(DOM.query("#app-mount"), "bda-dark");
|
||||
if (settingsCookie["bda-gs-6"]) tfHour.inject24Hour();
|
||||
if (settingsCookie["bda-gs-7"]) coloredText.injectColoredText();
|
||||
if (settingsCookie["fork-ps-4"]) ClassNormalizer.start();
|
||||
if (settingsCookie["lightcord-1"]) window.Lightcord.Settings.devMode = true
|
||||
if (settingsCookie["lightcord-2"]) window.Lightcord.Settings.callRingingBeat = true
|
||||
if (settingsCookie["lightcord-presence-1"]) CustomRichPresence.enable()
|
||||
if (settingsCookie["lightcord-3"]) remote.getCurrentWindow().setAlwaysOnTop(true)
|
||||
if (settingsCookie["lightcord-4"]) AntiAdDM.enable()
|
||||
if (settingsCookie["lightcord-6"]) blurPrivate.enable()
|
||||
if (settingsCookie["lightcord-7"]) disableTyping.enable()
|
||||
|
||||
if (settingsCookie["fork-ps-5"]) {
|
||||
ContentManager.watchContent("plugin");
|
||||
ContentManager.watchContent("theme");
|
||||
}
|
||||
|
||||
if (settingsCookie["bda-gs-8"]) dMode.startDebugListener();
|
||||
if (settingsCookie["fork-dm-1"]) dMode.startCopySelector();
|
||||
|
||||
this.saveSettings();
|
||||
}
|
||||
|
||||
saveSettings() {
|
||||
DataStore.setSettingGroup("settings", settingsCookie);
|
||||
DataStore.setSettingGroup("rpc", settingsRPC);
|
||||
}
|
||||
|
||||
loadSettings() {
|
||||
Object.assign(settingsCookie, DataStore.getSettingGroup("settings"));
|
||||
Object.assign(settingsRPC, DataStore.getSettingGroup("rpc"));
|
||||
}
|
||||
|
||||
renderSidebar() {
|
||||
return this.sidebar.render();
|
||||
}
|
||||
|
||||
coreComponent() {
|
||||
return BDV2.react.createElement(SectionedSettingsPanel, {key: "cspanel", onChange: this.onChange, sections: this.coreSettings})
|
||||
}
|
||||
|
||||
lightcordComponent() {
|
||||
return [
|
||||
this.lightcordSettings.map((section, i) => {
|
||||
return [
|
||||
(i === 0 ? null : BDV2.react.createElement(MarginTop)),
|
||||
BDV2.react.createElement("h2", {className: "ui-form-title h2 margin-reset margin-bottom-20"}, section.title),
|
||||
section.settings.map(setting => {
|
||||
return BDV2.react.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: settingsCookie[setting.id], onChange: (id, checked) => {
|
||||
this.onChange(id, checked);
|
||||
}})
|
||||
})
|
||||
]
|
||||
}),
|
||||
BDV2.react.createElement(window.Lightcord.Api.Components.inputs.Button, {
|
||||
color: "yellow",
|
||||
look: "ghost",
|
||||
size: "medium",
|
||||
hoverColor: "red",
|
||||
onClick(){
|
||||
console.log("Should relaunch")
|
||||
remote.app.relaunch({
|
||||
args: remote.process.argv.slice(1).concat(["--disable-betterdiscord"])
|
||||
})
|
||||
remote.app.quit()
|
||||
},
|
||||
wrapper: true
|
||||
}, "Relaunch without BetterDiscord")
|
||||
]
|
||||
}
|
||||
|
||||
PresenceComponent() {
|
||||
return BDV2.react.createElement(V2C_PresenceSettings, {
|
||||
key: "lppannel",
|
||||
onChange: this.onChange,
|
||||
settings: this.PresenceSettings
|
||||
})
|
||||
}
|
||||
|
||||
AccountInfosComponent() {
|
||||
return BDV2.react.createElement(V2C_AccountInfos, {
|
||||
key: "lapannel"
|
||||
})
|
||||
}
|
||||
|
||||
ApiPreviewComponent() {
|
||||
return BDV2.react.createElement(ApiPreview, {
|
||||
key: "lapipannel"
|
||||
})
|
||||
}
|
||||
|
||||
customCssComponent() {
|
||||
return BDV2.react.createElement(CssEditor, {key: "csseditor"})
|
||||
}
|
||||
|
||||
renderAddonPane(type) {
|
||||
// I know this shouldn't be here, but when it isn't,
|
||||
// React refuses to change the button when going
|
||||
// between plugins and themes page... something
|
||||
// to debug later.
|
||||
class ContentList extends BDV2.react.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.prefix = this.props.type.replace("s", "");
|
||||
}
|
||||
|
||||
onChange() {
|
||||
this.props.onChange(this.props.type);
|
||||
}
|
||||
|
||||
render() {return this.props.children;}
|
||||
}
|
||||
const originalRender = ContentList.prototype.render;
|
||||
Object.defineProperty(ContentList.prototype, "render", {
|
||||
enumerable: false,
|
||||
configurable: false,
|
||||
set: function() {console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins");},
|
||||
get: () => originalRender
|
||||
});
|
||||
return function(){
|
||||
return BDV2.react.createElement(ContentList, {type}, BDV2.react.createElement(CardList, {type}))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* No need to export settingsPanel on window
|
||||
*/
|
||||
|
||||
function makeComponent(children){
|
||||
class SettingComponent extends React.Component {
|
||||
render(){
|
||||
return children()
|
||||
}
|
||||
}
|
||||
return SettingComponent
|
||||
import {settings, settingsCookie, settingsRPC} from "../0globals";
|
||||
import DataStore from "./dataStore";
|
||||
import V2_SettingsPanel_Sidebar from "./settingsPanelSidebar";
|
||||
import Utils from "./utils";
|
||||
import BDV2 from "./v2";
|
||||
import ContentManager from "./contentManager";
|
||||
import coloredText from "./coloredText";
|
||||
import tfHour from "./24hour";
|
||||
import DOM from "./domtools";
|
||||
|
||||
import publicServersModule from "./publicServers";
|
||||
import voiceMode from "./voiceMode";
|
||||
import ClassNormalizer from "./classNormalizer";
|
||||
import dMode from "./devMode";
|
||||
|
||||
import SectionedSettingsPanel from "../ui/sectionedSettingsPanel";
|
||||
import CssEditor from "../ui/cssEditor";
|
||||
import CardList from "../ui/addonlist";
|
||||
import V2C_PresenceSettings from "../ui/presenceSettings";
|
||||
import CustomRichPresence from "./CustomRichPresence";
|
||||
import V2C_AccountInfos from "../ui/AccountInfos";
|
||||
import { remote } from "electron";
|
||||
import AntiAdDM from "./AntiAdDM";
|
||||
import blurPrivate from "./blurPrivate";
|
||||
import disableTyping from "./disableTyping";
|
||||
import ApiPreview from "../ui/ApiPreview";
|
||||
import Switch from "../ui/switch";
|
||||
import MarginTop from "../ui/margintop";
|
||||
import webpackModules from "./webpackModules";
|
||||
import tooltipWrap from "../ui/tooltipWrap";
|
||||
import History from "../ui/icons/history";
|
||||
|
||||
class BDSidebarHeader extends React.PureComponent {
|
||||
render(){
|
||||
let sidebarComponents = webpackModules.find(e => e.Separator && e.Header && e.Item)
|
||||
|
||||
const changelogButton = React.createElement(tooltipWrap, {color: "black", side: "top", text: "Changelog"},
|
||||
React.createElement("span", {style: {float: "right", cursor: "pointer"}, className: "bd-changelog-button", onClick: () => {Utils.showChangelogModal(bbdChangelog);}},
|
||||
React.createElement(History, {className: "bd-icon", size: "16px"})
|
||||
)
|
||||
);
|
||||
let rendered = new sidebarComponents.Header({
|
||||
children: React.createElement("span", null, "Bandaged BD", changelogButton),
|
||||
className: "ui-tab-bar-header"
|
||||
})
|
||||
return rendered
|
||||
}
|
||||
}
|
||||
|
||||
export default new class V2_SettingsPanel {
|
||||
|
||||
constructor() {
|
||||
this.onChange = this.onChange.bind(this);
|
||||
this.updateSettings = this.updateSettings.bind(this);
|
||||
this.sidebar = new V2_SettingsPanel_Sidebar();
|
||||
|
||||
this.registerComponents()
|
||||
}
|
||||
|
||||
registerComponents(){
|
||||
/** Lightcord */
|
||||
this.sidebar.register("lightcord", makeComponent(this.lightcordComponent.bind(this)))
|
||||
this.sidebar.register("status", makeComponent(this.PresenceComponent.bind(this)))
|
||||
this.sidebar.register("accountinfo", makeComponent(this.AccountInfosComponent.bind(this)))
|
||||
this.sidebar.register("lcapipreview", makeComponent(this.ApiPreviewComponent.bind(this)))
|
||||
|
||||
/* Bandaged BD */
|
||||
this.sidebar.register("BDChangelogTitle", makeComponent(() => {
|
||||
return new BDSidebarHeader().render()
|
||||
}))
|
||||
this.sidebar.register("core", makeComponent(this.coreComponent.bind(this)))
|
||||
this.sidebar.register("customcss", makeComponent(this.customCssComponent.bind(this)))
|
||||
this.sidebar.register("plugins", makeComponent(this.renderAddonPane("plugins")))
|
||||
this.sidebar.register("themes", makeComponent(this.renderAddonPane("themes")))
|
||||
}
|
||||
|
||||
get root() {
|
||||
const _root = DOM.query("#bd-settingspane-container");
|
||||
if (!_root) {
|
||||
if (!this.injectRoot()) return null;
|
||||
return this.root;
|
||||
}
|
||||
return _root;
|
||||
}
|
||||
|
||||
injectRoot() {
|
||||
let [
|
||||
classNameLayer,
|
||||
classSidebar
|
||||
] = [
|
||||
BDModules.get(e => e.layer && e.animating)[0].layer.split(" ")[0],
|
||||
BDModules.get(e => e.standardSidebarView)[0]
|
||||
]
|
||||
const sidebar = DOM.query("."+classNameLayer+" ."+classSidebar.standardSidebarView.split(" ")[0]+", ."+classNameLayer+" .ui-standard-sidebar-view");
|
||||
if (!sidebar) return false;
|
||||
const root = DOM.createElement(`<div id="bd-settingspane-container" class="${classSidebar.contentRegion} content-region">`);
|
||||
sidebar.append(root);
|
||||
|
||||
Utils.onRemoved(root, () => {
|
||||
BDV2.reactDom.unmountComponentAtNode(root);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
get coreSettings() {
|
||||
const settings = this.getSettings("core");
|
||||
const categories = [...new Set(settings.map(s => s.category))];
|
||||
const sections = categories.map(c => {return {title: c, settings: settings.filter(s => s.category == c)};});
|
||||
return sections;
|
||||
}
|
||||
|
||||
get lightcordSettings() {
|
||||
const settings = this.getSettings("lightcord");
|
||||
const categories = [...new Set(settings.map(s => s.category))];
|
||||
const sections = categories.map(c => {return {title: c, settings: settings.filter(s => s.category == c)};});
|
||||
return sections;
|
||||
}
|
||||
|
||||
get PresenceSettings() {
|
||||
return this.getSettings("status")
|
||||
}
|
||||
|
||||
get MsgLogSettings() {
|
||||
return this.getSettings("msglog")
|
||||
}
|
||||
|
||||
getSettings(category) {
|
||||
return Object.keys(settings).reduce((arr, key) => {
|
||||
const setting = settings[key];
|
||||
if (setting.cat === category && setting.implemented && !setting.hidden) {
|
||||
setting.text = key;
|
||||
arr.push(setting);
|
||||
}
|
||||
return arr;
|
||||
}, []);
|
||||
}
|
||||
|
||||
onClick() {}
|
||||
|
||||
onChange(id, checked, sidebar) {
|
||||
this.updateSettings(id, checked, sidebar);
|
||||
}
|
||||
|
||||
updateSettings(id, enabled, sidebar) {
|
||||
settingsCookie[id] = enabled;
|
||||
|
||||
if (id == "bda-gs-2") {
|
||||
if (enabled) DOM.addClass(document.body, "bd-minimal");
|
||||
else DOM.removeClass(document.body, "bd-minimal");
|
||||
}
|
||||
|
||||
if (id == "bda-gs-3") {
|
||||
if (enabled) DOM.addClass(document.body, "bd-minimal-chan");
|
||||
else DOM.removeClass(document.body, "bd-minimal-chan");
|
||||
}
|
||||
|
||||
if (id == "bda-gs-1") {
|
||||
if (enabled) publicServersModule.addButton();
|
||||
else publicServersModule.removeButton();
|
||||
}
|
||||
|
||||
if (id == "bda-gs-4") {
|
||||
if (enabled) voiceMode.start();
|
||||
else voiceMode.stop();
|
||||
}
|
||||
|
||||
if (id == "bda-gs-5") {
|
||||
if (enabled) DOM.addClass(DOM.query("#app-mount"), "bda-dark");
|
||||
else DOM.removeClass(DOM.query("#app-mount"), "bda-dark");
|
||||
}
|
||||
|
||||
if (enabled && id == "bda-gs-6") tfHour.inject24Hour();
|
||||
|
||||
if (id == "bda-gs-7") {
|
||||
if (enabled) coloredText.injectColoredText();
|
||||
else coloredText.removeColoredText();
|
||||
}
|
||||
|
||||
if (id == "fork-ps-4") {
|
||||
if (enabled) ClassNormalizer.start();
|
||||
else ClassNormalizer.stop();
|
||||
}
|
||||
|
||||
if (id == "fork-ps-5") {
|
||||
if (enabled) {
|
||||
ContentManager.watchContent("plugin");
|
||||
ContentManager.watchContent("theme");
|
||||
}
|
||||
else {
|
||||
ContentManager.unwatchContent("plugin");
|
||||
ContentManager.unwatchContent("theme");
|
||||
}
|
||||
}
|
||||
|
||||
if (id == "fork-wp-1") {
|
||||
Utils.setWindowPreference("transparent", enabled);
|
||||
if (enabled) Utils.setWindowPreference("backgroundColor", null);
|
||||
else Utils.setWindowPreference("backgroundColor", "#2f3136");
|
||||
}
|
||||
|
||||
|
||||
if (id == "bda-gs-8") {
|
||||
if (enabled) dMode.startDebugListener();
|
||||
else dMode.stopDebugListener();
|
||||
}
|
||||
|
||||
if (id == "fork-dm-1") {
|
||||
if (enabled) dMode.startCopySelector();
|
||||
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
|
||||
sidebar.forceUpdate()
|
||||
}
|
||||
if (id === "lightcord-2") {
|
||||
if (enabled) window.Lightcord.Settings.callRingingBeat = true
|
||||
else window.Lightcord.Settings.callRingingBeat = false
|
||||
}
|
||||
if (id === "lightcord-presence-1") {
|
||||
if (enabled) {
|
||||
CustomRichPresence.enable()
|
||||
const settingsStore = BDModules.get(e => e.default && typeof e.default === "object" && "showCurrentGame" in e.default)[0]
|
||||
if(settingsStore && !settingsStore.default.showCurrentGame){
|
||||
BDModules.get(e => e.default && e.default.updateRemoteSettings)[0].default.updateRemoteSettings({
|
||||
showCurrentGame: true
|
||||
})
|
||||
}
|
||||
}
|
||||
else CustomRichPresence.disable()
|
||||
}
|
||||
if (id === "lightcord-3") {
|
||||
if (enabled) remote.getCurrentWindow().setAlwaysOnTop(true)
|
||||
else remote.getCurrentWindow().setAlwaysOnTop(false)
|
||||
}
|
||||
if (id === "lightcord-4") {
|
||||
if(enabled){
|
||||
AntiAdDM.enable()
|
||||
}else{
|
||||
AntiAdDM.disable()
|
||||
}
|
||||
}
|
||||
if (id === "lightcord-6") {
|
||||
if(enabled){
|
||||
blurPrivate.enable()
|
||||
}else{
|
||||
blurPrivate.disable()
|
||||
}
|
||||
}
|
||||
if (id === "lightcord-7") {
|
||||
if(enabled){
|
||||
disableTyping.enable()
|
||||
}else{
|
||||
disableTyping.disable()
|
||||
}
|
||||
}
|
||||
|
||||
this.saveSettings();
|
||||
}
|
||||
|
||||
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();
|
||||
if (settingsCookie["bda-gs-4"]) voiceMode.start();
|
||||
if (settingsCookie["bda-gs-5"]) DOM.addClass(DOM.query("#app-mount"), "bda-dark");
|
||||
if (settingsCookie["bda-gs-6"]) tfHour.inject24Hour();
|
||||
if (settingsCookie["bda-gs-7"]) coloredText.injectColoredText();
|
||||
if (settingsCookie["fork-ps-4"]) ClassNormalizer.start();
|
||||
if (settingsCookie["lightcord-1"]) window.Lightcord.Settings.devMode = true
|
||||
if (settingsCookie["lightcord-2"]) window.Lightcord.Settings.callRingingBeat = true
|
||||
if (settingsCookie["lightcord-presence-1"]) CustomRichPresence.enable()
|
||||
if (settingsCookie["lightcord-3"]) remote.getCurrentWindow().setAlwaysOnTop(true)
|
||||
if (settingsCookie["lightcord-4"]) AntiAdDM.enable()
|
||||
if (settingsCookie["lightcord-6"]) blurPrivate.enable()
|
||||
if (settingsCookie["lightcord-7"]) disableTyping.enable()
|
||||
|
||||
if (settingsCookie["fork-ps-5"]) {
|
||||
ContentManager.watchContent("plugin");
|
||||
ContentManager.watchContent("theme");
|
||||
}
|
||||
|
||||
if (settingsCookie["bda-gs-8"]) dMode.startDebugListener();
|
||||
if (settingsCookie["fork-dm-1"]) dMode.startCopySelector();
|
||||
|
||||
this.saveSettings();
|
||||
}
|
||||
|
||||
saveSettings() {
|
||||
DataStore.setSettingGroup("settings", settingsCookie);
|
||||
DataStore.setSettingGroup("rpc", settingsRPC);
|
||||
}
|
||||
|
||||
loadSettings() {
|
||||
Object.assign(settingsCookie, DataStore.getSettingGroup("settings"));
|
||||
Object.assign(settingsRPC, DataStore.getSettingGroup("rpc"));
|
||||
}
|
||||
|
||||
renderSidebar(sidebar) {
|
||||
return this.sidebar.render(sidebar);
|
||||
}
|
||||
|
||||
coreComponent() {
|
||||
return BDV2.react.createElement(SectionedSettingsPanel, {key: "cspanel", onChange: this.onChange, sections: this.coreSettings})
|
||||
}
|
||||
|
||||
lightcordComponent(sidebar) {
|
||||
return [
|
||||
this.lightcordSettings.map((section, i) => {
|
||||
return [
|
||||
(i === 0 ? null : BDV2.react.createElement(MarginTop)),
|
||||
BDV2.react.createElement("h2", {className: "ui-form-title h2 margin-reset margin-bottom-20"}, section.title),
|
||||
section.settings.map(setting => {
|
||||
return BDV2.react.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: settingsCookie[setting.id], onChange: (id, checked) => {
|
||||
this.onChange(id, checked, sidebar);
|
||||
}})
|
||||
})
|
||||
]
|
||||
}),
|
||||
BDV2.react.createElement(window.Lightcord.Api.Components.inputs.Button, {
|
||||
color: "yellow",
|
||||
look: "ghost",
|
||||
size: "medium",
|
||||
hoverColor: "red",
|
||||
onClick(){
|
||||
console.log("Should relaunch")
|
||||
remote.app.relaunch({
|
||||
args: remote.process.argv.slice(1).concat(["--disable-betterdiscord"])
|
||||
})
|
||||
remote.app.quit()
|
||||
},
|
||||
wrapper: true
|
||||
}, "Relaunch without BetterDiscord")
|
||||
]
|
||||
}
|
||||
|
||||
PresenceComponent() {
|
||||
return BDV2.react.createElement(V2C_PresenceSettings, {
|
||||
key: "lppannel",
|
||||
onChange: this.onChange,
|
||||
settings: this.PresenceSettings
|
||||
})
|
||||
}
|
||||
|
||||
AccountInfosComponent() {
|
||||
return BDV2.react.createElement(V2C_AccountInfos, {
|
||||
key: "lapannel"
|
||||
})
|
||||
}
|
||||
|
||||
ApiPreviewComponent() {
|
||||
return BDV2.react.createElement(ApiPreview, {
|
||||
key: "lapipannel"
|
||||
})
|
||||
}
|
||||
|
||||
customCssComponent() {
|
||||
return BDV2.react.createElement(CssEditor, {key: "csseditor"})
|
||||
}
|
||||
|
||||
renderAddonPane(type) {
|
||||
// I know this shouldn't be here, but when it isn't,
|
||||
// React refuses to change the button when going
|
||||
// between plugins and themes page... something
|
||||
// to debug later.
|
||||
class ContentList extends BDV2.react.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.prefix = this.props.type.replace("s", "");
|
||||
}
|
||||
|
||||
onChange() {
|
||||
this.props.onChange(this.props.type);
|
||||
}
|
||||
|
||||
render() {return this.props.children;}
|
||||
}
|
||||
const originalRender = ContentList.prototype.render;
|
||||
Object.defineProperty(ContentList.prototype, "render", {
|
||||
enumerable: false,
|
||||
configurable: false,
|
||||
set: function() {console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins");},
|
||||
get: () => originalRender
|
||||
});
|
||||
return function(){
|
||||
return BDV2.react.createElement(ContentList, {type}, BDV2.react.createElement(CardList, {type}))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* No need to export settingsPanel on window
|
||||
*/
|
||||
|
||||
function makeComponent(children){
|
||||
class SettingComponent extends React.Component {
|
||||
render(){
|
||||
return children(sidebar)
|
||||
}
|
||||
}
|
||||
let sidebar
|
||||
return (s) => {
|
||||
sidebar = s
|
||||
return SettingComponent
|
||||
}
|
||||
}
|
@ -1,87 +1,87 @@
|
||||
export default class V2_SettingsPanel_Sidebar {
|
||||
|
||||
constructor() {
|
||||
this.panels = {}
|
||||
}
|
||||
|
||||
register(panel, component){
|
||||
this.panels[panel] = component
|
||||
}
|
||||
|
||||
getComponent(panel){
|
||||
return this.panels[panel]
|
||||
}
|
||||
|
||||
get items() {
|
||||
return [{
|
||||
text: "BetterDiscord Settings",
|
||||
id: "core"
|
||||
}, {
|
||||
text: "Plugins",
|
||||
id: "plugins"
|
||||
}, {
|
||||
text: "Themes",
|
||||
id: "themes"
|
||||
}, {
|
||||
text: "Custom CSS",
|
||||
id: "customcss"
|
||||
}];
|
||||
}
|
||||
|
||||
get LCitems(){
|
||||
let items = [
|
||||
{
|
||||
text: "Lightcord Settings",
|
||||
id: "lightcord"
|
||||
}, {
|
||||
text: "RichPresence",
|
||||
id: "status"
|
||||
}, {
|
||||
text: "Account Info",
|
||||
id: "accountinfo"
|
||||
}
|
||||
]
|
||||
if(window.Lightcord.Settings.devMode)items.push({
|
||||
text: "Api Components Preview",
|
||||
id: "lcapipreview"
|
||||
})
|
||||
return items
|
||||
}
|
||||
|
||||
render() {
|
||||
return [
|
||||
{
|
||||
section: "HEADER",
|
||||
label: "Lightcord"
|
||||
},
|
||||
...this.LCitems.map(e => {
|
||||
return {
|
||||
section: e.id,
|
||||
label: e.text,
|
||||
element: this.getComponent(e.id)
|
||||
}
|
||||
}),
|
||||
{
|
||||
section: "DIVIDER"
|
||||
},
|
||||
{
|
||||
section: "CUSTOM",
|
||||
element: this.getComponent("BDChangelogTitle")
|
||||
},
|
||||
...this.items.map(e => {
|
||||
return {
|
||||
section: e.id,
|
||||
label: e.text,
|
||||
element: this.getComponent(e.id)
|
||||
}
|
||||
}),
|
||||
{
|
||||
section: "DIVIDER"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* No need to export settingsPanelSidebar on window
|
||||
export default class V2_SettingsPanel_Sidebar {
|
||||
|
||||
constructor() {
|
||||
this.panels = {}
|
||||
}
|
||||
|
||||
register(panel, component){
|
||||
this.panels[panel] = component
|
||||
}
|
||||
|
||||
getComponent(panel, sidebar){
|
||||
return this.panels[panel](sidebar)
|
||||
}
|
||||
|
||||
get items() {
|
||||
return [{
|
||||
text: "BetterDiscord Settings",
|
||||
id: "core"
|
||||
}, {
|
||||
text: "Plugins",
|
||||
id: "plugins"
|
||||
}, {
|
||||
text: "Themes",
|
||||
id: "themes"
|
||||
}, {
|
||||
text: "Custom CSS",
|
||||
id: "customcss"
|
||||
}];
|
||||
}
|
||||
|
||||
get LCitems(){
|
||||
let items = [
|
||||
{
|
||||
text: "Lightcord Settings",
|
||||
id: "lightcord"
|
||||
}, {
|
||||
text: "RichPresence",
|
||||
id: "status"
|
||||
}, {
|
||||
text: "Account Info",
|
||||
id: "accountinfo"
|
||||
}
|
||||
]
|
||||
if(window.Lightcord.Settings.devMode)items.push({
|
||||
text: "Api Components Preview",
|
||||
id: "lcapipreview"
|
||||
})
|
||||
return items
|
||||
}
|
||||
|
||||
render(sidebar) {
|
||||
return [
|
||||
{
|
||||
section: "HEADER",
|
||||
label: "Lightcord"
|
||||
},
|
||||
...this.LCitems.map(e => {
|
||||
return {
|
||||
section: e.id,
|
||||
label: e.text,
|
||||
element: this.getComponent(e.id, sidebar)
|
||||
}
|
||||
}),
|
||||
{
|
||||
section: "DIVIDER"
|
||||
},
|
||||
{
|
||||
section: "CUSTOM",
|
||||
element: this.getComponent("BDChangelogTitle")
|
||||
},
|
||||
...this.items.map(e => {
|
||||
return {
|
||||
section: e.id,
|
||||
label: e.text,
|
||||
element: this.getComponent(e.id, sidebar)
|
||||
}
|
||||
}),
|
||||
{
|
||||
section: "DIVIDER"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* No need to export settingsPanelSidebar on window
|
||||
*/
|
File diff suppressed because it is too large
Load Diff
@ -1,61 +1,98 @@
|
||||
const ipcRenderer = require("../discord_native/ipc")
|
||||
|
||||
if(process.platform === "win32"){
|
||||
const originalNotification = window.Notification
|
||||
|
||||
ipcRenderer.send("NOTIFICATIONS_CLEAR")
|
||||
|
||||
const notifications = {}
|
||||
ipcRenderer.on("NOTIFICATION_CLICK", (e, id) => {
|
||||
var notification = notifications[id];
|
||||
if(notification){
|
||||
notification.onclick()
|
||||
notification.close()
|
||||
}
|
||||
})
|
||||
window.Notification = class LightcordNotification {
|
||||
constructor(title, data){
|
||||
this.id = LightcordNotification._id++
|
||||
this.onshow = function() {}
|
||||
this.onclick = function() {}
|
||||
this.onclose = function() {}
|
||||
this.title = title
|
||||
this.body = data.body
|
||||
this.icon = data.icon
|
||||
setTimeout(() => {
|
||||
return this.onshow()
|
||||
}, 0)
|
||||
notifications[this.id] = this
|
||||
ipcRenderer.send("NOTIFICATION_SHOW", {
|
||||
id: this.id,
|
||||
title: this.title,
|
||||
body: this.body,
|
||||
icon: this.icon,
|
||||
theme: settingStore ? settingStore.default.theme : "dark"
|
||||
})
|
||||
}
|
||||
|
||||
static _id = 0
|
||||
|
||||
static requestPermission(callback){
|
||||
callback()
|
||||
}
|
||||
|
||||
static permission = "granted"
|
||||
|
||||
close(){
|
||||
if(!notifications[this.id])return
|
||||
|
||||
delete notifications[this.id]
|
||||
ipcRenderer.send("NOTIFICATION_CLOSE", this.id)
|
||||
this.onclose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let settingStore
|
||||
ensureExported((e => e.default && e.default.theme))
|
||||
.then(themeStore => {
|
||||
settingStore = themeStore
|
||||
ipcRenderer.send("UPDATE_THEME", themeStore.default.theme)
|
||||
const ipcRenderer = require("../discord_native/ipc")
|
||||
|
||||
|
||||
if(process.platform === "win32"){
|
||||
let useShim = false
|
||||
|
||||
const originalNotification = window.Notification
|
||||
|
||||
ipcRenderer.send("NOTIFICATIONS_CLEAR")
|
||||
|
||||
const notifications = {}
|
||||
ipcRenderer.on("NOTIFICATION_CLICK", (e, id) => {
|
||||
var notification = notifications[id];
|
||||
if(notification){
|
||||
notification.onclick()
|
||||
notification.close()
|
||||
}
|
||||
})
|
||||
class LightcordNotification {
|
||||
constructor(title, data){
|
||||
this.id = LightcordNotification._id++
|
||||
this.onshow = function() {}
|
||||
this.onclick = function() {}
|
||||
this.onclose = function() {}
|
||||
this.title = title
|
||||
this.body = data.body
|
||||
this.icon = data.icon
|
||||
setTimeout(() => {
|
||||
return this.onshow()
|
||||
}, 0)
|
||||
notifications[this.id] = this
|
||||
ipcRenderer.send("NOTIFICATION_SHOW", {
|
||||
id: this.id,
|
||||
title: this.title,
|
||||
body: this.body,
|
||||
icon: this.icon,
|
||||
theme: settingStore ? settingStore.default.theme : "dark"
|
||||
})
|
||||
}
|
||||
|
||||
static _id = 0
|
||||
|
||||
static requestPermission(callback){
|
||||
callback()
|
||||
}
|
||||
|
||||
close(){
|
||||
if(!notifications[this.id])return
|
||||
|
||||
delete notifications[this.id]
|
||||
ipcRenderer.send("NOTIFICATION_CLOSE", this.id)
|
||||
this.onclose()
|
||||
}
|
||||
}
|
||||
|
||||
LightcordNotification.permission = "granted"
|
||||
|
||||
function Notification(){
|
||||
if(useShim)return new LightcordNotification(...arguments)
|
||||
return new originalNotification(...arguments)
|
||||
}
|
||||
Object.defineProperties(Notification, {
|
||||
permission: {
|
||||
get(){
|
||||
if(useShim)return LightcordNotification.permission
|
||||
return originalNotification.permission
|
||||
}
|
||||
},
|
||||
requestPermission: {
|
||||
get(){
|
||||
if(useShim)return LightcordNotification.requestPermission
|
||||
return originalNotification.requestPermission
|
||||
}
|
||||
},
|
||||
_id: {
|
||||
get(){
|
||||
if(useShim)return LightcordNotification._id
|
||||
return originalNotification._id
|
||||
}
|
||||
}
|
||||
})
|
||||
window.Notification = Notification
|
||||
|
||||
|
||||
module.exports = {
|
||||
useShim(use){
|
||||
useShim = !!use
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let settingStore
|
||||
|
||||
ensureExported((e => e.default && e.default.theme))
|
||||
.then(themeStore => {
|
||||
settingStore = themeStore
|
||||
ipcRenderer.send("UPDATE_THEME", themeStore.default.theme)
|
||||
}).catch(console.error)
|
@ -79,13 +79,13 @@ function startup(bootstrapModules) {
|
||||
click: () => {
|
||||
mainScreen.webContentsSend("NEW_TAB")
|
||||
},
|
||||
accelerator: "Command+T"
|
||||
accelerator: "CmdOrCtrl+T"
|
||||
}, {
|
||||
label: "Close Current Tab",
|
||||
click: () => {
|
||||
mainScreen.webContentsSend("CLOSE_TAB")
|
||||
},
|
||||
accelerator: "Command+W"
|
||||
accelerator: "CmdOrCtrl+W"
|
||||
})
|
||||
}
|
||||
e.submenu = e.submenu.map(e => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user