mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-25 08:46:25 +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 { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//* platforms that dont open
|
//* platforms that dont open
|
||||||
//* riot and leage (can't view profiles)
|
//* riot and leage (can't view profiles)
|
||||||
//* epic (can't view profiles)
|
//* epic (can't view profiles)
|
||||||
|
@ -17,43 +15,28 @@ import definePlugin from "@utils/types";
|
||||||
//* xbox
|
//* xbox
|
||||||
//* battle.net (can't view profiles)
|
//* battle.net (can't view profiles)
|
||||||
|
|
||||||
enum ConnectionType {
|
const uris = { // name = t, and id = l
|
||||||
Roblox = "roblox",
|
roblox: "https://www.roblox.com/users/${l}/profile",
|
||||||
PSN = "playstation",
|
xbox: "https://www.xbox.com/play/user/${t}"
|
||||||
Xbox = "xbox",
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface Connection {
|
|
||||||
type: ConnectionType | string;
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
verified: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "OpenMoreConnections",
|
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",
|
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],
|
authors: [Devs.coopeeo],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: ".CONNECTED_ACCOUNT_VIEWED,",
|
find: "getPlatformUserUrl:e=>",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=(\i)=null==\i\?void 0:null===\(\i=\i.getPlatformUserUrl\)\|\|void 0===\i\?void 0:\i.call\(\i,(\i)\);)/,
|
match: /(?<=Roblox",.*},.+)(?=},)/,
|
||||||
replace: "if ($1 == null) $1 = $self.addConnectionLink($2);"
|
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; }) {
|
function CompactConnectionComponent({ connection, theme }: { connection: Connection, theme: string; }) {
|
||||||
const platform = platforms.get(useLegacyPlatformType(connection.type));
|
const platform = platforms.get(useLegacyPlatformType(connection.type));
|
||||||
var url = platform.getPlatformUserUrl?.(connection);
|
const url = platform.getPlatformUserUrl?.(connection);
|
||||||
|
|
||||||
const img = (
|
const img = (
|
||||||
<img
|
<img
|
||||||
|
|
Loading…
Reference in a new issue