From 728c86eb4d6f3d2c96c1a354a947436dd64d4c8a Mon Sep 17 00:00:00 2001 From: 1024x2 <2pow11@gmail.com> Date: Thu, 13 Jun 2024 01:00:35 +0100 Subject: [PATCH 3/8] Experiments: Re-add staging banner (it's funny) --- src/plugins/experiments/index.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx index 33c32b1a..2992807e 100644 --- a/src/plugins/experiments/index.tsx +++ b/src/plugins/experiments/index.tsx @@ -21,16 +21,24 @@ import { disableStyle, enableStyle } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; import { ErrorCard } from "@components/ErrorCard"; import { Devs } from "@utils/constants"; +import { Logger } from "@utils/Logger"; import { Margins } from "@utils/margins"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; -import { Forms, React } from "@webpack/common"; +import { Forms, React, UserStore } from "@webpack/common"; +import { User } from "discord-types/general"; import hideBugReport from "./hideBugReport.css?managed"; const KbdStyles = findByPropsLazy("key", "combo"); const settings = definePluginSettings({ + forceStagingBanner: { + description: "Whether to force Staging banner under user area.", + type: OptionType.BOOLEAN, + default: false, + restartNeeded: true + }, toolbarDevMenu: { type: OptionType.BOOLEAN, description: "Change the Help (?) toolbar button (top right in chat) to Discord's developer menu", @@ -91,6 +99,14 @@ export default definePlugin({ match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/, replace: "false", } + }, + { + find: ".Messages.DEV_NOTICE_STAGING", + predicate: () => settings.store.forceStagingBanner, + replacement: { + match: /window\.GLOBAL_ENV\.RELEASE_CHANNEL/, + replace: "\"staging\"" + } } ], -- 2.45.2