Experiments: add toggle for toolbar dev button

Co-Authored-By: F53 <fseusb@gmail.com>
This commit is contained in:
Vendicated 2024-06-12 03:44:51 +02:00
parent 64025bc523
commit 9de18ac8c7
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
2 changed files with 25 additions and 3 deletions

View file

@ -16,12 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings } from "@api/Settings";
import { disableStyle, enableStyle } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
import { ErrorCard } from "@components/ErrorCard";
import { Devs } from "@utils/constants";
import { Margins } from "@utils/margins";
import definePlugin from "@utils/types";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { Forms, React } from "@webpack/common";
@ -29,6 +30,15 @@ import hideBugReport from "./hideBugReport.css?managed";
const KbdStyles = findByPropsLazy("key", "removeBuildOverride");
const settings = definePluginSettings({
toolbarDevMenu: {
type: OptionType.BOOLEAN,
description: "Change the Help (?) toolbar button (top right in chat) to Discord's developer menu",
default: false,
restartNeeded: true
}
});
export default definePlugin({
name: "Experiments",
description: "Enable Access to Experiments & other dev-only features in Discord!",
@ -40,6 +50,8 @@ export default definePlugin({
Devs.Nuckyz
],
settings,
patches: [
{
find: "Object.defineProperties(this,{isDeveloper",
@ -68,6 +80,16 @@ export default definePlugin({
replacement: {
match: /\i\.isStaff\(\)/,
replace: "true"
},
predicate: () => settings.store.toolbarDevMenu
},
// makes the Favourites Server experiment allow favouriting DMs and threads
{
find: "useCanFavoriteChannel",
replacement: {
match: /!\(\i\.isDM\(\)\|\|\i\.isThread\(\)\)/,
replace: "true",
}
}
],

View file

@ -38,7 +38,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({
id: 0n,
},
Ven: {
name: "Vendicated",
name: "Vee",
id: 343383572805058560n
},
Arjix: {
@ -327,7 +327,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({
id: 305288513941667851n
},
ImLvna: {
name: "Luna <3",
name: "lillith <3",
id: 799319081723232267n
},
rad: {