diff --git a/src/plugins/extraConnectionLinks/README.md b/src/plugins/extraConnectionLinks/README.md new file mode 100644 index 000000000..c2af46278 --- /dev/null +++ b/src/plugins/extraConnectionLinks/README.md @@ -0,0 +1,14 @@ +# ExtraConnectionLinks + +Adds the Open Profile button to connections that don't natively have it in the regular Discord client. +## Supported Platforms +* Xbox +* Roblox +## Planned Platforms +* None as of currently +## Platforms that will never be supported +* Riot Games/League of Legends (Nothing made by Riot Games to view profiles online) +* Battle.net (Nothing made by Blizzard to view profiles online) +* Bungie.net (Nothing made by Bungie.net to view profiles online) +* Epic Games (Nothing made by Epic Games to view profiles online) +* PSN/PlayStation Network (Sony built a service called My PlayStation, but removed it for unknown reasons in 2021) diff --git a/src/plugins/extraConnectionLinks/index.ts b/src/plugins/extraConnectionLinks/index.ts new file mode 100644 index 000000000..0e36f39f2 --- /dev/null +++ b/src/plugins/extraConnectionLinks/index.ts @@ -0,0 +1,59 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Cooper/coopeeo, Vendicated and contributors* + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; + +/** + * platforms that dont open natively + * ! riot and leage (can't view profiles) + * ! epic (can't view profiles) + * ! psn (can't view profiles after sony removed My PlayStation) + * * roblox (Added) + * * xbox (Added) + * ! battle.net (can't view profiles) + * ! bungie.net (can't view profiles) + * ! facebook (don't have discord access token for facebook connection) + **/ + +/** */ +enum contypes { + Roblox = "Roblox", + Xbox = "Xbox", +} + +const uris = { // name (what shows up on connection on ui), id (an identifier thing) + [contypes.Roblox]: "https://www.roblox.com/users/${id}/profile", + [contypes.Xbox]: "https://www.xbox.com/play/user/${name}", +}; + +const serviceNames = { // What the name part in the discord code calls it. + [contypes.Roblox]: "Roblox", + [contypes.Xbox]: "Xbox", +}; + +export default definePlugin({ + name: "ExtraConnectionLinks", + description: "Adds the Open Profile button to connections that don't natively have it in the regular Discord client.", + authors: [Devs.coopeeo], + patches: makePatches(), +}); + + +function makePatches() { + return Object.keys(contypes) + .filter(v => isNaN(Number(v))) + .map(key => { + const contype = contypes[key as keyof typeof contypes]; + return { + find: "getPlatformUserUrl:", + replacement: { + match: new RegExp(`(?<=${serviceNames[contype]}",.*},.+)(?=},)`), + replace: `, getPlatformUserUrl:e=>{let {name, id} = e; return \`${uris[contype]}\`;}` + } + }; + }); +} diff --git a/src/plugins/openMoreConnections/README.md b/src/plugins/openMoreConnections/README.md deleted file mode 100644 index ef3eb93d2..000000000 --- a/src/plugins/openMoreConnections/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# OpenMoreConnections - -Adds the Open Profile button to connections that don't natively have it in the regular Discord client. -## Supported Platforms -* Xbox -* Roblox -## Planned Platforms -* PSN -## Platforms that will never be supported -* Riot Games/League of Legends -* Battle.net -* Epic Games diff --git a/src/plugins/openMoreConnections/index.ts b/src/plugins/openMoreConnections/index.ts deleted file mode 100644 index e69708844..000000000 --- a/src/plugins/openMoreConnections/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Cooper/coopeeo, Vendicated and contributors* - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -//* platforms that dont open -//* riot and leage (can't view profiles) -//* epic (can't view profiles) -//* psn (can't view profiles but I have a workaround for 3rd party stuff) -//* roblox -//* xbox -//* battle.net (can't view profiles) - -const uris = { // name = t, and id = l - roblox: "https://www.roblox.com/users/${l}/profile", - xbox: "https://www.xbox.com/play/user/${t}" -}; -export default definePlugin({ - name: "OpenMoreConnections", - description: "Adds the Open Profile button to connections that don't natively have it in the regular Discord client. Supported Platforms: Xbox, and Roblox. Planned Platforms: PSN. Platforms that will never be supported: Riot Games/League of Legends, Battle.net, and Epic Games", - authors: [Devs.coopeeo], - patches: [ - { - find: "getPlatformUserUrl:e=>", - replacement: { - match: /(?<=Roblox",.*},.+)(?=},)/, - replace: `, getPlatformUserUrl:e=>{let {name:t, id:l} = e; return \`${uris.roblox}\`;}` - } - }, - { - find: "getPlatformUserUrl:e=>", - replacement: { - match: /(?<=Xbox",.*},.+)(?=},)/, - replace: `, getPlatformUserUrl:e=>{let {name:t, id:l} = e; return \`${uris.xbox}\`;}` - } - } - ], -});