fix: add activity store and user activity caching

This commit is contained in:
pa
2026-03-20 04:40:25 +09:00
parent fbfaf7b93c
commit 15fc0bdf1b
14 changed files with 1084 additions and 101 deletions
+19 -18
View File
@@ -71,6 +71,11 @@ export const useVrcxStore = defineStore('Vrcx', () => {
windowState: '',
externalNotifierVersion: 0
});
const databaseUpgradeState = ref({
visible: false,
fromVersion: 0,
toVersion: 0
});
const currentlyDroppingFile = ref(null);
const isRegistryBackupDialogVisible = ref(false);
@@ -182,15 +187,13 @@ export const useVrcxStore = defineStore('Vrcx', () => {
*/
async function updateDatabaseVersion() {
// requires dbVars.userPrefix to be already set
const databaseVersion = 13;
let msgBox;
const databaseVersion = 14;
if (state.databaseVersion < databaseVersion) {
if (state.databaseVersion) {
msgBox = toast.warning(
'DO NOT CLOSE VRCX, database upgrade in progress...',
{ duration: Infinity, position: 'bottom-right' }
);
}
databaseUpgradeState.value = {
visible: state.databaseVersion > 0,
fromVersion: state.databaseVersion,
toVersion: databaseVersion
};
console.log(
`Updating database from ${state.databaseVersion} to ${databaseVersion}...`
);
@@ -212,19 +215,16 @@ export const useVrcxStore = defineStore('Vrcx', () => {
databaseVersion
);
console.log('Database update complete.');
toast.dismiss(msgBox);
if (state.databaseVersion) {
// only display when database exists
toast.success(t('message.database.upgrade_complete'));
}
state.databaseVersion = databaseVersion;
databaseUpgradeState.value.visible = false;
} catch (err) {
console.error(err);
toast.dismiss(msgBox);
toast.error(
'Database upgrade failed, check console for details',
{ duration: 120000 }
);
databaseUpgradeState.value.visible = false;
await modalStore.alert({
title: t('message.database.upgrade_failed_title'),
description: t('message.database.upgrade_failed_description'),
dismissible: false
});
AppApi.ShowDevTools();
}
}
@@ -817,6 +817,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
state,
appStartAt,
databaseUpgradeState,
proxyServer,
setProxyServer,
setIpcEnabled,