Move patches into a folder

This commit is contained in:
2024-08-13 21:08:35 +01:00
parent 81fbe676d7
commit df7d165228
9 changed files with 15 additions and 10 deletions

View File

@@ -0,0 +1,150 @@
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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,58 @@
From 2eb6e109c85aa251904d7d7322ba6c80bd5503a2 Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Thu, 13 Jun 2024 01:00:35 +0100
Subject: [PATCH 3/8] Experiments: Re-add staging banner
(it's funny)
---
src/plugins/experiments/index.tsx | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx
index 33c32b1a..2992807e 100644
--- a/src/plugins/experiments/index.tsx
+++ b/src/plugins/experiments/index.tsx
@@ -21,16 +21,24 @@ 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", "combo");
const settings = definePluginSettings({
+ 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 +99,14 @@ export default definePlugin({
match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/,
replace: "false",
}
+ },
+ {
+ find: ".Messages.DEV_NOTICE_STAGING",
+ predicate: () => settings.store.forceStagingBanner,
+ replacement: {
+ match: /window\.GLOBAL_ENV\.RELEASE_CHANNEL/,
+ replace: "\"staging\""
+ }
}
],
--
2.45.2

View File

@@ -0,0 +1,30 @@
From 3bdfceda8ef7add84ddb39428c67e391d796c001 Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Sat, 9 Mar 2024 08:00:55 +0000
Subject: [PATCH 4/8] Updater: don't prompt for updates when on a local branch
---
src/main/updater/git.ts | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/main/updater/git.ts b/src/main/updater/git.ts
index 1955f7dc..0226565e 100644
--- a/src/main/updater/git.ts
+++ b/src/main/updater/git.ts
@@ -49,12 +49,7 @@ async function getRepo() {
async function calculateGitChanges() {
await git("fetch");
- const branch = (await git("branch", "--show-current")).stdout.trim();
-
- const existsOnOrigin = (await git("ls-remote", "origin", branch)).stdout.length > 0;
- if (!existsOnOrigin) return [];
-
- const res = await git("log", `HEAD...origin/${branch}`, "--pretty=format:%an/%h/%s");
+ const res = await git("log", "HEAD..@{u}", "--pretty=format:%an/%h/%s");
const commits = res.stdout.trim();
return commits ? commits.split("\n").map(line => {
--
2.45.2

View File

@@ -0,0 +1,29 @@
From d0191e9b6ab6e6ae44857ee97ba392e8fbca91fd Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Wed, 27 Dec 2023 15:05:44 +0000
Subject: [PATCH 5/8] Enable CSP bypass on stock discord desktop client
---
src/main/index.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/index.ts b/src/main/index.ts
index 5519d47a..64e71c15 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -24,10 +24,11 @@ import { RendererSettings } from "./settings";
import { IS_VANILLA, THEMES_DIR } from "./utils/constants";
import { installExt } from "./utils/extensions";
-if (IS_VESKTOP || !IS_VANILLA) {
+{
app.whenReady().then(() => {
// Source Maps! Maybe there's a better way but since the renderer is executed
// from a string I don't think any other form of sourcemaps would work
+ if (IS_VESKTOP || !IS_VANILLA)
protocol.registerFileProtocol("vencord", ({ url: unsafeUrl }, cb) => {
let url = unsafeUrl.slice("vencord://".length);
if (url.endsWith("/")) url = url.slice(0, -1);
--
2.45.2

View File

@@ -0,0 +1,25 @@
From c343fc737e26195eb7c5f4af4c1e506d73f46465 Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Sun, 21 Apr 2024 21:22:25 +0100
Subject: [PATCH 6/8] Updater: Disable auto-update by default
---
src/api/Settings.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/api/Settings.ts b/src/api/Settings.ts
index 88337a91..4473bc1c 100644
--- a/src/api/Settings.ts
+++ b/src/api/Settings.ts
@@ -77,7 +77,7 @@ export interface Settings {
}
const DefaultSettings: Settings = {
- autoUpdate: true,
+ autoUpdate: false,
autoUpdateNotification: true,
useQuickCss: true,
themeLinks: [],
--
2.45.2

View File

@@ -0,0 +1,46 @@
From 1ba374fb928b0706078ab293a7abdab2f45f1643 Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Sat, 20 Jul 2024 00:21:22 +0100
Subject: [PATCH 7/8] SupportHelper: Disable running arbitrary code snippets
Why is this even a thing?
---
src/plugins/_core/supportHelper.tsx | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx
index de8e37c7..7cb0044d 100644
--- a/src/plugins/_core/supportHelper.tsx
+++ b/src/plugins/_core/supportHelper.tsx
@@ -300,28 +300,6 @@ export default definePlugin({
</Button>
);
}
-
- if (props.message.author.id === VENBOT_USER_ID) {
- const match = CodeBlockRe.exec(props.message.content || props.message.embeds[0]?.rawDescription || "");
- if (match) {
- buttons.push(
- <Button
- key="vc-run-snippet"
- onClick={async () => {
- try {
- await AsyncFunction(match[1])();
- showToast("Success!", Toasts.Type.SUCCESS);
- } catch (e) {
- new Logger(this.name).error("Error while running snippet:", e);
- showToast("Failed to run snippet :(", Toasts.Type.FAILURE);
- }
- }}
- >
- Run Snippet
- </Button>
- );
- }
- }
}
return buttons.length
--
2.45.2

View File

@@ -0,0 +1,29 @@
From 3d0cd1cf306a8e010c7389e5b654ac7cd75d1623 Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Sat, 20 Jul 2024 00:04:36 +0100
Subject: [PATCH 8/8] =?UTF-8?q?ReplaceGoogleSearch:=20=E9=87=8D=E6=96=B0?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=99=BE=E5=BA=A6=E6=94=AF=E6=8C=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
中华人民共和国万岁!!! 🇨🇳🇨🇳🇨🇳
---
src/plugins/replaceGoogleSearch/index.tsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/plugins/replaceGoogleSearch/index.tsx b/src/plugins/replaceGoogleSearch/index.tsx
index 43b0762a..f7d32397 100644
--- a/src/plugins/replaceGoogleSearch/index.tsx
+++ b/src/plugins/replaceGoogleSearch/index.tsx
@@ -17,6 +17,7 @@ const DefaultEngines = {
Bing: "https://www.bing.com/search?q=",
Yahoo: "https://search.yahoo.com/search?p=",
Yandex: "https://yandex.com/search/?text=",
+ Baidu: "https://www.baidu.com/s?wd=",
GitHub: "https://github.com/search?q=",
Reddit: "https://www.reddit.com/search?q=",
Wikipedia: "https://wikipedia.org/w/index.php?search=",
--
2.45.2