mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 09:56:24 +00:00
Switch to patch-only soulution
This commit is contained in:
parent
36f809f8cf
commit
3e58b70b98
2 changed files with 15 additions and 32 deletions
|
@ -7,8 +7,6 @@
|
|||
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)
|
||||
|
@ -17,43 +15,28 @@ import definePlugin from "@utils/types";
|
|||
//* xbox
|
||||
//* battle.net (can't view profiles)
|
||||
|
||||
enum ConnectionType {
|
||||
Roblox = "roblox",
|
||||
PSN = "playstation",
|
||||
Xbox = "xbox",
|
||||
}
|
||||
|
||||
|
||||
interface Connection {
|
||||
type: ConnectionType | string;
|
||||
id: string;
|
||||
name: string;
|
||||
verified: boolean;
|
||||
}
|
||||
|
||||
|
||||
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: ".CONNECTED_ACCOUNT_VIEWED,",
|
||||
find: "getPlatformUserUrl:e=>",
|
||||
replacement: {
|
||||
match: /(?<=(\i)=null==\i\?void 0:null===\(\i=\i.getPlatformUserUrl\)\|\|void 0===\i\?void 0:\i.call\(\i,(\i)\);)/,
|
||||
replace: "if ($1 == null) $1 = $self.addConnectionLink($2);"
|
||||
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}\`;}`
|
||||
}
|
||||
}
|
||||
],
|
||||
addConnectionLink(con: Connection) {
|
||||
switch (con.type) {
|
||||
case ConnectionType.Roblox:
|
||||
return `https://www.roblox.com/users/${con.id}/profile`;
|
||||
case ConnectionType.Xbox:
|
||||
return `https://www.xbox.com/play/user/${con.name}`;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -134,7 +134,7 @@ function ConnectionsComponent({ id, theme, simplified }: { id: string, theme: st
|
|||
|
||||
function CompactConnectionComponent({ connection, theme }: { connection: Connection, theme: string; }) {
|
||||
const platform = platforms.get(useLegacyPlatformType(connection.type));
|
||||
var url = platform.getPlatformUserUrl?.(connection);
|
||||
const url = platform.getPlatformUserUrl?.(connection);
|
||||
|
||||
const img = (
|
||||
<img
|
||||
|
|
Loading…
Reference in a new issue