blob: cac36e65c633c6dbeec132b6de1df8b9f31b5947 (
plain)
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
|
/*
* 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");
},
});
|