change name, update code and readme

This commit is contained in:
Cooper 2024-07-02 14:13:05 -05:00 committed by GitHub
parent 8b4fe6e95f
commit e648bf92e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 73 additions and 54 deletions

View file

@ -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)

View file

@ -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]}\`;}`
}
};
});
}

View file

@ -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

View file

@ -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}\`;}`
}
}
],
});