mirror of
https://git.1024x2.xyz/1024x2/vexcord.git
synced 2025-04-20 05:26:31 +02:00
151 lines
6.0 KiB
Diff
151 lines
6.0 KiB
Diff
From 5513b5fe92a7de00979a21e78741b1dc24241a5c Mon Sep 17 00:00:00 2001
|
|
From: 1024x2 <2pow11@gmail.com>
|
|
Date: Wed, 24 Apr 2024 23:30:05 +0100
|
|
Subject: [PATCH 1/8] 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/index.tsx | 95 -------------------------------
|
|
2 files changed, 1 insertion(+), 97 deletions(-)
|
|
|
|
diff --git a/src/api/Badges.ts b/src/api/Badges.ts
|
|
index 7a041f1e..fefbd439 100644
|
|
--- a/src/api/Badges.ts
|
|
+++ b/src/api/Badges.ts
|
|
@@ -90,8 +90,7 @@ export function _getBadges(args: BadgeUserArgs) {
|
|
: badges.push(...b);
|
|
}
|
|
}
|
|
- const donorBadges = (Plugins.BadgeAPI as unknown as typeof import("../plugins/_api/badges").default).getDonorBadges(args.userId);
|
|
- 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/index.tsx b/src/plugins/_api/badges/index.tsx
|
|
index 89a992ac..642769c8 100644
|
|
--- a/src/plugins/_api/badges/index.tsx
|
|
+++ b/src/plugins/_api/badges/index.tsx
|
|
@@ -43,19 +43,6 @@ const ContributorBadge: ProfileBadge = {
|
|
onClick: (_, { userId }) => openContributorModal(UserStore.getUser(userId))
|
|
};
|
|
|
|
-let DonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
|
|
-
|
|
-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.",
|
|
@@ -119,20 +106,8 @@ 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();
|
|
},
|
|
|
|
getBadges(props: { userId: string; user?: User; guildId: string; }) {
|
|
@@ -152,74 +127,4 @@ export default definePlugin({
|
|
const Component = badge.component!;
|
|
return <Component {...badge} />;
|
|
}, { 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 => (
|
|
- <ErrorBoundary noop onError={() => {
|
|
- closeModal(modalKey);
|
|
- VencordNative.native.openExternal("https://github.com/sponsors/Vendicated");
|
|
- }}>
|
|
- <Modals.ModalRoot {...props}>
|
|
- <Modals.ModalHeader>
|
|
- <Flex style={{ width: "100%", justifyContent: "center" }}>
|
|
- <Forms.FormTitle
|
|
- tag="h2"
|
|
- style={{
|
|
- width: "100%",
|
|
- textAlign: "center",
|
|
- margin: 0
|
|
- }}
|
|
- >
|
|
- <Heart />
|
|
- Vencord Donor
|
|
- </Forms.FormTitle>
|
|
- </Flex>
|
|
- </Modals.ModalHeader>
|
|
- <Modals.ModalContent>
|
|
- <Flex>
|
|
- <img
|
|
- role="presentation"
|
|
- src="https://cdn.discordapp.com/emojis/1026533070955872337.png"
|
|
- alt=""
|
|
- style={{ margin: "auto" }}
|
|
- />
|
|
- <img
|
|
- role="presentation"
|
|
- src="https://cdn.discordapp.com/emojis/1026533090627174460.png"
|
|
- alt=""
|
|
- style={{ margin: "auto" }}
|
|
- />
|
|
- </Flex>
|
|
- <div style={{ padding: "1em" }}>
|
|
- <Forms.FormText>
|
|
- This Badge is a special perk for Vencord Donors
|
|
- </Forms.FormText>
|
|
- <Forms.FormText className={Margins.top20}>
|
|
- Please consider supporting the development of Vencord by becoming a donor. It would mean a lot!!
|
|
- </Forms.FormText>
|
|
- </div>
|
|
- </Modals.ModalContent>
|
|
- <Modals.ModalFooter>
|
|
- <Flex style={{ width: "100%", justifyContent: "center" }}>
|
|
- <DonateButton />
|
|
- </Flex>
|
|
- </Modals.ModalFooter>
|
|
- </Modals.ModalRoot>
|
|
- </ErrorBoundary>
|
|
- ));
|
|
- },
|
|
- }));
|
|
- }
|
|
});
|
|
--
|
|
2.45.2
|
|
|