Compare commits

...

38 commits

Author SHA1 Message Date
Cooper
debe0052d6
Merge f62795da6d into a015cf96f6 2024-09-19 18:37:14 +02:00
Nuckyz
a015cf96f6
UserVoiceShow: Fix setting name
Some checks are pending
Sync to Codeberg / codeberg (push) Waiting to run
test / test (push) Waiting to run
2024-09-19 13:33:32 -03:00
Cooper
f62795da6d
Merge branch 'dev' into openMoreConnections 2024-09-12 13:31:12 -05:00
Cooper
0d7ab0bcbf
Merge branch 'dev' into openMoreConnections 2024-09-06 16:10:18 -05:00
Cooper
70ea0c92a8
Remove Roblox as a temp thing i will test when home. 2024-09-05 10:37:06 -05:00
Cooper
d6390658b7
oops also forgor this. 2024-09-05 10:36:33 -05:00
Cooper
29de13fe4e
fix errors in readme and code 2024-09-05 10:34:46 -05:00
Cooper
d24afdaa20
Merge branch 'dev' into openMoreConnections 2024-09-05 10:25:25 -05:00
Cooper
cb4071a3ce
Apply suggestions from code reviews
Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
2024-09-05 10:20:48 -05:00
Cooper
70d49a97c9
Merge branch 'dev' into openMoreConnections 2024-08-28 11:03:41 -05:00
Cooper
255571653e
Merge branch 'dev' into openMoreConnections 2024-08-25 22:59:16 -05:00
Cooper
a081ec8afd
Merge branch 'dev' into openMoreConnections 2024-08-12 12:39:27 -05:00
Cooper
be5e2527aa
Remove "Before and After" section
Co-authored-by: Scyye <97131358+Scyye@users.noreply.github.com>
2024-08-05 12:38:46 -05:00
Cooper
52c3a55449
Remove planned platforms section
Co-authored-by: Scyye <97131358+Scyye@users.noreply.github.com>
2024-08-05 12:37:07 -05:00
Cooper
52d3c0afac
Remove platform info as that info is in README.md
Co-authored-by: Scyye <97131358+Scyye@users.noreply.github.com>
2024-08-05 12:34:58 -05:00
Cooper
162be49239
Merge branch 'dev' into openMoreConnections 2024-08-05 12:33:52 -05:00
Cooper
7d4f0e4c3e
Merge branch 'dev' into openMoreConnections 2024-07-31 19:46:12 -05:00
Cooper
3f4e993329
Merge branch 'dev' into openMoreConnections 2024-07-27 16:28:42 -05:00
Cooper
5d64c6a081
Merge branch 'dev' into openMoreConnections 2024-07-25 10:31:57 -05:00
Cooper
e2c3c0655a
tried to add more services (but none of them worked) :( 2024-07-24 12:07:40 -05:00
Cooper
d435e0a28e
feat: add Epic Games profile support 2024-07-23 15:42:55 -05:00
Cooper
7c27cec573
Merge branch 'dev' into openMoreConnections 2024-07-23 11:12:51 -05:00
Cooper
120004874f
Merge branch 'dev' into openMoreConnections 2024-07-15 11:04:54 -05:00
Cooper
d3e9230117
Merge branch 'dev' into openMoreConnections 2024-07-14 12:44:02 -05:00
Cooper
7134cdd4d1
Merge branch 'dev' into openMoreConnections 2024-07-13 10:54:57 -05:00
Cooper
6a617016a7
add images to readme, and change description. 2024-07-06 12:31:58 -05:00
Cooper
7bc3e03b52
Merge branch 'dev' into openMoreConnections 2024-07-06 12:20:58 -05:00
Cooper
a0262029e3
Merge branch 'Vendicated:main' into openMoreConnections 2024-07-06 11:37:50 -05:00
Cooper
1fbfed635d
Merge branch 'dev' into openMoreConnections 2024-07-04 16:01:19 -05:00
Cooper
610332e93d
Merge branch 'dev' into openMoreConnections 2024-07-03 00:07:35 -05:00
Cooper
402cb1cad9
remove a star 2024-07-02 14:50:29 -05:00
Cooper
e648bf92e2
change name, update code and readme 2024-07-02 14:13:05 -05:00
Cooper
8b4fe6e95f
Merge branch 'dev' into openMoreConnections 2024-07-02 14:05:47 -05:00
Vendicated
b333deb731
improve settings ui (again) 2024-07-02 18:51:51 +02:00
Cooper
3e58b70b98
Switch to patch-only soulution 2024-06-29 23:58:29 -05:00
Cooper
36f809f8cf
revert the show connections edit (imma try to find a patch), and edit locale on the xbox link. 2024-06-29 22:24:11 -05:00
Cooper
9afcb75358
fix: Add ShowConnections support for OpenMoreConnections 2024-06-29 22:04:40 -05:00
Cooper
bfea1edf63
feat(plugin): OpenMoreConnections 2024-06-29 22:03:40 -05:00
6 changed files with 112 additions and 29 deletions

View file

@ -0,0 +1,21 @@
# ExtraConnectionLinks
Allows you to open more connections in browser!
### Before
![Shows the Roblox connection in the Discord client without the open profile button (the default).](https://github.com/Vendicated/Vencord/assets/73203995/734efd94-c61a-4f90-987d-3a4bbcc9311f)
### After
![Shows the Roblox connection in the Discord client with the open profile button.](https://github.com/Vendicated/Vencord/assets/73203995/eef59d09-78d9-4859-b722-242fc6aa7c8e)
## Platform Status
### Supported Platforms
* Xbox
* Epic Games
### Platforms that will never be supported
* 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)
* PlayStation Network (Sony built a service called My PlayStation, but removed it for unknown reasons in 2021)
* Facebook
* Crunchyroll (can't view other peoples profiles nor your own profile)
* Amazon Music (nothing references to the actual amazon music user id in discord.)

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";
/**
* 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 what shows up when viewing a connection on a discord profile.
* The "id" is the identifier of the account connected, the type depends on the service connected.
* @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)
//[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}",
};
/**
* 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: Object.keys(connectionTypes)
.filter(v => isNaN(Number(v)))
.map(key => {
const connectionTypeSelected = connectionTypes[key as keyof typeof connectionTypes];
return {
find: "getPlatformUserUrl:",
replacement: {
match: new RegExp("(r"),
replace: `, getPlatformUserUrl:e=>{let {name, id} = e; return \`${uris[connectionTypeSelected]}\`;}`
}
};
}),
});

View file

@ -8,7 +8,7 @@ import { classNameFactory } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { classes } from "@utils/misc"; import { classes } from "@utils/misc";
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { ChannelStore, GuildStore, IconUtils, NavigationRouter, PermissionsBits, PermissionStore, showToast, Text, Toasts, Tooltip, useCallback, useMemo, UserStore, useStateFromStores } from "@webpack/common"; import { ChannelStore, GuildStore, IconUtils, NavigationRouter, PermissionsBits, PermissionStore, React, showToast, Text, Toasts, Tooltip, useMemo, UserStore, useStateFromStores } from "@webpack/common";
import { Channel } from "discord-types/general"; import { Channel } from "discord-types/general";
const cl = classNameFactory("vc-uvs-"); const cl = classNameFactory("vc-uvs-");
@ -17,7 +17,7 @@ const { selectVoiceChannel } = findByPropsLazy("selectChannel", "selectVoiceChan
const VoiceStateStore = findStoreLazy("VoiceStateStore"); const VoiceStateStore = findStoreLazy("VoiceStateStore");
const UserSummaryItem = findComponentByCodeLazy("defaultRenderUser", "showDefaultAvatarsForNullUsers"); const UserSummaryItem = findComponentByCodeLazy("defaultRenderUser", "showDefaultAvatarsForNullUsers");
interface IconProps extends React.HTMLAttributes<HTMLDivElement> { interface IconProps extends React.ComponentPropsWithoutRef<"div"> {
size?: number; size?: number;
} }
@ -71,23 +71,18 @@ interface VoiceChannelTooltipProps {
function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) { function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) {
const voiceStates = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getVoiceStatesForChannel(channel.id)); const voiceStates = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getVoiceStatesForChannel(channel.id));
const users = useMemo( const users = useMemo(
() => Object.values<any>(voiceStates).map(voiceState => UserStore.getUser(voiceState.userId)).filter(user => user != null), () => Object.values<any>(voiceStates).map(voiceState => UserStore.getUser(voiceState.userId)).filter(user => user != null),
[voiceStates] [voiceStates]
); );
const guild = useMemo( const guild = channel.getGuildId() == null ? undefined : GuildStore.getGuild(channel.getGuildId());
() => channel.getGuildId() == null ? undefined : GuildStore.getGuild(channel.getGuildId()), const guildIcon = guild?.icon == null ? undefined : IconUtils.getGuildIconURL({
[channel] id: guild.id,
); icon: guild.icon,
size: 30
const guildIcon = useMemo(() => { });
return guild?.icon == null ? undefined : IconUtils.getGuildIconURL({
id: guild.id,
icon: guild.icon,
size: 30
});
}, [guild]);
return ( return (
<> <>
@ -103,7 +98,7 @@ function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) {
<UserSummaryItem <UserSummaryItem
users={users} users={users}
renderIcon={false} renderIcon={false}
max={7} max={13}
size={18} size={18}
/> />
</div> </div>
@ -119,11 +114,14 @@ const clickTimers = {} as Record<string, any>;
export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId }: VoiceChannelIndicatorProps) => { export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId }: VoiceChannelIndicatorProps) => {
const channelId = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getVoiceStateForUser(userId)?.channelId as string | undefined); const channelId = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getVoiceStateForUser(userId)?.channelId as string | undefined);
const channel = useMemo(() => channelId == null ? undefined : ChannelStore.getChannel(channelId), [channelId]);
const onClick = useCallback((e: React.MouseEvent) => { const channel = channelId == null ? undefined : ChannelStore.getChannel(channelId);
if (channel == null) return null;
function onClick(e: React.MouseEvent) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if (channel == null || channelId == null) return; if (channel == null || channelId == null) return;
if (!PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel)) { if (!PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel)) {
@ -147,18 +145,15 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId }: VoiceChanne
delete clickTimers[channelId]; delete clickTimers[channelId];
}, 250); }, 250);
} }
}, [channelId]); }
const isLocked = useMemo(() => { const isLocked = !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel) || !PermissionStore.can(PermissionsBits.CONNECT, channel);
return !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel) || !PermissionStore.can(PermissionsBits.CONNECT, channel);
}, [channelId]);
if (channel == null) return null;
return ( return (
<Tooltip <Tooltip
text={<VoiceChannelTooltip channel={channel} />} text={<VoiceChannelTooltip channel={channel} />}
tooltipClassName={cl("tooltip-container")} tooltipClassName={cl("tooltip-container")}
tooltipContentClassName={cl("tooltip-content")}
> >
{props => {props =>
isLocked ? isLocked ?

View file

@ -32,7 +32,7 @@ const settings = definePluginSettings({
default: true, default: true,
restartNeeded: true restartNeeded: true
}, },
showInVoiceMemberList: { showInMemberList: {
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
description: "Show a user's Voice Channel indicator in the member and DMs list", description: "Show a user's Voice Channel indicator in the member and DMs list",
default: true, default: true,
@ -82,12 +82,12 @@ export default definePlugin({
match: /\.subtext,children:.+?}\)\]}\)(?=])/, match: /\.subtext,children:.+?}\)\]}\)(?=])/,
replace: "$&,$self.VoiceChannelIndicator({userId:arguments[0]?.user?.id})" replace: "$&,$self.VoiceChannelIndicator({userId:arguments[0]?.user?.id})"
}, },
predicate: () => settings.store.showInVoiceMemberList predicate: () => settings.store.showInMemberList
} }
], ],
start() { start() {
if (settings.store.showInVoiceMemberList) { if (settings.store.showInMemberList) {
addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />); addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />);
} }
}, },

View file

@ -15,7 +15,13 @@
} }
.vc-uvs-tooltip-container { .vc-uvs-tooltip-container {
max-width: 200px; max-width: 300px;
}
.vc-uvs-tooltip-content {
display: flex;
flex-direction: column;
gap: 6px;
} }
.vc-uvs-guild-name { .vc-uvs-guild-name {
@ -31,7 +37,5 @@
.vc-uvs-vc-members { .vc-uvs-vc-members {
display: flex; display: flex;
margin: 8px 0;
flex-direction: row;
gap: 6px; gap: 6px;
} }

View file

@ -531,6 +531,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "Antti", name: "Antti",
id: 312974985876471810n id: 312974985876471810n
}, },
coopeeo: {
name: "Cooper",
id: 594864203102158859n
},
Joona: { Joona: {
name: "Joona", name: "Joona",
id: 297410829589020673n id: 297410829589020673n