aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorbb010g <me@bb010g.com>2023-08-18 16:10:59 -0700
committerGitHub <noreply@github.com>2023-08-19 01:10:59 +0200
commit4c4036546a989023c7c0f1ee8f4b36d84f82becd (patch)
tree955de1629daa71d5d5eb096eec3a7d9c992f4221 /src/plugins
parentd582e61ec30713a8e540ca3d0d02160406a1d0d9 (diff)
downloadVencord-4c4036546a989023c7c0f1ee8f4b36d84f82becd.tar.gz
Vencord-4c4036546a989023c7c0f1ee8f4b36d84f82becd.tar.bz2
Vencord-4c4036546a989023c7c0f1ee8f4b36d84f82becd.zip
new plugin: NormalizeMessageLinks (#1641)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/normalizeMessageLinks/index.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/normalizeMessageLinks/index.ts b/src/plugins/normalizeMessageLinks/index.ts
new file mode 100644
index 0000000..cac36e6
--- /dev/null
+++ b/src/plugins/normalizeMessageLinks/index.ts
@@ -0,0 +1,26 @@
+/*
+ * Vencord, a Discord client mod
+ * Copyright (c) 2023 Vendicated and contributors
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+import { Devs } from "@utils/constants";
+import definePlugin from "@utils/types";
+
+export default definePlugin({
+ name: "NormalizeMessageLinks",
+ description: "Strip canary/ptb from message links",
+ authors: [Devs.bb010g],
+ patches: [
+ {
+ find: ".Messages.COPY_MESSAGE_LINK,",
+ replacement: {
+ match: /\.concat\(location\.host\)/,
+ replace: ".concat($self.normalizeHost(location.host))",
+ },
+ },
+ ],
+ normalizeHost(host: string) {
+ return host.replace(/(^|\b)(canary\.|ptb\.)(discord.com)$/, "$1$3");
+ },
+});