tried to add more services (but none of them worked) :(

This commit is contained in:
Cooper 2024-07-24 12:07:40 -05:00 committed by GitHub
parent d435e0a28e
commit e2c3c0655a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 34 deletions

View file

@ -15,7 +15,11 @@ Allows you to open more connections in browser!
### 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)
* Riot Games (Nothing made by Riot Games to view profiles online)
* League of Legends (Same as above since it's the same company)
* Battle.net (Nothing made by Blizzard to view profiles online)
* Bungie.net (Nothing made by Bungie.net to view profiles online)
* PSN/PlayStation Network (Sony built a service called My PlayStation, but removed it for unknown reasons in 2021)
* PlayStation Network (Sony built a service called My PlayStation, but removed it for unknown reasons in 2021)
* Facebook (don't have discord's token for facebook apis why even would i have that...)
* Crunchyroll (can't view other peoples profiles nor your own profile)
* Amazon Music (nothing references to the actual amazon music user id in discord. I also went on the website for the first time and it decided to give me unlimited for free, then right after upgraded me to the family plan and that was not free and was a waste of $10.54, like bro, I was just trying to close all the popups then it froze and upgraded itself to the family plan)

View file

@ -8,55 +8,67 @@ import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
/**
* platforms that dont open natively
* ! riot and leage (can't view profiles)
* * epic (Added)
* ! 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)
* platforms that dont open natively (and the status of them)
* * Roblox (Added)
* * Xbox/Xbox Live (Added)
* * Epic Games (Added)
* ! Riot Games (can't view profiles)
* ! Leage of Legends (can't view profiles) (same as Riot Games)
* ! PSN (no other known way to view profiles after Sony removed My PlayStation)
* ! Battle.net (can't view profiles)
* ! Bungie.net (can't view profiles)
* ! Facebook (don't have discord's token for facebook apis)
* ! Crunchyroll (can't view other peoples profiles nor your own profile)
* ! Amazon Music (the id that discord shows is "amzn1.<something>.<random letters and numbers thats not the actual user id>")
**/
/** */
enum contypes {
Roblox = "Roblox",
Xbox = "Xbox",
Epic = "Epic"
/**
* All the connection types implemented into this plugin
*/
enum connectionTypes {
Roblox,
Xbox,
Epic,
}
/**
* The uri to use.
* There are also two variables that you can use, name and id.
* The "name" is well the name of the account and the name is what shows up when viewing a connection on a discord profile.
* The "id" is an identifier that normal users don't see, it will usually be an user id (, for example Roblox has user ids, and discord stores that user id in the id field of the connection).
* @example [connectionTypes.Xbox]: "https://www.xbox.com/play/user/${name}",
* @example [connectionTypes.Roblox]: "https://www.roblox.com/users/${id}/profile",
*/
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}",
[contypes.Epic]: "https://store.epicgames.com/en-US/u/${id}",
[connectionTypes.Roblox]: "https://www.roblox.com/users/${id}/profile",
[connectionTypes.Xbox]: "https://www.xbox.com/play/user/${name}",
[connectionTypes.Epic]: "https://store.epicgames.com/u/${id}",
};
const serviceNames = { // What the name part in the discord code calls it.
[contypes.Roblox]: "Roblox",
[contypes.Xbox]: "Xbox",
[contypes.Epic]: "Epic Games",
/**
* What discord has the service named as.
* @example [connectionTypes.Epic]: "Epic Games",
*/
const serviceNames = {
[connectionTypes.Roblox]: "Roblox",
[connectionTypes.Xbox]: "Xbox",
[connectionTypes.Epic]: "Epic Games",
};
export default definePlugin({
name: "ExtraConnectionLinks",
description: "Allows you to open more connections in browser!",
authors: [Devs.coopeeo],
patches: makePatches(),
});
function makePatches() {
return Object.keys(contypes)
patches: Object.keys(connectionTypes)
.filter(v => isNaN(Number(v)))
.map(key => {
const contype = contypes[key as keyof typeof contypes];
const connectionTypeSelected = connectionTypes[key as keyof typeof connectionTypes];
return {
find: "getPlatformUserUrl:",
replacement: {
match: new RegExp(`(?<=${serviceNames[contype]}",.*},.+)(?=},)`),
replace: `, getPlatformUserUrl:e=>{let {name, id} = e; return \`${uris[contype]}\`;}`
match: new RegExp(`(?<=${serviceNames[connectionTypeSelected]}",.*},.+)(?=},)`),
replace: `, getPlatformUserUrl:e=>{let {name, id} = e; return \`${uris[connectionTypeSelected]}\`;}`
}
};
});
}
}),
});