JSON tab remove VRCX vars

This commit is contained in:
Natsumi
2026-01-12 06:28:42 +13:00
parent ee6529588d
commit d2b3c3be01
7 changed files with 62 additions and 34 deletions

View File

@@ -579,10 +579,10 @@
DropdownMenuTrigger DropdownMenuTrigger
} from '../../ui/dropdown-menu'; } from '../../ui/dropdown-menu';
import { avatarModerationRequest, avatarRequest, favoriteRequest, miscRequest } from '../../../api'; import { avatarModerationRequest, avatarRequest, favoriteRequest, miscRequest } from '../../../api';
import { formatJsonVars, getNextDialogIndex } from '../../../shared/utils/base/ui';
import { AppDebug } from '../../../service/appConfig.js'; import { AppDebug } from '../../../service/appConfig.js';
import { Badge } from '../../ui/badge'; import { Badge } from '../../ui/badge';
import { database } from '../../../service/database'; import { database } from '../../../service/database';
import { getNextDialogIndex } from '../../../shared/utils/base/ui';
import { handleImageUploadInput } from '../../../shared/utils/imageUpload'; import { handleImageUploadInput } from '../../../shared/utils/imageUpload';
const ChangeAvatarImageDialog = defineAsyncComponent(() => import('./ChangeAvatarImageDialog.vue')); const ChangeAvatarImageDialog = defineAsyncComponent(() => import('./ChangeAvatarImageDialog.vue'));
@@ -609,7 +609,7 @@
const changeAvatarImageDialogVisible = ref(false); const changeAvatarImageDialogVisible = ref(false);
const previousImageUrl = ref(''); const previousImageUrl = ref('');
const treeData = ref([]); const treeData = ref({});
const timeSpent = ref(0); const timeSpent = ref(0);
const memo = ref(''); const memo = ref('');
const setAvatarTagsDialog = ref({ const setAvatarTagsDialog = ref({
@@ -703,7 +703,7 @@
function handleDialogOpen() { function handleDialogOpen() {
setAvatarTagsDialog.value.visible = false; setAvatarTagsDialog.value.visible = false;
memo.value = ''; memo.value = '';
treeData.value = []; treeData.value = {};
getAvatarTimeSpent(); getAvatarTimeSpent();
getAvatarMemo(); getAvatarMemo();
} }
@@ -992,10 +992,7 @@
} }
function refreshAvatarDialogTreeData() { function refreshAvatarDialogTreeData() {
treeData.value = { treeData.value = formatJsonVars(avatarDialog.value.ref);
...avatarDialog.value.ref,
_hexDisplayName: textToHex(avatarDialog.value.ref?.displayName)
};
} }
function showSetAvatarTagsDialog(avatarId) { function showSetAvatarTagsDialog(avatarId) {

View File

@@ -1189,9 +1189,9 @@
useLocationStore, useLocationStore,
useUserStore useUserStore
} from '../../../stores'; } from '../../../stores';
import { formatJsonVars, getNextDialogIndex } from '../../../shared/utils/base/ui';
import { groupDialogFilterOptions, groupDialogSortingOptions } from '../../../shared/constants'; import { groupDialogFilterOptions, groupDialogSortingOptions } from '../../../shared/constants';
import { Badge } from '../../ui/badge'; import { Badge } from '../../ui/badge';
import { getNextDialogIndex } from '../../../shared/utils/base/ui';
import { groupRequest } from '../../../api'; import { groupRequest } from '../../../api';
import GroupCalendarEventCard from '../../../views/Tools/components/GroupCalendarEventCard.vue'; import GroupCalendarEventCard from '../../../views/Tools/components/GroupCalendarEventCard.vue';
@@ -1825,8 +1825,7 @@
function refreshGroupDialogTreeData() { function refreshGroupDialogTreeData() {
const D = groupDialog.value; const D = groupDialog.value;
const treeData = { const treeData = {
_hexDisplayName: textToHex(D.ref.displayName), group: formatJsonVars(D.ref),
group: D.ref,
posts: D.posts, posts: D.posts,
instances: D.instances, instances: D.instances,
members: D.members, members: D.members,

View File

@@ -809,9 +809,9 @@
DropdownMenuTrigger DropdownMenuTrigger
} from '../../ui/dropdown-menu'; } from '../../ui/dropdown-menu';
import { favoriteRequest, miscRequest, userRequest, worldRequest } from '../../../api'; import { favoriteRequest, miscRequest, userRequest, worldRequest } from '../../../api';
import { formatJsonVars, getNextDialogIndex } from '../../../shared/utils/base/ui';
import { Badge } from '../../ui/badge'; import { Badge } from '../../ui/badge';
import { database } from '../../../service/database.js'; import { database } from '../../../service/database.js';
import { getNextDialogIndex } from '../../../shared/utils/base/ui';
const NewInstanceDialog = defineAsyncComponent(() => import('../NewInstanceDialog.vue')); const NewInstanceDialog = defineAsyncComponent(() => import('../NewInstanceDialog.vue'));
const PreviousInstancesWorldDialog = defineAsyncComponent( const PreviousInstancesWorldDialog = defineAsyncComponent(
@@ -835,7 +835,7 @@
const { showFullscreenImageDialog } = useGalleryStore(); const { showFullscreenImageDialog } = useGalleryStore();
const { t } = useI18n(); const { t } = useI18n();
const treeData = ref([]); const treeData = ref({});
const worldAllowedDomainsDialog = ref({ const worldAllowedDomainsDialog = ref({
visible: false, visible: false,
worldId: '', worldId: '',
@@ -963,7 +963,7 @@
} }
function handleDialogOpen() { function handleDialogOpen() {
treeData.value = []; treeData.value = {};
} }
function showChangeWorldImageDialog() { function showChangeWorldImageDialog() {
@@ -1305,10 +1305,7 @@
nextTick(() => (D.openFlg = false)); nextTick(() => (D.openFlg = false));
} }
function refreshWorldDialogTreeData() { function refreshWorldDialogTreeData() {
treeData.value = { treeData.value = formatJsonVars(worldDialog.value.ref);
...worldDialog.value.ref,
_hexDisplayName: textToHex(worldDialog.value.ref?.displayName)
};
} }
function copyWorldId() { function copyWorldId() {
navigator.clipboard navigator.clipboard

View File

@@ -4,6 +4,7 @@ import { toast } from 'vue-sonner';
import { THEME_CONFIG } from '../../constants'; import { THEME_CONFIG } from '../../constants';
import { i18n } from '../../../plugin/i18n'; import { i18n } from '../../../plugin/i18n';
import { router } from '../../../plugin/router'; import { router } from '../../../plugin/router';
import { textToHex } from './string';
import { useAppearanceSettingsStore } from '../../../stores'; import { useAppearanceSettingsStore } from '../../../stores';
import configRepository from '../../../service/config.js'; import configRepository from '../../../service/config.js';
@@ -175,8 +176,11 @@ function HSVtoRGB(h, s, v) {
let g = 0; let g = 0;
let b = 0; let b = 0;
if (arguments.length === 1) { if (arguments.length === 1) {
// @ts-ignore
s = h.s; s = h.s;
// @ts-ignore
v = h.v; v = h.v;
// @ts-ignore
h = h.h; h = h.h;
} }
const i = Math.floor(h * 6); const i = Math.floor(h * 6);
@@ -223,12 +227,47 @@ function HSVtoRGB(h, s, v) {
return `#${decColor.toString(16).substr(1)}`; return `#${decColor.toString(16).substr(1)}`;
} }
function formatJsonVars(ref) {
// remove all object keys that start with $
const newRef = { ...ref };
for (const key in newRef) {
if (key.startsWith('$')) {
delete newRef[key];
}
}
// sort keys alphabetically
const sortedKeys = Object.keys(newRef).sort();
const sortedRef = {};
sortedKeys.forEach((key) => {
sortedRef[key] = newRef[key];
});
if ('displayName' in sortedRef) {
// add _hexDisplayName to top
return {
// @ts-ignore
_hexDisplayName: textToHex(sortedRef.displayName),
...sortedRef
};
}
if ('name' in sortedRef) {
// add _hexName to top
return {
// @ts-ignore
_hexName: textToHex(sortedRef.name),
...sortedRef
};
}
return sortedRef;
}
function getNextDialogIndex() { function getNextDialogIndex() {
let z = 2000; let z = 2000;
document.querySelectorAll('.el-overlay,.el-modal-dialog').forEach((v) => { document.querySelectorAll('.el-overlay,.el-modal-dialog').forEach((v) => {
// @ts-ignore
if (v.style.display === 'none') { if (v.style.display === 'none') {
return; return;
} }
// @ts-ignore
const _z = Number(v.style.zIndex) || 0; const _z = Number(v.style.zIndex) || 0;
if (_z > z) { if (_z > z) {
z = _z; z = _z;
@@ -300,6 +339,7 @@ export {
refreshCustomScript, refreshCustomScript,
HueToHex, HueToHex,
HSVtoRGB, HSVtoRGB,
formatJsonVars,
getNextDialogIndex, getNextDialogIndex,
changeHtmlLangAttribute, changeHtmlLangAttribute,
setLoginContainerStyle, setLoginContainerStyle,

View File

@@ -38,7 +38,7 @@ export const useGroupStore = defineStore('Group', () => {
visible: false, visible: false,
loading: false, loading: false,
isGetGroupDialogGroupLoading: false, isGetGroupDialogGroupLoading: false,
treeData: [], treeData: {},
id: '', id: '',
inGroup: false, inGroup: false,
ownerDisplayName: '', ownerDisplayName: '',
@@ -131,7 +131,7 @@ export const useGroupStore = defineStore('Group', () => {
D.id = groupId; D.id = groupId;
D.inGroup = false; D.inGroup = false;
D.ownerDisplayName = ''; D.ownerDisplayName = '';
D.treeData = []; D.treeData = {};
D.announcement = {}; D.announcement = {};
D.posts = []; D.posts = [];
D.postsFiltered = []; D.postsFiltered = [];

View File

@@ -18,8 +18,7 @@ import {
isRealInstance, isRealInstance,
parseLocation, parseLocation,
removeEmojis, removeEmojis,
replaceBioSymbols, replaceBioSymbols
textToHex
} from '../shared/utils'; } from '../shared/utils';
import { import {
avatarRequest, avatarRequest,
@@ -30,6 +29,7 @@ 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';
@@ -229,7 +229,7 @@ export const useUserStore = defineStore('User', () => {
}, },
avatarSorting: 'update', avatarSorting: 'update',
avatarReleaseStatus: 'all', avatarReleaseStatus: 'all',
treeData: [], treeData: {},
memo: '', memo: '',
$avatarInfo: { $avatarInfo: {
ownerId: '', ownerId: '',
@@ -768,7 +768,7 @@ export const useUserStore = defineStore('User', () => {
} }
const D = userDialog.value; const D = userDialog.value;
D.id = userId; D.id = userId;
D.treeData = []; D.treeData = {};
D.memo = ''; D.memo = '';
D.note = ''; D.note = '';
getUserMemo(userId).then((memo) => { getUserMemo(userId).then((memo) => {
@@ -1224,18 +1224,13 @@ export const useUserStore = defineStore('User', () => {
function refreshUserDialogTreeData() { function refreshUserDialogTreeData() {
const D = userDialog.value; const D = userDialog.value;
if (D.id === currentUser.value.id) { if (D.id === currentUser.value.id) {
const treeData = { D.treeData = formatJsonVars({
...currentUser.value, ...currentUser.value,
...D.ref, ...D.ref
_hexDisplayName: textToHex(D.ref?.displayName) });
};
D.treeData = treeData;
return; return;
} }
D.treeData = { D.treeData = formatJsonVars(D.ref);
...D.ref,
_hexDisplayName: textToHex(D.ref?.displayName)
};
} }
async function lookupUser(ref) { async function lookupUser(ref) {

View File

@@ -36,7 +36,7 @@ export const useWorldStore = defineStore('World', () => {
avatarScalingDisabled: false, avatarScalingDisabled: false,
focusViewDisabled: false, focusViewDisabled: false,
rooms: [], rooms: [],
treeData: [], treeData: {},
bundleSizes: [], bundleSizes: [],
lastUpdated: '', lastUpdated: '',
inCache: false, inCache: false,
@@ -78,7 +78,7 @@ export const useWorldStore = defineStore('World', () => {
L.shortName = shortName; L.shortName = shortName;
D.id = L.worldId; D.id = L.worldId;
D.$location = L; D.$location = L;
D.treeData = []; D.treeData = {};
D.bundleSizes = []; D.bundleSizes = [];
D.lastUpdated = ''; D.lastUpdated = '';
D.visible = true; D.visible = true;