mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Discord profile badge
This commit is contained in:
@@ -46,6 +46,18 @@ namespace VRCX
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OpenDiscordProfile(string discordId)
|
||||||
|
{
|
||||||
|
if (!long.TryParse(discordId, out _))
|
||||||
|
throw new Exception("Invalid user ID");
|
||||||
|
|
||||||
|
var uri = $"discord://-/users/{discordId}";
|
||||||
|
Process.Start(new ProcessStartInfo(uri)
|
||||||
|
{
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public string GetLaunchCommand()
|
public string GetLaunchCommand()
|
||||||
{
|
{
|
||||||
var command = StartupArgs.LaunchArguments.LaunchCommand;
|
var command = StartupArgs.LaunchArguments.LaunchCommand;
|
||||||
|
|||||||
@@ -291,6 +291,11 @@ i.x-status-icon.red {
|
|||||||
border-color: #3b82f6 !important;
|
border-color: #3b82f6 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.x-tag-discord {
|
||||||
|
color: #7289da;
|
||||||
|
border-color: #7289da !important;
|
||||||
|
}
|
||||||
|
|
||||||
.x-tag-border-left {
|
.x-tag-border-left {
|
||||||
border-left: 0.8px solid;
|
border-left: 0.8px solid;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
|||||||
@@ -121,6 +121,19 @@
|
|||||||
{{ userDialog.mutualFriendCount }}
|
{{ userDialog.mutualFriendCount }}
|
||||||
</Badge>
|
</Badge>
|
||||||
</TooltipWrapper>
|
</TooltipWrapper>
|
||||||
|
<TooltipWrapper
|
||||||
|
v-if="userDialog.ref.discordId"
|
||||||
|
side="top"
|
||||||
|
:content="t('dialog.user.tags.open_in_discord')">
|
||||||
|
<Badge
|
||||||
|
variant="outline"
|
||||||
|
class="x-tag-discord cursor-pointer"
|
||||||
|
style="margin-right: 5px; margin-top: 5px"
|
||||||
|
@click="openDiscordProfile(userDialog.ref.discordId)">
|
||||||
|
<i class="ri-discord-line mr-1 h-4 w-4 inline-block" style="height: 1em; width: 1em"></i>
|
||||||
|
{{ t('dialog.user.tags.discord') }}
|
||||||
|
</Badge>
|
||||||
|
</TooltipWrapper>
|
||||||
<Badge
|
<Badge
|
||||||
v-if="userDialog.ref.$isTroll"
|
v-if="userDialog.ref.$isTroll"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -272,7 +285,13 @@
|
|||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import { formatDateFilter, languageClass, userImage, userStatusClass } from '../../../shared/utils';
|
import {
|
||||||
|
formatDateFilter,
|
||||||
|
languageClass,
|
||||||
|
openDiscordProfile,
|
||||||
|
userImage,
|
||||||
|
userStatusClass
|
||||||
|
} from '../../../shared/utils';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';
|
import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';
|
||||||
import { useGalleryStore, useUserStore } from '../../../stores';
|
import { useGalleryStore, useUserStore } from '../../../stores';
|
||||||
import { Badge } from '../../ui/badge';
|
import { Badge } from '../../ui/badge';
|
||||||
|
|||||||
@@ -1027,7 +1027,9 @@
|
|||||||
"18_plus_verified": "18+ Verified",
|
"18_plus_verified": "18+ Verified",
|
||||||
"age_verified": "Age Verified",
|
"age_verified": "Age Verified",
|
||||||
"trust_level": "Trust Level",
|
"trust_level": "Trust Level",
|
||||||
"mutual_friends": "Mutual Friends"
|
"mutual_friends": "Mutual Friends",
|
||||||
|
"open_in_discord": "Open in Discord",
|
||||||
|
"discord": "Discord"
|
||||||
},
|
},
|
||||||
"badges": {
|
"badges": {
|
||||||
"assigned": "Assigned",
|
"assigned": "Assigned",
|
||||||
|
|||||||
@@ -421,6 +421,17 @@ function openExternalLink(link) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openDiscordProfile(discordId) {
|
||||||
|
if (!discordId) {
|
||||||
|
toast.error('No Discord ID provided!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AppApi.OpenDiscordProfile(discordId).catch((err) => {
|
||||||
|
console.error('Failed to open Discord profile:', err);
|
||||||
|
toast.error('Failed to open Discord profile!');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {object} ref
|
* @param {object} ref
|
||||||
@@ -537,6 +548,7 @@ export {
|
|||||||
buildTreeData,
|
buildTreeData,
|
||||||
replaceBioSymbols,
|
replaceBioSymbols,
|
||||||
openExternalLink,
|
openExternalLink,
|
||||||
|
openDiscordProfile,
|
||||||
getBundleDateSize,
|
getBundleDateSize,
|
||||||
openFolderGeneric,
|
openFolderGeneric,
|
||||||
debounce
|
debounce
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
currentAvatarThumbnailImageUrl: '',
|
currentAvatarThumbnailImageUrl: '',
|
||||||
date_joined: '',
|
date_joined: '',
|
||||||
developerType: '',
|
developerType: '',
|
||||||
|
discordDetails: {
|
||||||
|
global_name: '',
|
||||||
|
id: ''
|
||||||
|
},
|
||||||
|
discordId: '',
|
||||||
displayName: '',
|
displayName: '',
|
||||||
emailVerified: false,
|
emailVerified: false,
|
||||||
fallbackAvatar: '',
|
fallbackAvatar: '',
|
||||||
@@ -491,6 +496,7 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
currentAvatarThumbnailImageUrl: '',
|
currentAvatarThumbnailImageUrl: '',
|
||||||
date_joined: '',
|
date_joined: '',
|
||||||
developerType: '',
|
developerType: '',
|
||||||
|
discordId: '',
|
||||||
displayName: '',
|
displayName: '',
|
||||||
friendKey: '',
|
friendKey: '',
|
||||||
friendRequestStatus: '',
|
friendRequestStatus: '',
|
||||||
@@ -1836,6 +1842,7 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
currentAvatarThumbnailImageUrl: '',
|
currentAvatarThumbnailImageUrl: '',
|
||||||
date_joined: '',
|
date_joined: '',
|
||||||
developerType: '',
|
developerType: '',
|
||||||
|
discordId: '',
|
||||||
displayName: '',
|
displayName: '',
|
||||||
emailVerified: false,
|
emailVerified: false,
|
||||||
fallbackAvatar: '',
|
fallbackAvatar: '',
|
||||||
@@ -1991,6 +1998,7 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
currentAvatarThumbnailImageUrl: json.currentAvatarThumbnailImageUrl,
|
currentAvatarThumbnailImageUrl: json.currentAvatarThumbnailImageUrl,
|
||||||
date_joined: json.date_joined,
|
date_joined: json.date_joined,
|
||||||
developerType: json.developerType,
|
developerType: json.developerType,
|
||||||
|
discordId: json.discordId,
|
||||||
displayName: json.displayName,
|
displayName: json.displayName,
|
||||||
friendKey: json.friendKey,
|
friendKey: json.friendKey,
|
||||||
// json.friendRequestStatus - missing from currentUser
|
// json.friendRequestStatus - missing from currentUser
|
||||||
|
|||||||
Vendored
+1
@@ -133,6 +133,7 @@ interface GetUserResponse {
|
|||||||
currentAvatarThumbnailImageUrl: string;
|
currentAvatarThumbnailImageUrl: string;
|
||||||
date_joined: string;
|
date_joined: string;
|
||||||
developerType: string;
|
developerType: string;
|
||||||
|
discordId: string;
|
||||||
displayName: string;
|
displayName: string;
|
||||||
friendKey: string;
|
friendKey: string;
|
||||||
friendRequestStatus?: string;
|
friendRequestStatus?: string;
|
||||||
|
|||||||
Vendored
+1
@@ -191,6 +191,7 @@ declare global {
|
|||||||
// Common Functions
|
// Common Functions
|
||||||
GetColourFromUserID(userId: string): Promise<number>;
|
GetColourFromUserID(userId: string): Promise<number>;
|
||||||
OpenLink(url: string): Promise<void>;
|
OpenLink(url: string): Promise<void>;
|
||||||
|
OpenDiscordProfile(discordId: string): Promise<void>;
|
||||||
GetLaunchCommand(): Promise<string>;
|
GetLaunchCommand(): Promise<string>;
|
||||||
IPCAnnounceStart(): Promise<void>;
|
IPCAnnounceStart(): Promise<void>;
|
||||||
SendIpc(type: string, data: string): Promise<void>;
|
SendIpc(type: string, data: string): Promise<void>;
|
||||||
|
|||||||
Reference in New Issue
Block a user