refactor: use setter functions for dialog visibility and favorite status in stores

This commit is contained in:
pa
2026-03-08 20:58:33 +09:00
parent ae0152c28e
commit c55d5f0ec7
19 changed files with 376 additions and 102 deletions

View File

@@ -1,5 +1,5 @@
import { createApp } from 'vue';
import { VueQueryPlugin } from '@tanstack/vue-query'; import { VueQueryPlugin } from '@tanstack/vue-query';
import { createApp } from 'vue';
import { import {
i18n, i18n,

View File

@@ -174,11 +174,11 @@ export const useAuthStore = defineStore('Auth', () => {
}) })
}).show(); }).show();
} }
userStore.userDialog.visible = false; userStore.setUserDialogVisible(false);
watchState.isLoggedIn = false; watchState.isLoggedIn = false;
watchState.isFriendsLoaded = false; watchState.isFriendsLoaded = false;
watchState.isFavoritesLoaded = false; watchState.isFavoritesLoaded = false;
notificationStore.notificationInitStatus = false; notificationStore.setNotificationInitStatus(false);
await updateStoredUser(userStore.currentUser); await updateStoredUser(userStore.currentUser);
webApiService.clearCookies(); webApiService.clearCookies();
loginForm.value.lastUserLoggedIn = ''; loginForm.value.lastUserLoggedIn = '';
@@ -222,7 +222,7 @@ export const useAuthStore = defineStore('Auth', () => {
loginForm.value.loading = false; loginForm.value.loading = false;
}) })
.catch((err) => { .catch((err) => {
updateLoopStore.nextCurrentUserRefresh = 60; // 1min updateLoopStore.setNextCurrentUserRefresh(60); // 1min
console.error(err); console.error(err);
}); });
}); });
@@ -275,8 +275,9 @@ export const useAuthStore = defineStore('Auth', () => {
* *
*/ */
function enablePrimaryPasswordChange() { function enablePrimaryPasswordChange() {
advancedSettingsStore.enablePrimaryPassword = advancedSettingsStore.setEnablePrimaryPassword(
!advancedSettingsStore.enablePrimaryPassword; !advancedSettingsStore.enablePrimaryPassword
);
enablePrimaryPasswordDialog.value.password = ''; enablePrimaryPasswordDialog.value.password = '';
enablePrimaryPasswordDialog.value.rePassword = ''; enablePrimaryPasswordDialog.value.rePassword = '';
@@ -292,7 +293,7 @@ export const useAuthStore = defineStore('Auth', () => {
}) })
.then(async ({ ok, value }) => { .then(async ({ ok, value }) => {
if (!ok) { if (!ok) {
advancedSettingsStore.enablePrimaryPassword = true; advancedSettingsStore.setEnablePrimaryPassword(true);
advancedSettingsStore.setEnablePrimaryPasswordConfigRepository( advancedSettingsStore.setEnablePrimaryPasswordConfigRepository(
true true
); );
@@ -327,7 +328,9 @@ export const useAuthStore = defineStore('Auth', () => {
); );
}) })
.catch(async () => { .catch(async () => {
advancedSettingsStore.enablePrimaryPassword = true; advancedSettingsStore.setEnablePrimaryPassword(
true
);
advancedSettingsStore.setEnablePrimaryPasswordConfigRepository( advancedSettingsStore.setEnablePrimaryPasswordConfigRepository(
true true
); );
@@ -336,7 +339,7 @@ export const useAuthStore = defineStore('Auth', () => {
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);
advancedSettingsStore.enablePrimaryPassword = true; advancedSettingsStore.setEnablePrimaryPassword(true);
advancedSettingsStore.setEnablePrimaryPasswordConfigRepository( advancedSettingsStore.setEnablePrimaryPasswordConfigRepository(
true true
); );
@@ -547,7 +550,7 @@ export const useAuthStore = defineStore('Auth', () => {
delete savedCredentials[userId]; delete savedCredentials[userId];
// Disable primary password when no account is available. // Disable primary password when no account is available.
if (Object.keys(savedCredentials).length === 0) { if (Object.keys(savedCredentials).length === 0) {
advancedSettingsStore.enablePrimaryPassword = false; advancedSettingsStore.setEnablePrimaryPassword(false);
advancedSettingsStore.setEnablePrimaryPasswordConfigRepository( advancedSettingsStore.setEnablePrimaryPasswordConfigRepository(
false false
); );
@@ -845,7 +848,7 @@ export const useAuthStore = defineStore('Auth', () => {
} else if (json.requiresTwoFactorAuth) { } else if (json.requiresTwoFactorAuth) {
promptTOTP(); promptTOTP();
} else { } else {
updateLoopStore.nextCurrentUserRefresh = 420; // 7mins updateLoopStore.setNextCurrentUserRefresh(420); // 7mins
userStore.applyCurrentUser(json); userStore.applyCurrentUser(json);
initWebsocket(); initWebsocket();
} }
@@ -961,6 +964,15 @@ export const useAuthStore = defineStore('Auth', () => {
AppApi.CheckGameRunning(); // restore state from hot-reload AppApi.CheckGameRunning(); // restore state from hot-reload
} }
function setCachedConfig(value) {
cachedConfig.value = value;
state.cachedConfig = value;
}
function setAttemptingAutoLogin(value) {
attemptingAutoLogin.value = value;
}
return { return {
state, state,
@@ -989,6 +1001,8 @@ export const useAuthStore = defineStore('Auth', () => {
handleLogoutEvent, handleLogoutEvent,
handleCurrentUserUpdate, handleCurrentUserUpdate,
loginComplete, loginComplete,
getAllSavedCredentials getAllSavedCredentials,
setCachedConfig,
setAttemptingAutoLogin
}; };
}); });

View File

@@ -249,6 +249,20 @@ export const useAvatarStore = defineStore('Avatar', () => {
avatarDialog.value.loading = value; avatarDialog.value.loading = value;
} }
/**
* @param {boolean} value
*/
function setAvatarDialogVisible(value) {
avatarDialog.value.visible = value;
}
/**
* @param {boolean} value
*/
function setAvatarDialogIsFavorite(value) {
avatarDialog.value.isFavorite = value;
}
/** /**
* *
* @param {string} avatarId * @param {string} avatarId
@@ -812,6 +826,8 @@ export const useAvatarStore = defineStore('Avatar', () => {
lookupAvatars, lookupAvatars,
selectAvatarWithConfirmation, selectAvatarWithConfirmation,
selectAvatarWithoutConfirmation, selectAvatarWithoutConfirmation,
setAvatarDialogVisible,
setAvatarDialogIsFavorite,
setAvatarDialogLoading, setAvatarDialogLoading,
showAvatarAuthorDialog, showAvatarAuthorDialog,
addAvatarWearTime, addAvatarWearTime,

View File

@@ -339,15 +339,15 @@ export const useFavoriteStore = defineStore('Favorite', () => {
const { ref } = args; const { ref } = args;
const userDialog = userStore.userDialog; const userDialog = userStore.userDialog;
if (userDialog.visible && ref.favoriteId === userDialog.id) { if (userDialog.visible && ref.favoriteId === userDialog.id) {
userDialog.isFavorite = true; userStore.setUserDialogIsFavorite(true);
} }
const worldDialog = worldStore.worldDialog; const worldDialog = worldStore.worldDialog;
if (worldDialog.visible && ref.favoriteId === worldDialog.id) { if (worldDialog.visible && ref.favoriteId === worldDialog.id) {
worldDialog.isFavorite = true; worldStore.setWorldDialogIsFavorite(true);
} }
const avatarDialog = avatarStore.avatarDialog; const avatarDialog = avatarStore.avatarDialog;
if (avatarDialog.visible && ref.favoriteId === avatarDialog.id) { if (avatarDialog.visible && ref.favoriteId === avatarDialog.id) {
avatarDialog.isFavorite = true; avatarStore.setAvatarDialogIsFavorite(true);
} }
} }
@@ -432,17 +432,17 @@ export const useFavoriteStore = defineStore('Favorite', () => {
friendStore.updateSidebarFavorites(); friendStore.updateSidebarFavorites();
const userDialog = userStore.userDialog; const userDialog = userStore.userDialog;
if (userDialog.visible && userDialog.id === ref.favoriteId) { if (userDialog.visible && userDialog.id === ref.favoriteId) {
userDialog.isFavorite = false; userStore.setUserDialogIsFavorite(false);
} }
const worldDialog = worldStore.worldDialog; const worldDialog = worldStore.worldDialog;
if (worldDialog.visible && worldDialog.id === ref.favoriteId) { if (worldDialog.visible && worldDialog.id === ref.favoriteId) {
worldDialog.isFavorite = localWorldFavoritesList.value.includes( worldStore.setWorldDialogIsFavorite(
worldDialog.id localWorldFavoritesList.value.includes(worldDialog.id)
); );
} }
const avatarDialog = avatarStore.avatarDialog; const avatarDialog = avatarStore.avatarDialog;
if (avatarDialog.visible && avatarDialog.id === ref.favoriteId) { if (avatarDialog.visible && avatarDialog.id === ref.favoriteId) {
avatarDialog.isFavorite = false; avatarStore.setAvatarDialogIsFavorite(false);
} }
countFavoriteGroups(); countFavoriteGroups();
} }
@@ -949,6 +949,27 @@ export const useFavoriteStore = defineStore('Favorite', () => {
friendImportDialogVisible.value = true; friendImportDialogVisible.value = true;
} }
/**
* @param {string} value
*/
function setAvatarImportDialogInput(value) {
avatarImportDialogInput.value = value;
}
/**
* @param {string} value
*/
function setWorldImportDialogInput(value) {
worldImportDialogInput.value = value;
}
/**
* @param {string} value
*/
function setFriendImportDialogInput(value) {
friendImportDialogInput.value = value;
}
/** /**
* *
* @param {string} worldId * @param {string} worldId
@@ -979,7 +1000,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
worldStore.worldDialog.visible && worldStore.worldDialog.visible &&
worldStore.worldDialog.id === worldId worldStore.worldDialog.id === worldId
) { ) {
worldStore.worldDialog.isFavorite = true; worldStore.setWorldDialogIsFavorite(true);
} }
// update UI // update UI
@@ -1034,7 +1055,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
avatarStore.avatarDialog.visible && avatarStore.avatarDialog.visible &&
avatarStore.avatarDialog.id === avatarId avatarStore.avatarDialog.id === avatarId
) { ) {
avatarStore.avatarDialog.isFavorite = true; avatarStore.setAvatarDialogIsFavorite(true);
} }
// update UI // update UI
@@ -1302,8 +1323,9 @@ export const useFavoriteStore = defineStore('Favorite', () => {
avatarStore.avatarDialog.visible && avatarStore.avatarDialog.visible &&
avatarStore.avatarDialog.id === avatarId avatarStore.avatarDialog.id === avatarId
) { ) {
avatarStore.avatarDialog.isFavorite = avatarStore.setAvatarDialogIsFavorite(
getCachedFavoritesByObjectId(avatarId); getCachedFavoritesByObjectId(avatarId)
);
} }
// update UI // update UI
@@ -1519,8 +1541,9 @@ export const useFavoriteStore = defineStore('Favorite', () => {
worldStore.worldDialog.visible && worldStore.worldDialog.visible &&
worldStore.worldDialog.id === worldId worldStore.worldDialog.id === worldId
) { ) {
worldStore.worldDialog.isFavorite = worldStore.setWorldDialogIsFavorite(
getCachedFavoritesByObjectId(worldId); getCachedFavoritesByObjectId(worldId)
);
} }
// update UI // update UI
@@ -1614,7 +1637,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
} }
const userDialog = userStore.userDialog; const userDialog = userStore.userDialog;
if (userDialog.visible && userDialog.id === userId) { if (userDialog.visible && userDialog.id === userId) {
userDialog.isFavorite = true; userStore.setUserDialogIsFavorite(true);
} }
friendStore.updateLocalFavoriteFriends(); friendStore.updateLocalFavoriteFriends();
} }
@@ -1667,9 +1690,10 @@ export const useFavoriteStore = defineStore('Favorite', () => {
} }
const userDialog = userStore.userDialog; const userDialog = userStore.userDialog;
if (userDialog.visible && userDialog.id === userId) { if (userDialog.visible && userDialog.id === userId) {
userDialog.isFavorite = userStore.setUserDialogIsFavorite(
getCachedFavoritesByObjectId(userId) || getCachedFavoritesByObjectId(userId) ||
isInAnyLocalFriendGroup(userId); isInAnyLocalFriendGroup(userId)
);
} }
friendStore.updateLocalFavoriteFriends(); friendStore.updateLocalFavoriteFriends();
} }
@@ -1865,6 +1889,9 @@ export const useFavoriteStore = defineStore('Favorite', () => {
showWorldImportDialog, showWorldImportDialog,
showAvatarImportDialog, showAvatarImportDialog,
showFriendImportDialog, showFriendImportDialog,
setAvatarImportDialogInput,
setWorldImportDialogInput,
setFriendImportDialogInput,
addLocalWorldFavorite, addLocalWorldFavorite,
hasLocalWorldFavorite, hasLocalWorldFavorite,
hasLocalAvatarFavorite, hasLocalAvatarFavorite,

View File

@@ -155,27 +155,23 @@ export const useGameStore = defineStore('Game', () => {
if (isGameRunningArg !== isGameRunning.value) { if (isGameRunningArg !== isGameRunning.value) {
isGameRunning.value = isGameRunningArg; isGameRunning.value = isGameRunningArg;
if (isGameRunningArg) { if (isGameRunningArg) {
userStore.currentUser.$online_for = Date.now(); userStore.markCurrentUserGameStarted();
userStore.currentUser.$offline_for = '';
userStore.currentUser.$previousAvatarSwapTime = Date.now();
} else { } else {
await configRepository.setBool('isGameNoVR', isGameNoVR.value); await configRepository.setBool('isGameNoVR', isGameNoVR.value);
userStore.currentUser.$online_for = 0; userStore.markCurrentUserGameStopped();
userStore.currentUser.$offline_for = Date.now();
instanceStore.removeAllQueuedInstances(); instanceStore.removeAllQueuedInstances();
autoVRChatCacheManagement(); autoVRChatCacheManagement();
checkIfGameCrashed(); checkIfGameCrashed();
updateLoopStore.ipcTimeout = 0; updateLoopStore.setIpcTimeout(0);
avatarStore.addAvatarWearTime( avatarStore.addAvatarWearTime(
userStore.currentUser.currentAvatar userStore.currentUser.currentAvatar
); );
userStore.currentUser.$previousAvatarSwapTime = null;
} }
locationStore.lastLocationReset(); locationStore.lastLocationReset();
gameLogStore.clearNowPlaying(); gameLogStore.clearNowPlaying();
vrStore.updateVRLastLocation(); vrStore.updateVRLastLocation();
workerTimers.setTimeout(() => checkVRChatDebugLogging(), 60000); workerTimers.setTimeout(() => checkVRChatDebugLogging(), 60000);
updateLoopStore.nextDiscordUpdate = 0; updateLoopStore.setNextDiscordUpdate(0);
console.log(new Date(), 'isGameRunning', isGameRunningArg); console.log(new Date(), 'isGameRunning', isGameRunningArg);
} }
@@ -194,6 +190,13 @@ export const useGameStore = defineStore('Game', () => {
} }
} }
/**
* @param {boolean} value
*/
function setIsGameNoVR(value) {
isGameNoVR.value = value;
}
async function checkVRChatDebugLogging() { async function checkVRChatDebugLogging() {
if (advancedSettingsStore.gameLogDisabled) { if (advancedSettingsStore.gameLogDisabled) {
return; return;
@@ -260,6 +263,7 @@ export const useGameStore = defineStore('Game', () => {
sweepVRChatCache, sweepVRChatCache,
getVRChatCacheSize, getVRChatCacheSize,
updateIsGameRunning, updateIsGameRunning,
setIsGameNoVR,
getVRChatRegistryKey, getVRChatRegistryKey,
checkVRChatDebugLogging, checkVRChatDebugLogging,
updateIsHmdAfk updateIsHmdAfk

View File

@@ -202,6 +202,11 @@ export const useGameLogStore = defineStore('GameLog', () => {
vrStore.updateVrNowPlaying(); vrStore.updateVrNowPlaying();
} }
function resetLastMediaUrls() {
lastVideoUrl.value = '';
lastResourceloadUrl.value = '';
}
/** /**
* *
* @param data * @param data
@@ -317,13 +322,13 @@ export const useGameLogStore = defineStore('GameLog', () => {
for (i = data.length - 1; i > -1; i--) { for (i = data.length - 1; i > -1; i--) {
ctx = data[i]; ctx = data[i];
if (ctx.type === 'Location') { if (ctx.type === 'Location') {
locationStore.lastLocation = { locationStore.setLastLocation({
date: Date.parse(ctx.created_at), date: Date.parse(ctx.created_at),
location: ctx.location, location: ctx.location,
name: ctx.worldName, name: ctx.worldName,
playerList: new Map(), playerList: new Map(),
friendList: new Map() friendList: new Map()
}; });
length = i; length = i;
break; break;
} }
@@ -556,10 +561,10 @@ export const useGameLogStore = defineStore('GameLog', () => {
location: gameLog.location location: gameLog.location
}); });
locationStore.lastLocationReset(gameLog.dt); locationStore.lastLocationReset(gameLog.dt);
locationStore.lastLocation.location = 'traveling'; locationStore.setLastLocationLocation('traveling');
locationStore.lastLocationDestination = gameLog.location; locationStore.setLastLocationDestination(gameLog.location);
locationStore.lastLocationDestinationTime = Date.parse( locationStore.setLastLocationDestinationTime(
gameLog.dt Date.parse(gameLog.dt)
); );
state.lastLocationAvatarList.clear(); state.lastLocationAvatarList.clear();
instanceStore.removeQueuedInstance(gameLog.location); instanceStore.removeQueuedInstance(gameLog.location);
@@ -580,13 +585,13 @@ export const useGameLogStore = defineStore('GameLog', () => {
if (gameStore.isGameRunning) { if (gameStore.isGameRunning) {
locationStore.lastLocationReset(gameLog.dt); locationStore.lastLocationReset(gameLog.dt);
clearNowPlaying(); clearNowPlaying();
locationStore.lastLocation = { locationStore.setLastLocation({
date: Date.parse(gameLog.dt), date: Date.parse(gameLog.dt),
location: gameLog.location, location: gameLog.location,
name: worldName, name: worldName,
playerList: new Map(), playerList: new Map(),
friendList: new Map() friendList: new Map()
}; });
instanceStore.removeQueuedInstance(gameLog.location); instanceStore.removeQueuedInstance(gameLog.location);
locationStore.updateCurrentUserLocation(); locationStore.updateCurrentUserLocation();
vrStore.updateVRLastLocation(); vrStore.updateVRLastLocation();
@@ -881,12 +886,12 @@ export const useGameLogStore = defineStore('GameLog', () => {
} }
break; break;
case 'openvr-init': case 'openvr-init':
gameStore.isGameNoVR = false; gameStore.setIsGameNoVR(false);
configRepository.setBool('isGameNoVR', gameStore.isGameNoVR); configRepository.setBool('isGameNoVR', gameStore.isGameNoVR);
vrStore.updateOpenVR(); vrStore.updateOpenVR();
break; break;
case 'desktop-mode': case 'desktop-mode':
gameStore.isGameNoVR = true; gameStore.setIsGameNoVR(true);
configRepository.setBool('isGameNoVR', gameStore.isGameNoVR); configRepository.setBool('isGameNoVR', gameStore.isGameNoVR);
vrStore.updateOpenVR(); vrStore.updateOpenVR();
break; break;
@@ -1021,6 +1026,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
lastResourceloadUrl, lastResourceloadUrl,
clearNowPlaying, clearNowPlaying,
resetLastMediaUrls,
tryLoadPlayerList, tryLoadPlayerList,
gameLogIsFriend, gameLogIsFriend,
gameLogIsFavorite, gameLogIsFavorite,

View File

@@ -966,6 +966,13 @@ export const useGroupStore = defineStore('Group', () => {
groupInstances.value = []; groupInstances.value = [];
} }
/**
* @param {boolean} value
*/
function setGroupDialogVisible(value) {
groupDialog.value.visible = value;
}
/** /**
* *
* @param {object} json * @param {object} json
@@ -1202,6 +1209,7 @@ export const useGroupStore = defineStore('Group', () => {
handleGroupPost, handleGroupPost,
handleGroupUserInstances, handleGroupUserInstances,
clearGroupInstances, clearGroupInstances,
setGroupDialogVisible,
handleGroupMember, handleGroupMember,
handleGroupPermissions, handleGroupPermissions,
handleGroupMemberProps, handleGroupMemberProps,

View File

@@ -223,6 +223,20 @@ export const useInstanceStore = defineStore('Instance', () => {
previousInstancesListDialog.value.visible = false; previousInstancesListDialog.value.visible = false;
} }
/**
* @param {boolean} value
*/
function setPreviousInstancesInfoDialogVisible(value) {
previousInstancesInfoDialog.value.visible = value;
}
/**
* @param {boolean} value
*/
function setPreviousInstancesListDialogVisible(value) {
previousInstancesListDialog.value.visible = value;
}
/** /**
* *
* @param input * @param input
@@ -1438,6 +1452,8 @@ export const useInstanceStore = defineStore('Instance', () => {
instanceQueueReady, instanceQueueReady,
instanceQueueUpdate, instanceQueueUpdate,
hidePreviousInstancesDialogs, hidePreviousInstancesDialogs,
setPreviousInstancesInfoDialogVisible,
setPreviousInstancesListDialogVisible,
showPreviousInstancesInfoDialog, showPreviousInstancesInfoDialog,
showPreviousInstancesListDialog, showPreviousInstancesListDialog,
addInstanceJoinHistory, addInstanceJoinHistory,

View File

@@ -78,16 +78,14 @@ export const useLocationStore = defineStore('Location', () => {
} else { } else {
ref.$location_at = lastLocation.value.date; ref.$location_at = lastLocation.value.date;
ref.$travelingToTime = lastLocationDestinationTime.value; ref.$travelingToTime = lastLocationDestinationTime.value;
userStore.currentUser.$travelingToTime = userStore.setCurrentUserTravelingToTime(
lastLocationDestinationTime.value; lastLocationDestinationTime.value
);
} }
} }
async function setCurrentUserLocation(location, travelingToLocation) { async function setCurrentUserLocation(location, travelingToLocation) {
userStore.currentUser.$location_at = Date.now(); userStore.setCurrentUserLocationState(location, travelingToLocation);
userStore.currentUser.$travelingToTime = Date.now();
userStore.currentUser.$locationTag = location;
userStore.currentUser.$travelingToLocation = travelingToLocation;
updateCurrentUserLocation(); updateCurrentUserLocation();
// janky gameLog support for Quest // janky gameLog support for Quest
@@ -144,25 +142,7 @@ export const useLocationStore = defineStore('Location', () => {
dateTime = new Date().toJSON(); dateTime = new Date().toJSON();
} }
const dateTimeStamp = Date.parse(dateTime); const dateTimeStamp = Date.parse(dateTime);
photonStore.photonLobby = new Map(); photonStore.resetLocationPhotonState();
photonStore.photonLobbyCurrent = new Map();
photonStore.photonLobbyMaster = 0;
photonStore.photonLobbyCurrentUser = 0;
photonStore.photonLobbyUserData = new Map();
photonStore.photonLobbyWatcherLoopStop();
photonStore.photonLobbyAvatars = new Map();
photonStore.photonLobbyLastModeration = new Map();
photonStore.photonLobbyJointime = new Map();
photonStore.photonLobbyActivePortals = new Map();
photonStore.photonEvent7List = new Map();
photonStore.photonLastEvent7List = 0;
photonStore.photonLastChatBoxMsg = new Map();
photonStore.moderationEventQueue = new Map();
if (photonStore.photonEventTable.data.length > 0) {
photonStore.photonEventTablePrevious.data =
photonStore.photonEventTable.data;
photonStore.photonEventTable.data = [];
}
const playerList = Array.from(lastLocation.value.playerList.values()); const playerList = Array.from(lastLocation.value.playerList.values());
const dataBaseEntries = []; const dataBaseEntries = [];
for (const ref of playerList) { for (const ref of playerList) {
@@ -198,19 +178,50 @@ export const useLocationStore = defineStore('Location', () => {
instanceStore.updateCurrentInstanceWorld(); instanceStore.updateCurrentInstanceWorld();
vrStore.updateVRLastLocation(); vrStore.updateVRLastLocation();
instanceStore.getCurrentInstanceUserList(); instanceStore.getCurrentInstanceUserList();
gameLogStore.lastVideoUrl = ''; gameLogStore.resetLastMediaUrls();
gameLogStore.lastResourceloadUrl = '';
userStore.applyUserDialogLocation(); userStore.applyUserDialogLocation();
instanceStore.applyWorldDialogInstances(); instanceStore.applyWorldDialogInstances();
instanceStore.applyGroupDialogInstances(); instanceStore.applyGroupDialogInstances();
} }
/**
* @param {{date: number|null, location: string, name: string, playerList: Map<any, any>, friendList: Map<any, any>}} value
*/
function setLastLocation(value) {
lastLocation.value = value;
}
/**
* @param {string} value
*/
function setLastLocationLocation(value) {
lastLocation.value.location = value;
}
/**
* @param {string} value
*/
function setLastLocationDestination(value) {
lastLocationDestination.value = value;
}
/**
* @param {number} value
*/
function setLastLocationDestinationTime(value) {
lastLocationDestinationTime.value = value;
}
return { return {
lastLocation, lastLocation,
lastLocationDestination, lastLocationDestination,
lastLocationDestinationTime, lastLocationDestinationTime,
updateCurrentUserLocation, updateCurrentUserLocation,
setCurrentUserLocation, setCurrentUserLocation,
lastLocationReset lastLocationReset,
setLastLocation,
setLastLocationLocation,
setLastLocationDestination,
setLastLocationDestinationTime
}; };
}); });

View File

@@ -399,6 +399,17 @@ export const useNotificationStore = defineStore('Notification', () => {
notificationTable.value.data.push(entry); notificationTable.value.data.push(entry);
} }
/**
* @param {boolean} value
*/
function setNotificationInitStatus(value) {
notificationInitStatus.value = value;
}
function clearUnseenNotifications() {
unseenNotifications.value = [];
}
/** /**
* *
* @param notificationId * @param notificationId
@@ -1482,6 +1493,8 @@ export const useNotificationStore = defineStore('Notification', () => {
openNotificationLink, openNotificationLink,
queueMarkAsSeen, queueMarkAsSeen,
markAllAsSeen, markAllAsSeen,
appendNotificationTableEntry appendNotificationTableEntry,
setNotificationInitStatus,
clearUnseenNotifications
}; };
}); });

View File

@@ -494,6 +494,34 @@ export const usePhotonStore = defineStore('Photon', () => {
AppApi.ExecuteVrOverlayFunction('updateHudTimeout', '[]'); AppApi.ExecuteVrOverlayFunction('updateHudTimeout', '[]');
} }
function resetLocationPhotonState() {
photonLobby.value = new Map();
photonLobbyCurrent.value = new Map();
photonLobbyMaster.value = 0;
photonLobbyCurrentUser.value = 0;
photonLobbyUserData.value = new Map();
photonLobbyWatcherLoopStop();
photonLobbyAvatars.value = new Map();
photonLobbyLastModeration.value = new Map();
photonLobbyJointime.value = new Map();
photonLobbyActivePortals.value = new Map();
photonEvent7List.value = new Map();
photonLastEvent7List.value = 0;
photonLastChatBoxMsg.value = new Map();
moderationEventQueue.value = new Map();
if (photonEventTable.value.data.length > 0) {
photonEventTablePrevious.value.data = photonEventTable.value.data;
photonEventTable.value.data = [];
}
}
/**
* @param {number} value
*/
function setPhotonLastEvent7List(value) {
photonLastEvent7List.value = value;
}
function photonLobbyWatcher() { function photonLobbyWatcher() {
if (!state.photonLobbyWatcherLoop) { if (!state.photonLobbyWatcherLoop) {
return; return;
@@ -1845,6 +1873,8 @@ export const usePhotonStore = defineStore('Photon', () => {
promptPhotonOverlayMessageTimeout, promptPhotonOverlayMessageTimeout,
promptPhotonLobbyTimeoutThreshold, promptPhotonLobbyTimeoutThreshold,
photonLobbyWatcherLoopStop, photonLobbyWatcherLoopStop,
resetLocationPhotonState,
setPhotonLastEvent7List,
parsePhotonEvent, parsePhotonEvent,
parseVRCEvent, parseVRCEvent,
moderationAgainstTable moderationAgainstTable

View File

@@ -56,6 +56,20 @@ export const useSearchStore = defineStore('Search', () => {
searchUserResults.value = []; searchUserResults.value = [];
} }
/**
* @param {string} value
*/
function setSearchText(value) {
searchText.value = value;
}
/**
* @param {Array} value
*/
function setQuickSearchItems(value) {
quickSearchItems.value = value;
}
async function searchUserByDisplayName(displayName) { async function searchUserByDisplayName(displayName) {
const params = { const params = {
n: 10, n: 10,
@@ -426,6 +440,8 @@ export const useSearchStore = defineStore('Search', () => {
directAccessParse, directAccessParse,
directAccessPaste, directAccessPaste,
directAccessWorld, directAccessWorld,
verifyShortName verifyShortName,
setSearchText,
setQuickSearchItems
}; };
}); });

View File

@@ -231,6 +231,13 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
function setEnablePrimaryPasswordConfigRepository(value) { function setEnablePrimaryPasswordConfigRepository(value) {
configRepository.setBool('enablePrimaryPassword', value); configRepository.setBool('enablePrimaryPassword', value);
} }
/**
* @param {boolean} value
*/
function setEnablePrimaryPassword(value) {
enablePrimaryPassword.value = value;
}
function setRelaunchVRChatAfterCrash() { function setRelaunchVRChatAfterCrash() {
relaunchVRChatAfterCrash.value = !relaunchVRChatAfterCrash.value; relaunchVRChatAfterCrash.value = !relaunchVRChatAfterCrash.value;
configRepository.setBool( configRepository.setBool(
@@ -969,7 +976,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
.then(async ({ ok, value }) => { .then(async ({ ok, value }) => {
if (!ok) return; if (!ok) return;
if (value && !isNaN(parseInt(value, 10))) { if (value && !isNaN(parseInt(value, 10))) {
vrcxStore.clearVRCXCacheFrequency = Math.trunc( vrcxStore.setClearVRCXCacheFrequency(
parseInt(value, 10) * 3600 * 2 parseInt(value, 10) * 3600 * 2
); );
updateLoopStore.setNextClearVRCXCacheCheck( updateLoopStore.setNextClearVRCXCacheCheck(
@@ -1026,6 +1033,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
vrcRegistryAskRestore, vrcRegistryAskRestore,
sentryErrorReporting, sentryErrorReporting,
setEnablePrimaryPassword,
setEnablePrimaryPasswordConfigRepository, setEnablePrimaryPasswordConfigRepository,
setBioLanguage, setBioLanguage,
setRelaunchVRChatAfterCrash, setRelaunchVRChatAfterCrash,

View File

@@ -406,7 +406,7 @@ export const useAppearanceSettingsStore = defineStore(
} }
if (randomUserColours.value) { if (randomUserColours.value) {
const colour = await getNameColour(userStore.currentUser.id); const colour = await getNameColour(userStore.currentUser.id);
userStore.currentUser.$userColour = colour; userStore.setCurrentUserColour(colour);
userColourInit(); userColourInit();
} else { } else {
applyUserTrustLevel(userStore.currentUser); applyUserTrustLevel(userStore.currentUser);
@@ -1016,14 +1016,14 @@ export const useAppearanceSettingsStore = defineStore(
return; return;
} }
vrcxStore.maxTableSize = nextMaxTableSize; vrcxStore.setMaxTableSize(nextMaxTableSize);
await configRepository.setInt( await configRepository.setInt(
'VRCX_maxTableSize_v2', 'VRCX_maxTableSize_v2',
vrcxStore.maxTableSize vrcxStore.maxTableSize
); );
database.setMaxTableSize(vrcxStore.maxTableSize); database.setMaxTableSize(vrcxStore.maxTableSize);
vrcxStore.searchLimit = nextSearchLimit; vrcxStore.setSearchLimit(nextSearchLimit);
await configRepository.setInt( await configRepository.setInt(
'VRCX_searchLimit', 'VRCX_searchLimit',
vrcxStore.searchLimit vrcxStore.searchLimit
@@ -1043,7 +1043,7 @@ export const useAppearanceSettingsStore = defineStore(
return; return;
} }
const colour = await getNameColour(userStore.currentUser.id); const colour = await getNameColour(userStore.currentUser.id);
userStore.currentUser.$userColour = colour; userStore.setCurrentUserColour(colour);
await userColourInit(); await userColourInit();
} }

View File

@@ -190,10 +190,10 @@ export const useUiStore = defineStore('Ui', () => {
const groupStore = useGroupStore(); const groupStore = useGroupStore();
const instanceStore = useInstanceStore(); const instanceStore = useInstanceStore();
userStore.userDialog.visible = false; userStore.setUserDialogVisible(false);
worldStore.worldDialog.visible = false; worldStore.setWorldDialogVisible(false);
avatarStore.avatarDialog.visible = false; avatarStore.setAvatarDialogVisible(false);
groupStore.groupDialog.visible = false; groupStore.setGroupDialogVisible(false);
instanceStore.hidePreviousInstancesDialogs(); instanceStore.hidePreviousInstancesDialogs();
clearDialogCrumbs(); clearDialogCrumbs();
} }
@@ -229,22 +229,22 @@ export const useUiStore = defineStore('Ui', () => {
(instanceStore.previousInstancesListDialog.visible && !isPrevList); (instanceStore.previousInstancesListDialog.visible && !isPrevList);
if (type !== 'user') { if (type !== 'user') {
userStore.userDialog.visible = false; userStore.setUserDialogVisible(false);
} }
if (type !== 'world') { if (type !== 'world') {
worldStore.worldDialog.visible = false; worldStore.setWorldDialogVisible(false);
} }
if (type !== 'avatar') { if (type !== 'avatar') {
avatarStore.avatarDialog.visible = false; avatarStore.setAvatarDialogVisible(false);
} }
if (type !== 'group') { if (type !== 'group') {
groupStore.groupDialog.visible = false; groupStore.setGroupDialogVisible(false);
} }
if (!isPrevInfo) { if (!isPrevInfo) {
instanceStore.previousInstancesInfoDialog.visible = false; instanceStore.setPreviousInstancesInfoDialogVisible(false);
} }
if (!isPrevList) { if (!isPrevList) {
instanceStore.previousInstancesListDialog.visible = false; instanceStore.setPreviousInstancesListDialogVisible(false);
} }
if (!hadActiveDialog) { if (!hadActiveDialog) {
clearDialogCrumbs(); clearDialogCrumbs();
@@ -286,7 +286,7 @@ export const useUiStore = defineStore('Ui', () => {
const name = String(routeName); const name = String(routeName);
removeNotify(name); removeNotify(name);
if (name === 'notification') { if (name === 'notification') {
notificationStore.unseenNotifications = []; notificationStore.clearUnseenNotifications();
} }
} }
} }

View File

@@ -159,6 +159,14 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
state.nextDiscordUpdate = value; state.nextDiscordUpdate = value;
} }
function setIpcTimeout(value) {
state.ipcTimeout = value;
}
function setNextCurrentUserRefresh(value) {
state.nextCurrentUserRefresh = value;
}
return { return {
// state, // state,
@@ -167,6 +175,8 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
nextDiscordUpdate, nextDiscordUpdate,
ipcTimeout, ipcTimeout,
updateLoop, updateLoop,
setIpcTimeout,
setNextCurrentUserRefresh,
setNextDiscordUpdate, setNextDiscordUpdate,
setNextGroupInstanceRefresh, setNextGroupInstanceRefresh,
setNextClearVRCXCacheCheck setNextClearVRCXCacheCheck

View File

@@ -358,7 +358,7 @@ export const useUserStore = defineStore('User', () => {
...args.json ...args.json
}; };
args.ref = ref; args.ref = ref;
authStore.cachedConfig = ref; authStore.setCachedConfig(ref);
if (typeof args.ref?.whiteListedAssetUrls !== 'object') { if (typeof args.ref?.whiteListedAssetUrls !== 'object') {
console.error('Invalid config whiteListedAssetUrls'); console.error('Invalid config whiteListedAssetUrls');
} }
@@ -878,7 +878,7 @@ export const useUserStore = defineStore('User', () => {
}); });
showUserDialogHistory.delete(userId); showUserDialogHistory.delete(userId);
showUserDialogHistory.add(userId); showUserDialogHistory.add(userId);
searchStore.quickSearchItems = searchStore.quickSearchUserHistory(); searchStore.setQuickSearchItems(searchStore.quickSearchUserHistory());
} }
/** /**
@@ -1126,11 +1126,11 @@ export const useUserStore = defineStore('User', () => {
showUserDialog(found.id); showUserDialog(found.id);
return; return;
} }
searchStore.searchText = ref.displayName; searchStore.setSearchText(ref.displayName);
await searchStore.searchUserByDisplayName(ref.displayName); await searchStore.searchUserByDisplayName(ref.displayName);
for (ctx of searchStore.searchUserResults) { for (ctx of searchStore.searchUserResults) {
if (ctx.displayName === ref.displayName) { if (ctx.displayName === ref.displayName) {
searchStore.searchText = ''; searchStore.setSearchText('');
searchStore.clearSearch(); searchStore.clearSearch();
showUserDialog(ctx.id); showUserDialog(ctx.id);
return; return;
@@ -1716,7 +1716,7 @@ export const useUserStore = defineStore('User', () => {
* @returns {import('../types/api/user').GetCurrentUserResponse} * @returns {import('../types/api/user').GetCurrentUserResponse}
*/ */
function applyCurrentUser(json) { function applyCurrentUser(json) {
authStore.attemptingAutoLogin = false; authStore.setAttemptingAutoLogin(false);
let ref = currentUser.value; let ref = currentUser.value;
if (watchState.isLoggedIn) { if (watchState.isLoggedIn) {
if (json.currentAvatar !== ref.currentAvatar) { if (json.currentAvatar !== ref.currentAvatar) {
@@ -1980,6 +1980,20 @@ export const useUserStore = defineStore('User', () => {
userDialog.value.memo = value; userDialog.value.memo = value;
} }
/**
* @param {boolean} value
*/
function setUserDialogVisible(value) {
userDialog.value.visible = value;
}
/**
* @param {boolean} value
*/
function setUserDialogIsFavorite(value) {
userDialog.value.isFavorite = value;
}
/** /**
* @param {string} value * @param {string} value
*/ */
@@ -1987,6 +2001,41 @@ export const useUserStore = defineStore('User', () => {
currentUser.value.$userColour = value; currentUser.value.$userColour = value;
} }
/**
* @param {string} location
* @param {string} travelingToLocation
* @param {number} timestamp
*/
function setCurrentUserLocationState(
location,
travelingToLocation,
timestamp = Date.now()
) {
currentUser.value.$location_at = timestamp;
currentUser.value.$travelingToTime = timestamp;
currentUser.value.$locationTag = location;
currentUser.value.$travelingToLocation = travelingToLocation;
}
/**
* @param {number} value
*/
function setCurrentUserTravelingToTime(value) {
currentUser.value.$travelingToTime = value;
}
function markCurrentUserGameStarted() {
currentUser.value.$online_for = Date.now();
currentUser.value.$offline_for = '';
currentUser.value.$previousAvatarSwapTime = Date.now();
}
function markCurrentUserGameStopped() {
currentUser.value.$online_for = 0;
currentUser.value.$offline_for = Date.now();
currentUser.value.$previousAvatarSwapTime = null;
}
/** /**
* *
*/ */
@@ -2033,7 +2082,13 @@ export const useUserStore = defineStore('User', () => {
handleConfig, handleConfig,
showSendBoopDialog, showSendBoopDialog,
setUserDialogMemo, setUserDialogMemo,
setUserDialogVisible,
setUserDialogIsFavorite,
setCurrentUserColour, setCurrentUserColour,
setCurrentUserLocationState,
setCurrentUserTravelingToTime,
markCurrentUserGameStarted,
markCurrentUserGameStopped,
checkNote, checkNote,
toggleSharedConnectionsOptOut, toggleSharedConnectionsOptOut,
toggleDiscordFriendsOptOut toggleDiscordFriendsOptOut

View File

@@ -247,6 +247,27 @@ export const useVrcxStore = defineStore('Vrcx', () => {
ipcEnabled.value = value; ipcEnabled.value = value;
} }
/**
* @param {number} value
*/
function setClearVRCXCacheFrequency(value) {
clearVRCXCacheFrequency.value = value;
}
/**
* @param {number} value
*/
function setMaxTableSize(value) {
maxTableSize.value = value;
}
/**
* @param {number} value
*/
function setSearchLimit(value) {
searchLimit.value = value;
}
/** /**
* *
*/ */
@@ -522,7 +543,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
for (const [id, dt] of Object.entries(data.Event7List)) { for (const [id, dt] of Object.entries(data.Event7List)) {
photonStore.photonEvent7List.set(parseInt(id, 10), dt); photonStore.photonEvent7List.set(parseInt(id, 10), dt);
} }
photonStore.photonLastEvent7List = Date.parse(data.dt); photonStore.setPhotonLastEvent7List(Date.parse(data.dt));
break; break;
case 'VrcxMessage': case 'VrcxMessage':
if (AppDebug.debugPhotonLogging || AppDebug.debugIPC) { if (AppDebug.debugPhotonLogging || AppDebug.debugIPC) {
@@ -538,7 +559,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
photonStore.setPhotonLoggingEnabled(); photonStore.setPhotonLoggingEnabled();
} }
ipcEnabled.value = true; ipcEnabled.value = true;
updateLoopStore.ipcTimeout = 60; // 30 seconds updateLoopStore.setIpcTimeout(60); // 30 seconds
break; break;
case 'MsgPing': case 'MsgPing':
if (AppDebug.debugIPC) { if (AppDebug.debugIPC) {
@@ -719,13 +740,13 @@ export const useVrcxStore = defineStore('Vrcx', () => {
if (!type) break; if (!type) break;
const data = input.replace(`import/${type}/`, ''); const data = input.replace(`import/${type}/`, '');
if (type === 'avatar') { if (type === 'avatar') {
favoriteStore.avatarImportDialogInput = data; favoriteStore.setAvatarImportDialogInput(data);
favoriteStore.showAvatarImportDialog(); favoriteStore.showAvatarImportDialog();
} else if (type === 'world') { } else if (type === 'world') {
favoriteStore.worldImportDialogInput = data; favoriteStore.setWorldImportDialogInput(data);
favoriteStore.showWorldImportDialog(); favoriteStore.showWorldImportDialog();
} else if (type === 'friend') { } else if (type === 'friend') {
favoriteStore.friendImportDialogInput = data; favoriteStore.setFriendImportDialogInput(data);
favoriteStore.showFriendImportDialog(); favoriteStore.showFriendImportDialog();
} }
break; break;
@@ -878,6 +899,9 @@ export const useVrcxStore = defineStore('Vrcx', () => {
proxyServer, proxyServer,
setProxyServer, setProxyServer,
setIpcEnabled, setIpcEnabled,
setClearVRCXCacheFrequency,
setMaxTableSize,
setSearchLimit,
currentlyDroppingFile, currentlyDroppingFile,
isRegistryBackupDialogVisible, isRegistryBackupDialogVisible,
ipcEnabled, ipcEnabled,

View File

@@ -214,6 +214,20 @@ export const useWorldStore = defineStore('World', () => {
worldDialog.loading = value; worldDialog.loading = value;
} }
/**
* @param {boolean} value
*/
function setWorldDialogVisible(value) {
worldDialog.visible = value;
}
/**
* @param {boolean} value
*/
function setWorldDialogIsFavorite(value) {
worldDialog.isFavorite = value;
}
/** /**
* *
*/ */
@@ -323,6 +337,8 @@ export const useWorldStore = defineStore('World', () => {
worldDialog, worldDialog,
cachedWorlds, cachedWorlds,
showWorldDialog, showWorldDialog,
setWorldDialogVisible,
setWorldDialogIsFavorite,
setWorldDialogLoading, setWorldDialogLoading,
updateVRChatWorldCache, updateVRChatWorldCache,
applyWorld, applyWorld,