mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-13 03:43:50 +02:00
refactor: use setter functions for dialog visibility and favorite status in stores
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createApp } from 'vue';
|
||||
import { VueQueryPlugin } from '@tanstack/vue-query';
|
||||
import { createApp } from 'vue';
|
||||
|
||||
import {
|
||||
i18n,
|
||||
|
||||
@@ -174,11 +174,11 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
})
|
||||
}).show();
|
||||
}
|
||||
userStore.userDialog.visible = false;
|
||||
userStore.setUserDialogVisible(false);
|
||||
watchState.isLoggedIn = false;
|
||||
watchState.isFriendsLoaded = false;
|
||||
watchState.isFavoritesLoaded = false;
|
||||
notificationStore.notificationInitStatus = false;
|
||||
notificationStore.setNotificationInitStatus(false);
|
||||
await updateStoredUser(userStore.currentUser);
|
||||
webApiService.clearCookies();
|
||||
loginForm.value.lastUserLoggedIn = '';
|
||||
@@ -222,7 +222,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
loginForm.value.loading = false;
|
||||
})
|
||||
.catch((err) => {
|
||||
updateLoopStore.nextCurrentUserRefresh = 60; // 1min
|
||||
updateLoopStore.setNextCurrentUserRefresh(60); // 1min
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
@@ -275,8 +275,9 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
*
|
||||
*/
|
||||
function enablePrimaryPasswordChange() {
|
||||
advancedSettingsStore.enablePrimaryPassword =
|
||||
!advancedSettingsStore.enablePrimaryPassword;
|
||||
advancedSettingsStore.setEnablePrimaryPassword(
|
||||
!advancedSettingsStore.enablePrimaryPassword
|
||||
);
|
||||
|
||||
enablePrimaryPasswordDialog.value.password = '';
|
||||
enablePrimaryPasswordDialog.value.rePassword = '';
|
||||
@@ -292,7 +293,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
})
|
||||
.then(async ({ ok, value }) => {
|
||||
if (!ok) {
|
||||
advancedSettingsStore.enablePrimaryPassword = true;
|
||||
advancedSettingsStore.setEnablePrimaryPassword(true);
|
||||
advancedSettingsStore.setEnablePrimaryPasswordConfigRepository(
|
||||
true
|
||||
);
|
||||
@@ -327,7 +328,9 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
);
|
||||
})
|
||||
.catch(async () => {
|
||||
advancedSettingsStore.enablePrimaryPassword = true;
|
||||
advancedSettingsStore.setEnablePrimaryPassword(
|
||||
true
|
||||
);
|
||||
advancedSettingsStore.setEnablePrimaryPasswordConfigRepository(
|
||||
true
|
||||
);
|
||||
@@ -336,7 +339,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
advancedSettingsStore.enablePrimaryPassword = true;
|
||||
advancedSettingsStore.setEnablePrimaryPassword(true);
|
||||
advancedSettingsStore.setEnablePrimaryPasswordConfigRepository(
|
||||
true
|
||||
);
|
||||
@@ -547,7 +550,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
delete savedCredentials[userId];
|
||||
// Disable primary password when no account is available.
|
||||
if (Object.keys(savedCredentials).length === 0) {
|
||||
advancedSettingsStore.enablePrimaryPassword = false;
|
||||
advancedSettingsStore.setEnablePrimaryPassword(false);
|
||||
advancedSettingsStore.setEnablePrimaryPasswordConfigRepository(
|
||||
false
|
||||
);
|
||||
@@ -845,7 +848,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
} else if (json.requiresTwoFactorAuth) {
|
||||
promptTOTP();
|
||||
} else {
|
||||
updateLoopStore.nextCurrentUserRefresh = 420; // 7mins
|
||||
updateLoopStore.setNextCurrentUserRefresh(420); // 7mins
|
||||
userStore.applyCurrentUser(json);
|
||||
initWebsocket();
|
||||
}
|
||||
@@ -961,6 +964,15 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
AppApi.CheckGameRunning(); // restore state from hot-reload
|
||||
}
|
||||
|
||||
function setCachedConfig(value) {
|
||||
cachedConfig.value = value;
|
||||
state.cachedConfig = value;
|
||||
}
|
||||
|
||||
function setAttemptingAutoLogin(value) {
|
||||
attemptingAutoLogin.value = value;
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
@@ -989,6 +1001,8 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
handleLogoutEvent,
|
||||
handleCurrentUserUpdate,
|
||||
loginComplete,
|
||||
getAllSavedCredentials
|
||||
getAllSavedCredentials,
|
||||
setCachedConfig,
|
||||
setAttemptingAutoLogin
|
||||
};
|
||||
});
|
||||
|
||||
@@ -249,6 +249,20 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
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
|
||||
@@ -812,6 +826,8 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
lookupAvatars,
|
||||
selectAvatarWithConfirmation,
|
||||
selectAvatarWithoutConfirmation,
|
||||
setAvatarDialogVisible,
|
||||
setAvatarDialogIsFavorite,
|
||||
setAvatarDialogLoading,
|
||||
showAvatarAuthorDialog,
|
||||
addAvatarWearTime,
|
||||
|
||||
@@ -339,15 +339,15 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
const { ref } = args;
|
||||
const userDialog = userStore.userDialog;
|
||||
if (userDialog.visible && ref.favoriteId === userDialog.id) {
|
||||
userDialog.isFavorite = true;
|
||||
userStore.setUserDialogIsFavorite(true);
|
||||
}
|
||||
const worldDialog = worldStore.worldDialog;
|
||||
if (worldDialog.visible && ref.favoriteId === worldDialog.id) {
|
||||
worldDialog.isFavorite = true;
|
||||
worldStore.setWorldDialogIsFavorite(true);
|
||||
}
|
||||
const avatarDialog = avatarStore.avatarDialog;
|
||||
if (avatarDialog.visible && ref.favoriteId === avatarDialog.id) {
|
||||
avatarDialog.isFavorite = true;
|
||||
avatarStore.setAvatarDialogIsFavorite(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,17 +432,17 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
friendStore.updateSidebarFavorites();
|
||||
const userDialog = userStore.userDialog;
|
||||
if (userDialog.visible && userDialog.id === ref.favoriteId) {
|
||||
userDialog.isFavorite = false;
|
||||
userStore.setUserDialogIsFavorite(false);
|
||||
}
|
||||
const worldDialog = worldStore.worldDialog;
|
||||
if (worldDialog.visible && worldDialog.id === ref.favoriteId) {
|
||||
worldDialog.isFavorite = localWorldFavoritesList.value.includes(
|
||||
worldDialog.id
|
||||
worldStore.setWorldDialogIsFavorite(
|
||||
localWorldFavoritesList.value.includes(worldDialog.id)
|
||||
);
|
||||
}
|
||||
const avatarDialog = avatarStore.avatarDialog;
|
||||
if (avatarDialog.visible && avatarDialog.id === ref.favoriteId) {
|
||||
avatarDialog.isFavorite = false;
|
||||
avatarStore.setAvatarDialogIsFavorite(false);
|
||||
}
|
||||
countFavoriteGroups();
|
||||
}
|
||||
@@ -949,6 +949,27 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
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
|
||||
@@ -979,7 +1000,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
worldStore.worldDialog.visible &&
|
||||
worldStore.worldDialog.id === worldId
|
||||
) {
|
||||
worldStore.worldDialog.isFavorite = true;
|
||||
worldStore.setWorldDialogIsFavorite(true);
|
||||
}
|
||||
|
||||
// update UI
|
||||
@@ -1034,7 +1055,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
avatarStore.avatarDialog.visible &&
|
||||
avatarStore.avatarDialog.id === avatarId
|
||||
) {
|
||||
avatarStore.avatarDialog.isFavorite = true;
|
||||
avatarStore.setAvatarDialogIsFavorite(true);
|
||||
}
|
||||
|
||||
// update UI
|
||||
@@ -1302,8 +1323,9 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
avatarStore.avatarDialog.visible &&
|
||||
avatarStore.avatarDialog.id === avatarId
|
||||
) {
|
||||
avatarStore.avatarDialog.isFavorite =
|
||||
getCachedFavoritesByObjectId(avatarId);
|
||||
avatarStore.setAvatarDialogIsFavorite(
|
||||
getCachedFavoritesByObjectId(avatarId)
|
||||
);
|
||||
}
|
||||
|
||||
// update UI
|
||||
@@ -1519,8 +1541,9 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
worldStore.worldDialog.visible &&
|
||||
worldStore.worldDialog.id === worldId
|
||||
) {
|
||||
worldStore.worldDialog.isFavorite =
|
||||
getCachedFavoritesByObjectId(worldId);
|
||||
worldStore.setWorldDialogIsFavorite(
|
||||
getCachedFavoritesByObjectId(worldId)
|
||||
);
|
||||
}
|
||||
|
||||
// update UI
|
||||
@@ -1614,7 +1637,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
const userDialog = userStore.userDialog;
|
||||
if (userDialog.visible && userDialog.id === userId) {
|
||||
userDialog.isFavorite = true;
|
||||
userStore.setUserDialogIsFavorite(true);
|
||||
}
|
||||
friendStore.updateLocalFavoriteFriends();
|
||||
}
|
||||
@@ -1667,9 +1690,10 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
const userDialog = userStore.userDialog;
|
||||
if (userDialog.visible && userDialog.id === userId) {
|
||||
userDialog.isFavorite =
|
||||
userStore.setUserDialogIsFavorite(
|
||||
getCachedFavoritesByObjectId(userId) ||
|
||||
isInAnyLocalFriendGroup(userId);
|
||||
isInAnyLocalFriendGroup(userId)
|
||||
);
|
||||
}
|
||||
friendStore.updateLocalFavoriteFriends();
|
||||
}
|
||||
@@ -1865,6 +1889,9 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
showWorldImportDialog,
|
||||
showAvatarImportDialog,
|
||||
showFriendImportDialog,
|
||||
setAvatarImportDialogInput,
|
||||
setWorldImportDialogInput,
|
||||
setFriendImportDialogInput,
|
||||
addLocalWorldFavorite,
|
||||
hasLocalWorldFavorite,
|
||||
hasLocalAvatarFavorite,
|
||||
|
||||
@@ -155,27 +155,23 @@ export const useGameStore = defineStore('Game', () => {
|
||||
if (isGameRunningArg !== isGameRunning.value) {
|
||||
isGameRunning.value = isGameRunningArg;
|
||||
if (isGameRunningArg) {
|
||||
userStore.currentUser.$online_for = Date.now();
|
||||
userStore.currentUser.$offline_for = '';
|
||||
userStore.currentUser.$previousAvatarSwapTime = Date.now();
|
||||
userStore.markCurrentUserGameStarted();
|
||||
} else {
|
||||
await configRepository.setBool('isGameNoVR', isGameNoVR.value);
|
||||
userStore.currentUser.$online_for = 0;
|
||||
userStore.currentUser.$offline_for = Date.now();
|
||||
userStore.markCurrentUserGameStopped();
|
||||
instanceStore.removeAllQueuedInstances();
|
||||
autoVRChatCacheManagement();
|
||||
checkIfGameCrashed();
|
||||
updateLoopStore.ipcTimeout = 0;
|
||||
updateLoopStore.setIpcTimeout(0);
|
||||
avatarStore.addAvatarWearTime(
|
||||
userStore.currentUser.currentAvatar
|
||||
);
|
||||
userStore.currentUser.$previousAvatarSwapTime = null;
|
||||
}
|
||||
locationStore.lastLocationReset();
|
||||
gameLogStore.clearNowPlaying();
|
||||
vrStore.updateVRLastLocation();
|
||||
workerTimers.setTimeout(() => checkVRChatDebugLogging(), 60000);
|
||||
updateLoopStore.nextDiscordUpdate = 0;
|
||||
updateLoopStore.setNextDiscordUpdate(0);
|
||||
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() {
|
||||
if (advancedSettingsStore.gameLogDisabled) {
|
||||
return;
|
||||
@@ -260,6 +263,7 @@ export const useGameStore = defineStore('Game', () => {
|
||||
sweepVRChatCache,
|
||||
getVRChatCacheSize,
|
||||
updateIsGameRunning,
|
||||
setIsGameNoVR,
|
||||
getVRChatRegistryKey,
|
||||
checkVRChatDebugLogging,
|
||||
updateIsHmdAfk
|
||||
|
||||
@@ -202,6 +202,11 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
vrStore.updateVrNowPlaying();
|
||||
}
|
||||
|
||||
function resetLastMediaUrls() {
|
||||
lastVideoUrl.value = '';
|
||||
lastResourceloadUrl.value = '';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
@@ -317,13 +322,13 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
for (i = data.length - 1; i > -1; i--) {
|
||||
ctx = data[i];
|
||||
if (ctx.type === 'Location') {
|
||||
locationStore.lastLocation = {
|
||||
locationStore.setLastLocation({
|
||||
date: Date.parse(ctx.created_at),
|
||||
location: ctx.location,
|
||||
name: ctx.worldName,
|
||||
playerList: new Map(),
|
||||
friendList: new Map()
|
||||
};
|
||||
});
|
||||
length = i;
|
||||
break;
|
||||
}
|
||||
@@ -556,10 +561,10 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
location: gameLog.location
|
||||
});
|
||||
locationStore.lastLocationReset(gameLog.dt);
|
||||
locationStore.lastLocation.location = 'traveling';
|
||||
locationStore.lastLocationDestination = gameLog.location;
|
||||
locationStore.lastLocationDestinationTime = Date.parse(
|
||||
gameLog.dt
|
||||
locationStore.setLastLocationLocation('traveling');
|
||||
locationStore.setLastLocationDestination(gameLog.location);
|
||||
locationStore.setLastLocationDestinationTime(
|
||||
Date.parse(gameLog.dt)
|
||||
);
|
||||
state.lastLocationAvatarList.clear();
|
||||
instanceStore.removeQueuedInstance(gameLog.location);
|
||||
@@ -580,13 +585,13 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
if (gameStore.isGameRunning) {
|
||||
locationStore.lastLocationReset(gameLog.dt);
|
||||
clearNowPlaying();
|
||||
locationStore.lastLocation = {
|
||||
locationStore.setLastLocation({
|
||||
date: Date.parse(gameLog.dt),
|
||||
location: gameLog.location,
|
||||
name: worldName,
|
||||
playerList: new Map(),
|
||||
friendList: new Map()
|
||||
};
|
||||
});
|
||||
instanceStore.removeQueuedInstance(gameLog.location);
|
||||
locationStore.updateCurrentUserLocation();
|
||||
vrStore.updateVRLastLocation();
|
||||
@@ -881,12 +886,12 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
}
|
||||
break;
|
||||
case 'openvr-init':
|
||||
gameStore.isGameNoVR = false;
|
||||
gameStore.setIsGameNoVR(false);
|
||||
configRepository.setBool('isGameNoVR', gameStore.isGameNoVR);
|
||||
vrStore.updateOpenVR();
|
||||
break;
|
||||
case 'desktop-mode':
|
||||
gameStore.isGameNoVR = true;
|
||||
gameStore.setIsGameNoVR(true);
|
||||
configRepository.setBool('isGameNoVR', gameStore.isGameNoVR);
|
||||
vrStore.updateOpenVR();
|
||||
break;
|
||||
@@ -1021,6 +1026,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
lastResourceloadUrl,
|
||||
|
||||
clearNowPlaying,
|
||||
resetLastMediaUrls,
|
||||
tryLoadPlayerList,
|
||||
gameLogIsFriend,
|
||||
gameLogIsFavorite,
|
||||
|
||||
@@ -966,6 +966,13 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
groupInstances.value = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setGroupDialogVisible(value) {
|
||||
groupDialog.value.visible = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {object} json
|
||||
@@ -1202,6 +1209,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
handleGroupPost,
|
||||
handleGroupUserInstances,
|
||||
clearGroupInstances,
|
||||
setGroupDialogVisible,
|
||||
handleGroupMember,
|
||||
handleGroupPermissions,
|
||||
handleGroupMemberProps,
|
||||
|
||||
@@ -223,6 +223,20 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
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
|
||||
@@ -1438,6 +1452,8 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
instanceQueueReady,
|
||||
instanceQueueUpdate,
|
||||
hidePreviousInstancesDialogs,
|
||||
setPreviousInstancesInfoDialogVisible,
|
||||
setPreviousInstancesListDialogVisible,
|
||||
showPreviousInstancesInfoDialog,
|
||||
showPreviousInstancesListDialog,
|
||||
addInstanceJoinHistory,
|
||||
|
||||
@@ -78,16 +78,14 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
} else {
|
||||
ref.$location_at = lastLocation.value.date;
|
||||
ref.$travelingToTime = lastLocationDestinationTime.value;
|
||||
userStore.currentUser.$travelingToTime =
|
||||
lastLocationDestinationTime.value;
|
||||
userStore.setCurrentUserTravelingToTime(
|
||||
lastLocationDestinationTime.value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function setCurrentUserLocation(location, travelingToLocation) {
|
||||
userStore.currentUser.$location_at = Date.now();
|
||||
userStore.currentUser.$travelingToTime = Date.now();
|
||||
userStore.currentUser.$locationTag = location;
|
||||
userStore.currentUser.$travelingToLocation = travelingToLocation;
|
||||
userStore.setCurrentUserLocationState(location, travelingToLocation);
|
||||
updateCurrentUserLocation();
|
||||
|
||||
// janky gameLog support for Quest
|
||||
@@ -144,25 +142,7 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
dateTime = new Date().toJSON();
|
||||
}
|
||||
const dateTimeStamp = Date.parse(dateTime);
|
||||
photonStore.photonLobby = new Map();
|
||||
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 = [];
|
||||
}
|
||||
photonStore.resetLocationPhotonState();
|
||||
const playerList = Array.from(lastLocation.value.playerList.values());
|
||||
const dataBaseEntries = [];
|
||||
for (const ref of playerList) {
|
||||
@@ -198,19 +178,50 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
instanceStore.updateCurrentInstanceWorld();
|
||||
vrStore.updateVRLastLocation();
|
||||
instanceStore.getCurrentInstanceUserList();
|
||||
gameLogStore.lastVideoUrl = '';
|
||||
gameLogStore.lastResourceloadUrl = '';
|
||||
gameLogStore.resetLastMediaUrls();
|
||||
userStore.applyUserDialogLocation();
|
||||
instanceStore.applyWorldDialogInstances();
|
||||
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 {
|
||||
lastLocation,
|
||||
lastLocationDestination,
|
||||
lastLocationDestinationTime,
|
||||
updateCurrentUserLocation,
|
||||
setCurrentUserLocation,
|
||||
lastLocationReset
|
||||
lastLocationReset,
|
||||
setLastLocation,
|
||||
setLastLocationLocation,
|
||||
setLastLocationDestination,
|
||||
setLastLocationDestinationTime
|
||||
};
|
||||
});
|
||||
|
||||
@@ -399,6 +399,17 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
notificationTable.value.data.push(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setNotificationInitStatus(value) {
|
||||
notificationInitStatus.value = value;
|
||||
}
|
||||
|
||||
function clearUnseenNotifications() {
|
||||
unseenNotifications.value = [];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param notificationId
|
||||
@@ -1482,6 +1493,8 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
openNotificationLink,
|
||||
queueMarkAsSeen,
|
||||
markAllAsSeen,
|
||||
appendNotificationTableEntry
|
||||
appendNotificationTableEntry,
|
||||
setNotificationInitStatus,
|
||||
clearUnseenNotifications
|
||||
};
|
||||
});
|
||||
|
||||
@@ -494,6 +494,34 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
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() {
|
||||
if (!state.photonLobbyWatcherLoop) {
|
||||
return;
|
||||
@@ -1845,6 +1873,8 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
promptPhotonOverlayMessageTimeout,
|
||||
promptPhotonLobbyTimeoutThreshold,
|
||||
photonLobbyWatcherLoopStop,
|
||||
resetLocationPhotonState,
|
||||
setPhotonLastEvent7List,
|
||||
parsePhotonEvent,
|
||||
parseVRCEvent,
|
||||
moderationAgainstTable
|
||||
|
||||
@@ -56,6 +56,20 @@ export const useSearchStore = defineStore('Search', () => {
|
||||
searchUserResults.value = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
function setSearchText(value) {
|
||||
searchText.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} value
|
||||
*/
|
||||
function setQuickSearchItems(value) {
|
||||
quickSearchItems.value = value;
|
||||
}
|
||||
|
||||
async function searchUserByDisplayName(displayName) {
|
||||
const params = {
|
||||
n: 10,
|
||||
@@ -426,6 +440,8 @@ export const useSearchStore = defineStore('Search', () => {
|
||||
directAccessParse,
|
||||
directAccessPaste,
|
||||
directAccessWorld,
|
||||
verifyShortName
|
||||
verifyShortName,
|
||||
setSearchText,
|
||||
setQuickSearchItems
|
||||
};
|
||||
});
|
||||
|
||||
@@ -231,6 +231,13 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
function setEnablePrimaryPasswordConfigRepository(value) {
|
||||
configRepository.setBool('enablePrimaryPassword', value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setEnablePrimaryPassword(value) {
|
||||
enablePrimaryPassword.value = value;
|
||||
}
|
||||
function setRelaunchVRChatAfterCrash() {
|
||||
relaunchVRChatAfterCrash.value = !relaunchVRChatAfterCrash.value;
|
||||
configRepository.setBool(
|
||||
@@ -969,7 +976,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
.then(async ({ ok, value }) => {
|
||||
if (!ok) return;
|
||||
if (value && !isNaN(parseInt(value, 10))) {
|
||||
vrcxStore.clearVRCXCacheFrequency = Math.trunc(
|
||||
vrcxStore.setClearVRCXCacheFrequency(
|
||||
parseInt(value, 10) * 3600 * 2
|
||||
);
|
||||
updateLoopStore.setNextClearVRCXCacheCheck(
|
||||
@@ -1026,6 +1033,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
vrcRegistryAskRestore,
|
||||
sentryErrorReporting,
|
||||
|
||||
setEnablePrimaryPassword,
|
||||
setEnablePrimaryPasswordConfigRepository,
|
||||
setBioLanguage,
|
||||
setRelaunchVRChatAfterCrash,
|
||||
|
||||
@@ -406,7 +406,7 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
}
|
||||
if (randomUserColours.value) {
|
||||
const colour = await getNameColour(userStore.currentUser.id);
|
||||
userStore.currentUser.$userColour = colour;
|
||||
userStore.setCurrentUserColour(colour);
|
||||
userColourInit();
|
||||
} else {
|
||||
applyUserTrustLevel(userStore.currentUser);
|
||||
@@ -1016,14 +1016,14 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
return;
|
||||
}
|
||||
|
||||
vrcxStore.maxTableSize = nextMaxTableSize;
|
||||
vrcxStore.setMaxTableSize(nextMaxTableSize);
|
||||
await configRepository.setInt(
|
||||
'VRCX_maxTableSize_v2',
|
||||
vrcxStore.maxTableSize
|
||||
);
|
||||
database.setMaxTableSize(vrcxStore.maxTableSize);
|
||||
|
||||
vrcxStore.searchLimit = nextSearchLimit;
|
||||
vrcxStore.setSearchLimit(nextSearchLimit);
|
||||
await configRepository.setInt(
|
||||
'VRCX_searchLimit',
|
||||
vrcxStore.searchLimit
|
||||
@@ -1043,7 +1043,7 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
return;
|
||||
}
|
||||
const colour = await getNameColour(userStore.currentUser.id);
|
||||
userStore.currentUser.$userColour = colour;
|
||||
userStore.setCurrentUserColour(colour);
|
||||
await userColourInit();
|
||||
}
|
||||
|
||||
|
||||
@@ -190,10 +190,10 @@ export const useUiStore = defineStore('Ui', () => {
|
||||
const groupStore = useGroupStore();
|
||||
const instanceStore = useInstanceStore();
|
||||
|
||||
userStore.userDialog.visible = false;
|
||||
worldStore.worldDialog.visible = false;
|
||||
avatarStore.avatarDialog.visible = false;
|
||||
groupStore.groupDialog.visible = false;
|
||||
userStore.setUserDialogVisible(false);
|
||||
worldStore.setWorldDialogVisible(false);
|
||||
avatarStore.setAvatarDialogVisible(false);
|
||||
groupStore.setGroupDialogVisible(false);
|
||||
instanceStore.hidePreviousInstancesDialogs();
|
||||
clearDialogCrumbs();
|
||||
}
|
||||
@@ -229,22 +229,22 @@ export const useUiStore = defineStore('Ui', () => {
|
||||
(instanceStore.previousInstancesListDialog.visible && !isPrevList);
|
||||
|
||||
if (type !== 'user') {
|
||||
userStore.userDialog.visible = false;
|
||||
userStore.setUserDialogVisible(false);
|
||||
}
|
||||
if (type !== 'world') {
|
||||
worldStore.worldDialog.visible = false;
|
||||
worldStore.setWorldDialogVisible(false);
|
||||
}
|
||||
if (type !== 'avatar') {
|
||||
avatarStore.avatarDialog.visible = false;
|
||||
avatarStore.setAvatarDialogVisible(false);
|
||||
}
|
||||
if (type !== 'group') {
|
||||
groupStore.groupDialog.visible = false;
|
||||
groupStore.setGroupDialogVisible(false);
|
||||
}
|
||||
if (!isPrevInfo) {
|
||||
instanceStore.previousInstancesInfoDialog.visible = false;
|
||||
instanceStore.setPreviousInstancesInfoDialogVisible(false);
|
||||
}
|
||||
if (!isPrevList) {
|
||||
instanceStore.previousInstancesListDialog.visible = false;
|
||||
instanceStore.setPreviousInstancesListDialogVisible(false);
|
||||
}
|
||||
if (!hadActiveDialog) {
|
||||
clearDialogCrumbs();
|
||||
@@ -286,7 +286,7 @@ export const useUiStore = defineStore('Ui', () => {
|
||||
const name = String(routeName);
|
||||
removeNotify(name);
|
||||
if (name === 'notification') {
|
||||
notificationStore.unseenNotifications = [];
|
||||
notificationStore.clearUnseenNotifications();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,6 +159,14 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
state.nextDiscordUpdate = value;
|
||||
}
|
||||
|
||||
function setIpcTimeout(value) {
|
||||
state.ipcTimeout = value;
|
||||
}
|
||||
|
||||
function setNextCurrentUserRefresh(value) {
|
||||
state.nextCurrentUserRefresh = value;
|
||||
}
|
||||
|
||||
return {
|
||||
// state,
|
||||
|
||||
@@ -167,6 +175,8 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
nextDiscordUpdate,
|
||||
ipcTimeout,
|
||||
updateLoop,
|
||||
setIpcTimeout,
|
||||
setNextCurrentUserRefresh,
|
||||
setNextDiscordUpdate,
|
||||
setNextGroupInstanceRefresh,
|
||||
setNextClearVRCXCacheCheck
|
||||
|
||||
@@ -358,7 +358,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
...args.json
|
||||
};
|
||||
args.ref = ref;
|
||||
authStore.cachedConfig = ref;
|
||||
authStore.setCachedConfig(ref);
|
||||
if (typeof args.ref?.whiteListedAssetUrls !== 'object') {
|
||||
console.error('Invalid config whiteListedAssetUrls');
|
||||
}
|
||||
@@ -878,7 +878,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
});
|
||||
showUserDialogHistory.delete(userId);
|
||||
showUserDialogHistory.add(userId);
|
||||
searchStore.quickSearchItems = searchStore.quickSearchUserHistory();
|
||||
searchStore.setQuickSearchItems(searchStore.quickSearchUserHistory());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1126,11 +1126,11 @@ export const useUserStore = defineStore('User', () => {
|
||||
showUserDialog(found.id);
|
||||
return;
|
||||
}
|
||||
searchStore.searchText = ref.displayName;
|
||||
searchStore.setSearchText(ref.displayName);
|
||||
await searchStore.searchUserByDisplayName(ref.displayName);
|
||||
for (ctx of searchStore.searchUserResults) {
|
||||
if (ctx.displayName === ref.displayName) {
|
||||
searchStore.searchText = '';
|
||||
searchStore.setSearchText('');
|
||||
searchStore.clearSearch();
|
||||
showUserDialog(ctx.id);
|
||||
return;
|
||||
@@ -1716,7 +1716,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
* @returns {import('../types/api/user').GetCurrentUserResponse}
|
||||
*/
|
||||
function applyCurrentUser(json) {
|
||||
authStore.attemptingAutoLogin = false;
|
||||
authStore.setAttemptingAutoLogin(false);
|
||||
let ref = currentUser.value;
|
||||
if (watchState.isLoggedIn) {
|
||||
if (json.currentAvatar !== ref.currentAvatar) {
|
||||
@@ -1980,6 +1980,20 @@ export const useUserStore = defineStore('User', () => {
|
||||
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
|
||||
*/
|
||||
@@ -1987,6 +2001,41 @@ export const useUserStore = defineStore('User', () => {
|
||||
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,
|
||||
showSendBoopDialog,
|
||||
setUserDialogMemo,
|
||||
setUserDialogVisible,
|
||||
setUserDialogIsFavorite,
|
||||
setCurrentUserColour,
|
||||
setCurrentUserLocationState,
|
||||
setCurrentUserTravelingToTime,
|
||||
markCurrentUserGameStarted,
|
||||
markCurrentUserGameStopped,
|
||||
checkNote,
|
||||
toggleSharedConnectionsOptOut,
|
||||
toggleDiscordFriendsOptOut
|
||||
|
||||
@@ -247,6 +247,27 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
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)) {
|
||||
photonStore.photonEvent7List.set(parseInt(id, 10), dt);
|
||||
}
|
||||
photonStore.photonLastEvent7List = Date.parse(data.dt);
|
||||
photonStore.setPhotonLastEvent7List(Date.parse(data.dt));
|
||||
break;
|
||||
case 'VrcxMessage':
|
||||
if (AppDebug.debugPhotonLogging || AppDebug.debugIPC) {
|
||||
@@ -538,7 +559,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
photonStore.setPhotonLoggingEnabled();
|
||||
}
|
||||
ipcEnabled.value = true;
|
||||
updateLoopStore.ipcTimeout = 60; // 30 seconds
|
||||
updateLoopStore.setIpcTimeout(60); // 30 seconds
|
||||
break;
|
||||
case 'MsgPing':
|
||||
if (AppDebug.debugIPC) {
|
||||
@@ -719,13 +740,13 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
if (!type) break;
|
||||
const data = input.replace(`import/${type}/`, '');
|
||||
if (type === 'avatar') {
|
||||
favoriteStore.avatarImportDialogInput = data;
|
||||
favoriteStore.setAvatarImportDialogInput(data);
|
||||
favoriteStore.showAvatarImportDialog();
|
||||
} else if (type === 'world') {
|
||||
favoriteStore.worldImportDialogInput = data;
|
||||
favoriteStore.setWorldImportDialogInput(data);
|
||||
favoriteStore.showWorldImportDialog();
|
||||
} else if (type === 'friend') {
|
||||
favoriteStore.friendImportDialogInput = data;
|
||||
favoriteStore.setFriendImportDialogInput(data);
|
||||
favoriteStore.showFriendImportDialog();
|
||||
}
|
||||
break;
|
||||
@@ -878,6 +899,9 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
proxyServer,
|
||||
setProxyServer,
|
||||
setIpcEnabled,
|
||||
setClearVRCXCacheFrequency,
|
||||
setMaxTableSize,
|
||||
setSearchLimit,
|
||||
currentlyDroppingFile,
|
||||
isRegistryBackupDialogVisible,
|
||||
ipcEnabled,
|
||||
|
||||
@@ -214,6 +214,20 @@ export const useWorldStore = defineStore('World', () => {
|
||||
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,
|
||||
cachedWorlds,
|
||||
showWorldDialog,
|
||||
setWorldDialogVisible,
|
||||
setWorldDialogIsFavorite,
|
||||
setWorldDialogLoading,
|
||||
updateVRChatWorldCache,
|
||||
applyWorld,
|
||||
|
||||
Reference in New Issue
Block a user