aboutsummaryrefslogtreecommitdiffstats
path: root/0001-Remove-donator-badges.patch
blob: 1af5b9650dd9cd8569bcffa5411d9359738b169e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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<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.",
@@ -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 <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>
-                ));
-            },
-        }));
-    }
+    }, { noop: true })
 });
-- 
2.43.1