Clean up treeData

This commit is contained in:
Natsumi
2026-01-25 02:21:21 +13:00
committed by pa
parent e22f214210
commit f840dabe43
5 changed files with 23 additions and 31 deletions
+3 -2
View File
@@ -34,6 +34,7 @@ namespace VRCX
public bool VrcClosedGracefully; public bool VrcClosedGracefully;
private readonly ConcurrentQueue<string> m_LogQueue = new ConcurrentQueue<string>(); // for electron private readonly ConcurrentQueue<string> m_LogQueue = new ConcurrentQueue<string>(); // for electron
private static readonly Regex CleanId = new("[^a-zA-Z0-9_\\-~:()]", RegexOptions.Compiled); private static readonly Regex CleanId = new("[^a-zA-Z0-9_\\-~:()]", RegexOptions.Compiled);
private static readonly Regex CleanLocation = new("[/]", RegexOptions.Compiled);
// NOTE // NOTE
// FileSystemWatcher() is unreliable // FileSystemWatcher() is unreliable
@@ -373,7 +374,7 @@ namespace VRCX
return true; return true;
var location = line.Substring(lineOffset); var location = line.Substring(lineOffset);
location = CleanId.Replace(location, string.Empty); location = CleanLocation.Replace(location, string.Empty);
AppendLog(new[] AppendLog(new[]
{ {
@@ -451,7 +452,7 @@ namespace VRCX
return true; return true;
var locationDestination = line.Substring(lineOffset); var locationDestination = line.Substring(lineOffset);
logContext.LocationDestination = CleanId.Replace(locationDestination, string.Empty); logContext.LocationDestination = CleanLocation.Replace(locationDestination, string.Empty);
return true; return true;
} }
@@ -1106,8 +1106,8 @@
<Download /> <Download />
</Button> </Button>
<vue-json-pretty <vue-json-pretty
:key="groupDialog.treeData?.group?.id" :key="treeData?.group?.id"
:data="groupDialog.treeData" :data="treeData"
:deep="2" :deep="2"
:theme="isDarkMode ? 'dark' : 'light'" :theme="isDarkMode ? 'dark' : 'light'"
show-icon /> show-icon />
@@ -1242,6 +1242,7 @@
const groupDialogGalleryCurrentName = ref('0'); const groupDialogGalleryCurrentName = ref('0');
const groupDialogTabCurrentName = ref('0'); const groupDialogTabCurrentName = ref('0');
const isGroupGalleryLoading = ref(false); const isGroupGalleryLoading = ref(false);
const treeData = ref({});
const groupDialogMemberSortValue = computed({ const groupDialogMemberSortValue = computed({
get() { get() {
@@ -1817,17 +1818,13 @@
function refreshGroupDialogTreeData() { function refreshGroupDialogTreeData() {
const D = groupDialog.value; const D = groupDialog.value;
const treeData = { treeData.value = {
group: formatJsonVars(D.ref), group: formatJsonVars(D.ref),
posts: D.posts, posts: D.posts,
instances: D.instances, instances: D.instances,
members: D.members, members: D.members,
galleries: D.galleries galleries: D.galleries
}; };
updateGroupDialogData({
...groupDialog.value,
treeData
});
} }
async function loadAllGroupMembers() { async function loadAllGroupMembers() {
@@ -1191,8 +1191,8 @@
<Download /> <Download />
</Button> </Button>
<vue-json-pretty <vue-json-pretty
:key="userDialog.treeData?.id" :key="treeData?.id"
:data="userDialog.treeData" :data="treeData"
:deep="2" :deep="2"
:theme="isDarkMode ? 'dark' : 'light'" :theme="isDarkMode ? 'dark' : 'light'"
show-icon /> show-icon />
@@ -1313,6 +1313,7 @@
import InstanceActionBar from '../../InstanceActionBar.vue'; import InstanceActionBar from '../../InstanceActionBar.vue';
import SendInviteDialog from '../InviteDialog/SendInviteDialog.vue'; import SendInviteDialog from '../InviteDialog/SendInviteDialog.vue';
import UserSummaryHeader from './UserSummaryHeader.vue'; import UserSummaryHeader from './UserSummaryHeader.vue';
import { formatJsonVars } from '../../../shared/utils/base/ui';
const BioDialog = defineAsyncComponent(() => import('./BioDialog.vue')); const BioDialog = defineAsyncComponent(() => import('./BioDialog.vue'));
const LanguageDialog = defineAsyncComponent(() => import('./LanguageDialog.vue')); const LanguageDialog = defineAsyncComponent(() => import('./LanguageDialog.vue'));
@@ -1357,7 +1358,6 @@
showUserDialog, showUserDialog,
sortUserDialogAvatars, sortUserDialogAvatars,
refreshUserDialogAvatars, refreshUserDialogAvatars,
refreshUserDialogTreeData,
showSendBoopDialog, showSendBoopDialog,
toggleSharedConnectionsOptOut toggleSharedConnectionsOptOut
} = useUserStore(); } = useUserStore();
@@ -1466,6 +1466,7 @@
const isEditNoteAndMemoDialogVisible = ref(false); const isEditNoteAndMemoDialogVisible = ref(false);
const vrchatCredit = ref(null); const vrchatCredit = ref(null);
const mutualFriendsError = ref(false); const mutualFriendsError = ref(false);
const treeData = ref({});
const userDialogAvatars = computed(() => { const userDialogAvatars = computed(() => {
const { avatars, avatarReleaseStatus } = userDialog.value; const { avatars, avatarReleaseStatus } = userDialog.value;
@@ -1518,6 +1519,18 @@
return t('dialog.user.status.offline'); return t('dialog.user.status.offline');
} }
function refreshUserDialogTreeData() {
const D = userDialog.value;
if (D.id === currentUser.value.id) {
treeData.value = formatJsonVars({
...currentUser.value,
...D.ref
});
return;
}
treeData.value = formatJsonVars(D.ref);
}
function handleUserDialogTab(tabName) { function handleUserDialogTab(tabName) {
userDialog.value.lastActiveTab = tabName; userDialog.value.lastActiveTab = tabName;
const userId = userDialog.value.id; const userId = userDialog.value.id;
-2
View File
@@ -49,7 +49,6 @@ export const useGroupStore = defineStore('Group', () => {
activeTab: 'Info', activeTab: 'Info',
lastActiveTab: 'Info', lastActiveTab: 'Info',
isGetGroupDialogGroupLoading: false, isGetGroupDialogGroupLoading: false,
treeData: {},
id: '', id: '',
inGroup: false, inGroup: false,
ownerDisplayName: '', ownerDisplayName: '',
@@ -147,7 +146,6 @@ export const useGroupStore = defineStore('Group', () => {
D.id = groupId; D.id = groupId;
D.inGroup = false; D.inGroup = false;
D.ownerDisplayName = ''; D.ownerDisplayName = '';
D.treeData = {};
D.announcement = {}; D.announcement = {};
D.posts = []; D.posts = [];
D.postsFiltered = []; D.postsFiltered = [];
-17
View File
@@ -31,7 +31,6 @@ import {
import { processBulk, request } from '../service/request'; import { processBulk, request } from '../service/request';
import { AppDebug } from '../service/appConfig'; import { AppDebug } from '../service/appConfig';
import { database } from '../service/database'; import { database } from '../service/database';
import { formatJsonVars } from '../shared/utils/base/ui';
import { useAppearanceSettingsStore } from './settings/appearance'; import { useAppearanceSettingsStore } from './settings/appearance';
import { useAuthStore } from './auth'; import { useAuthStore } from './auth';
import { useAvatarStore } from './avatar'; import { useAvatarStore } from './avatar';
@@ -236,7 +235,6 @@ export const useUserStore = defineStore('User', () => {
}, },
avatarSorting: 'update', avatarSorting: 'update',
avatarReleaseStatus: 'all', avatarReleaseStatus: 'all',
treeData: {},
memo: '', memo: '',
$avatarInfo: { $avatarInfo: {
ownerId: '', ownerId: '',
@@ -732,8 +730,6 @@ export const useUserStore = defineStore('User', () => {
} else if (D.ref.friendRequestStatus === 'outgoing') { } else if (D.ref.friendRequestStatus === 'outgoing') {
D.outgoingRequest = true; D.outgoingRequest = true;
} }
// refresh user dialog JSON tab
refreshUserDialogTreeData();
} }
if (hasPropChanged) { if (hasPropChanged) {
if ( if (
@@ -1239,18 +1235,6 @@ export const useUserStore = defineStore('User', () => {
}); });
} }
function refreshUserDialogTreeData() {
const D = userDialog.value;
if (D.id === currentUser.value.id) {
D.treeData = formatJsonVars({
...currentUser.value,
...D.ref
});
return;
}
D.treeData = formatJsonVars(D.ref);
}
async function lookupUser(ref) { async function lookupUser(ref) {
let ctx; let ctx;
if (ref.userId) { if (ref.userId) {
@@ -2064,7 +2048,6 @@ export const useUserStore = defineStore('User', () => {
applyUserDialogLocation, applyUserDialogLocation,
sortUserDialogAvatars, sortUserDialogAvatars,
refreshUserDialogAvatars, refreshUserDialogAvatars,
refreshUserDialogTreeData,
lookupUser, lookupUser,
updateAutoStateChange, updateAutoStateChange,
addCustomTag, addCustomTag,