Update patches

This commit is contained in:
1024x2 2024-06-13 00:59:55 +01:00
parent e6d44d95d2
commit 72fcbfd119
Signed by: 1024x2
GPG Key ID: DEF24F6555C1934C
7 changed files with 72 additions and 117 deletions

@ -1,4 +1,4 @@
From 920bd4bdc31332279ab2458182871de8991dcfb4 Mon Sep 17 00:00:00 2001
From 396ec536cbdbf8bf2af1f22deee2553baf20d59f Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Wed, 24 Apr 2024 23:30:05 +0100
Subject: [PATCH 1/6] Remove donator badges
@ -26,7 +26,7 @@ index 24c68c4e..4e1e9cff 100644
return badges;
}
diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx
index b4ee45a1..9549f03e 100644
index d8e391ae..f31af4c6 100644
--- a/src/plugins/_api/badges/index.tsx
+++ b/src/plugins/_api/badges/index.tsx
@@ -43,19 +43,6 @@ const ContributorBadge: ProfileBadge = {
@ -49,7 +49,7 @@ index b4ee45a1..9549f03e 100644
export default definePlugin({
name: "BadgeAPI",
description: "API to add badges to users.",
@@ -123,20 +110,8 @@ export default definePlugin({
@@ -119,20 +106,8 @@ export default definePlugin({
}
],
@ -70,7 +70,7 @@ index b4ee45a1..9549f03e 100644
},
getBadges(props: { userId: string; user?: User; guildId: string; }) {
@@ -154,74 +129,4 @@ export default definePlugin({
@@ -150,74 +125,4 @@ export default definePlugin({
const Component = badge.component!;
return <Component {...badge} />;
}, { noop: true }),

@ -1,4 +1,4 @@
From 0e652d9aadfb803a6d42db3c8d7ce1eb5eddec63 Mon Sep 17 00:00:00 2001
From ef93612c35d84586aabab79695ca80a3e1a033ef Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Sat, 8 Jun 2024 22:58:09 +0100
Subject: [PATCH 2/6] Small rebrand

@ -1,109 +0,0 @@
From 3b8d2305b7f49f24b2b82d3bff35ce5aebbcc7fb Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Sat, 8 Jun 2024 23:11:43 +0100
Subject: [PATCH 3/6] Experiments: Re-add isStaff and staging banner
(it's funny)
---
src/plugins/experiments/index.tsx | 54 +++++++++++++++++++++++++++++--
1 file changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx
index cf4dbf24..5a01ffad 100644
--- a/src/plugins/experiments/index.tsx
+++ b/src/plugins/experiments/index.tsx
@@ -16,19 +16,37 @@
* 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 { Logger } from "@utils/Logger";
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";
+import { Forms, React, UserStore } from "@webpack/common";
+import { User } from "discord-types/general";
import hideBugReport from "./hideBugReport.css?managed";
const KbdStyles = findByPropsLazy("key", "removeBuildOverride");
+const settings = definePluginSettings({
+ enableIsStaff: {
+ description: "Enable isStaff",
+ type: OptionType.BOOLEAN,
+ default: false,
+ restartNeeded: true
+ },
+ forceStagingBanner: {
+ description: "Whether to force Staging banner under user area.",
+ type: OptionType.BOOLEAN,
+ default: false,
+ restartNeeded: true
+ }
+});
+
export default definePlugin({
name: "Experiments",
description: "Enable Access to Experiments & other dev-only features in Discord!",
@@ -39,6 +57,7 @@ export default definePlugin({
Devs.BanTheNons,
Devs.Nuckyz
],
+ settings,
patches: [
{
@@ -69,12 +88,43 @@ export default definePlugin({
match: /\i\.isStaff\(\)/,
replace: "true"
}
+ },
+ {
+ find: '"isStaff",',
+ predicate: () => settings.store.enableIsStaff,
+ replacement: [
+ {
+ match: /(?<=>)(\i)\.hasFlag\((\i\.\i)\.STAFF\)(?=})/,
+ replace: (_, user, flags) => `$self.isStaff(${user},${flags})`
+ },
+ {
+ match: /hasFreePremium\(\){return this.isStaff\(\)\s*?\|\|/,
+ replace: "hasFreePremium(){return ",
+ }
+ ]
+ },
+ {
+ find: ".Messages.DEV_NOTICE_STAGING",
+ predicate: () => settings.store.forceStagingBanner,
+ replacement: {
+ match: /window\.GLOBAL_ENV\.RELEASE_CHANNEL/,
+ replace: "\"staging\""
+ }
}
],
start: () => enableStyle(hideBugReport),
stop: () => disableStyle(hideBugReport),
+ isStaff(user: User, flags: any) {
+ try {
+ return UserStore.getCurrentUser()?.id === user.id || user.hasFlag(flags.STAFF);
+ } catch (err) {
+ new Logger("Experiments").error(err);
+ return user.hasFlag(flags.STAFF);
+ }
+ },
+
settingsAboutComponent: () => {
const isMacOS = navigator.platform.includes("Mac");
const modKey = isMacOS ? "cmd" : "ctrl";
--
2.45.2

@ -0,0 +1,64 @@
From 91ff27cfc07a3d8100ab3ff8f7e3926a653968b7 Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Thu, 13 Jun 2024 00:59:16 +0100
Subject: [PATCH 3/6] Experiments: Re-add staging banner
(it's funny)
---
src/plugins/experiments/index.tsx | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx
index 9cb22521..201df515 100644
--- a/src/plugins/experiments/index.tsx
+++ b/src/plugins/experiments/index.tsx
@@ -21,16 +21,30 @@ 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", "removeBuildOverride");
const settings = definePluginSettings({
+ enableIsStaff: {
+ description: "Enable isStaff",
+ type: OptionType.BOOLEAN,
+ default: false,
+ restartNeeded: true
+ },
+ 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 +105,14 @@ export default definePlugin({
match: /!\(\i\.isDM\(\)\|\|\i\.isThread\(\)\)/,
replace: "true",
}
+ },
+ {
+ find: ".Messages.DEV_NOTICE_STAGING",
+ predicate: () => settings.store.forceStagingBanner,
+ replacement: {
+ match: /window\.GLOBAL_ENV\.RELEASE_CHANNEL/,
+ replace: "\"staging\""
+ }
}
],
--
2.45.2

@ -1,4 +1,4 @@
From 6c84f6b51db8fa01326dace1cb6634fc1305f6c7 Mon Sep 17 00:00:00 2001
From 41acca337b9dcf3ad1a71d949a635bd9537eccee Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Sat, 9 Mar 2024 08:00:55 +0000
Subject: [PATCH 4/6] Updater: don't prompt for updates when on a local branch

@ -1,4 +1,4 @@
From d9490ae87fc2ef6f8bba2426c3b05e44e0ea78df Mon Sep 17 00:00:00 2001
From 5b5f38a2f78bdcbce52ec03efd5b2baccc5eeb7c Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Wed, 27 Dec 2023 15:05:44 +0000
Subject: [PATCH 5/6] Enable CSP bypass on stock discord desktop client

@ -1,4 +1,4 @@
From eb88bbf9bf7fa46ed4940e7d4aa59c7885252211 Mon Sep 17 00:00:00 2001
From 88c5d967763b474bb6bd16410efb5925ede88dbe Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Sun, 21 Apr 2024 21:22:25 +0100
Subject: [PATCH 6/6] Updater: Disable auto-update by default