From 5ccb126decfdebe16db32a2df22d9e75e4949654 Mon Sep 17 00:00:00 2001 From: 1024x2 Date: Fri, 16 Feb 2024 22:04:43 +0000 Subject: Initial commit --- 0001-Remove-donator-badges.patch | 150 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 0001-Remove-donator-badges.patch (limited to '0001-Remove-donator-badges.patch') diff --git a/0001-Remove-donator-badges.patch b/0001-Remove-donator-badges.patch new file mode 100644 index 0000000..1af5b96 --- /dev/null +++ b/0001-Remove-donator-badges.patch @@ -0,0 +1,150 @@ +From 191cf11a7bb70b3a213be50e85bbb0ccdbfbcf67 Mon Sep 17 00:00:00 2001 +From: 1024x2 <2pow11@gmail.com> +Date: Mon, 9 Oct 2023 17:46:41 +0100 +Subject: [PATCH 1/5] Remove donator badges + +It makes a request to an API hosted by the Vencord developer, without +any option to turn it off. This raises privacy concerns. +It's easiest to just get rid of the feature entirely. +--- + src/api/Badges.ts | 3 +- + src/plugins/_api/badges.tsx | 97 +------------------------------------ + 2 files changed, 2 insertions(+), 98 deletions(-) + +diff --git a/src/api/Badges.ts b/src/api/Badges.ts +index b50016c..3529693 100644 +--- a/src/api/Badges.ts ++++ b/src/api/Badges.ts +@@ -79,8 +79,7 @@ export function _getBadges(args: BadgeUserArgs) { + : badges.push({ ...badge, ...args }); + } + } +- const donorBadges = (Plugins.BadgeAPI as unknown as typeof import("../plugins/_api/badges").default).getDonorBadges(args.user.id); +- if (donorBadges) badges.unshift(...donorBadges); ++ void Plugins.BadgeAPI; // If I don't reference this everything breaks??? + + return badges; + } +diff --git a/src/plugins/_api/badges.tsx b/src/plugins/_api/badges.tsx +index 16b244a..4328925 100644 +--- a/src/plugins/_api/badges.tsx ++++ b/src/plugins/_api/badges.tsx +@@ -44,19 +44,6 @@ const ContributorBadge: ProfileBadge = { + link: "https://github.com/Vendicated/Vencord" + }; + +-let DonorBadges = {} as Record>>; +- +-async function loadBadges(noCache = false) { +- DonorBadges = {}; +- +- const init = {} as RequestInit; +- if (noCache) +- init.cache = "no-cache"; +- +- DonorBadges = await fetch("https://badges.vencord.dev/badges.json", init) +- .then(r => r.json()); +-} +- + export default definePlugin({ + name: "BadgeAPI", + description: "API to add badges to users.", +@@ -91,94 +78,12 @@ export default definePlugin({ + } + ], + +- toolboxActions: { +- async "Refetch Badges"() { +- await loadBadges(true); +- Toasts.show({ +- id: Toasts.genId(), +- message: "Successfully refetched badges!", +- type: Toasts.Type.SUCCESS +- }); +- } +- }, +- + async start() { + Vencord.Api.Badges.addBadge(ContributorBadge); +- await loadBadges(); + }, + + renderBadgeComponent: ErrorBoundary.wrap((badge: ProfileBadge & BadgeUserArgs) => { + const Component = badge.component!; + return ; +- }, { noop: true }), +- +- +- getDonorBadges(userId: string) { +- return DonorBadges[userId]?.map(badge => ({ +- image: badge.badge, +- description: badge.tooltip, +- position: BadgePosition.START, +- props: { +- style: { +- borderRadius: "50%", +- transform: "scale(0.9)" // The image is a bit too big compared to default badges +- } +- }, +- onClick() { +- const modalKey = openModal(props => ( +- { +- closeModal(modalKey); +- VencordNative.native.openExternal("https://github.com/sponsors/Vendicated"); +- }}> +- +- +- +- +- +- Vencord Donor +- +- +- +- +- +- +- +- +-
+- +- This Badge is a special perk for Vencord Donors +- +- +- Please consider supporting the development of Vencord by becoming a donor. It would mean a lot!! +- +-
+-
+- +- +- +- +- +-
+-
+- )); +- }, +- })); +- } ++ }, { noop: true }) + }); +-- +2.43.1 + -- cgit v1.2.3