From 72fcbfd119290775e57739e1e9e65ab7be431443 Mon Sep 17 00:00:00 2001 From: 1024x2 Date: Thu, 13 Jun 2024 00:59:55 +0100 Subject: Update patches --- 0001-Remove-donator-badges.patch | 8 +- 0002-Small-rebrand.patch | 2 +- ...riments-Re-add-isStaff-and-staging-banner.patch | 109 --------------------- 0003-Experiments-Re-add-staging-banner.patch | 64 ++++++++++++ ...-t-prompt-for-updates-when-on-a-local-bra.patch | 2 +- ...SP-bypass-on-stock-discord-desktop-client.patch | 2 +- 0006-Updater-Disable-auto-update-by-default.patch | 2 +- 7 files changed, 72 insertions(+), 117 deletions(-) delete mode 100644 0003-Experiments-Re-add-isStaff-and-staging-banner.patch create mode 100644 0003-Experiments-Re-add-staging-banner.patch diff --git a/0001-Remove-donator-badges.patch b/0001-Remove-donator-badges.patch index 7d77efb..795d546 100644 --- a/0001-Remove-donator-badges.patch +++ b/0001-Remove-donator-badges.patch @@ -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 ; }, { noop: true }), diff --git a/0002-Small-rebrand.patch b/0002-Small-rebrand.patch index c517e32..fc48434 100644 --- a/0002-Small-rebrand.patch +++ b/0002-Small-rebrand.patch @@ -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 diff --git a/0003-Experiments-Re-add-isStaff-and-staging-banner.patch b/0003-Experiments-Re-add-isStaff-and-staging-banner.patch deleted file mode 100644 index de147c7..0000000 --- a/0003-Experiments-Re-add-isStaff-and-staging-banner.patch +++ /dev/null @@ -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 . - */ - -+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 - diff --git a/0003-Experiments-Re-add-staging-banner.patch b/0003-Experiments-Re-add-staging-banner.patch new file mode 100644 index 0000000..cb724d4 --- /dev/null +++ b/0003-Experiments-Re-add-staging-banner.patch @@ -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 + diff --git a/0004-Updater-don-t-prompt-for-updates-when-on-a-local-bra.patch b/0004-Updater-don-t-prompt-for-updates-when-on-a-local-bra.patch index f9f5318..e0276c7 100644 --- a/0004-Updater-don-t-prompt-for-updates-when-on-a-local-bra.patch +++ b/0004-Updater-don-t-prompt-for-updates-when-on-a-local-bra.patch @@ -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 diff --git a/0005-Enable-CSP-bypass-on-stock-discord-desktop-client.patch b/0005-Enable-CSP-bypass-on-stock-discord-desktop-client.patch index 41521e1..6de9bd6 100644 --- a/0005-Enable-CSP-bypass-on-stock-discord-desktop-client.patch +++ b/0005-Enable-CSP-bypass-on-stock-discord-desktop-client.patch @@ -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 diff --git a/0006-Updater-Disable-auto-update-by-default.patch b/0006-Updater-Disable-auto-update-by-default.patch index c962665..185c0a6 100644 --- a/0006-Updater-Disable-auto-update-by-default.patch +++ b/0006-Updater-Disable-auto-update-by-default.patch @@ -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 -- cgit v1.2.3