add back normalizemessagelinks
This commit is contained in:
parent
7f5fcd815c
commit
185c2e5ed6
1 changed files with 26 additions and 0 deletions
26
src/equicordplugins/normalizeMessageLinks/index.ts
Normal file
26
src/equicordplugins/normalizeMessageLinks/index.ts
Normal file
|
|
@ -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: "#{intl::COPY_MESSAGE_LINK}",
|
||||
replacement: {
|
||||
match: /(?<=\/\/\$\{)location\.host/,
|
||||
replace: "$self.normalizeHost(location.host)",
|
||||
},
|
||||
},
|
||||
],
|
||||
normalizeHost(host: string) {
|
||||
return host.replace(/(^|\b)(canary\.|ptb\.)(discord.com)$/, "$1$3");
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue