mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
Upgrade to Vue3 and Element Plus (#1374)
* Update Vue devtools
* upgrade vue pinia element-plus vue-i18n, add vite
* fix: i18n
* global components
* change v-deep
* upgrade vue-lazyload
* data table
* update enlint and safe-dialog
* package.json and vite.config.js
* el-icon
* el-message
* vue 2 -> vue3 migration changes
* $pinia
* dialog
* el-popover slot
* lint
* chore
* slot
* scss
* remote state access
* misc
* jsconfig
* el-button size mini -> small
* :model-value
* ElMessageBox
* datatable
* remove v-lazyload
* template #dropdown
* mini -> small
* css
* byebye hideTooltips
* use sass-embedded
* Update SQLite, remove unneeded libraries
* Fix shift remove local avatar favorites
* Electron arm64
* arm64 support
* bye pug
* f-word vite hah
* misc
* remove safe dialog component
* Add self invite to launch dialog
* Fix errors
* Icons 1
* improve localfavorite loading performance
* improve favorites world item performance
* dialog visibility changes for Element Plus
* clear element plus error
* import performance
* revert App.vue hah
* hah
* Revert "Add self invite to launch dialog"
This reverts commit 4801cfad58.
* Toggle self invite/open in-game
* Self invite on launch dialog
* el-button icon
* el-icon
* fix user dialog tab switching logic
* fix PlayerList
* Formatting changes
* More icons
* Fix friend log table
* loading margin
* fix markdown
* fix world dialog tab switching issue
* Fixes and formatting
* fix: global i18n.t export
* fix favorites world tab not working
* Create instance, displayName
* Remove group members sort by userId
* Fix loading dialog tabs on swtich
* Star
* charts console.warn
* wip: fix charts
* wip: fix charts
* wip: charts composables
* fix favorite item tooltip warning
* Fixes and formatting
* Clean up image dialogs
* Remove unused method
* Fix platform/size border
* Fix platform/size border
* $vr
* fix friendExportDialogVisible binding
* ElMessageBox and Settings
* Login formatting
* Rename VR overlay query
* Fix image popover and userdialog badges
* Formatting
* Big buttons
* Fixes, update Cef
* Fix gameLog table nav buttons jumping around while using nav buttons
* Fix z-index
* vr overlay
* vite input add theme
* defineAsyncComponent
* ISO 639-1
* fix i18n
* clean t
* Formatting, fix calendar, rotate arrows
* Show user status when user is offline
* Fix VR overlay
* fix theme and clean up
* split InstanceActivity
* tweak
* Fix VR overlay formatting
* fix scss var
* AppDebug hahahaha
* Years
* remove reactive
* improve perf
* state hah…
* fix user rendering poblems when user object is not yet loaded
* improve perf
* Update avatar/world image uploader, licenses, remove previous images dialog (old images are now deleted)
* improve perf 1
* Suppress stray errors
* fix traveling location display issue
* Fix empty instance creator
* improve friend list refresh performance
* fix main charts
* fix chart
* Fix darkmode
* Fix avatar dialog tags
---------
Co-authored-by: pa <maplenagisa@gmail.com>
This commit is contained in:
+97
-87
@@ -1,12 +1,12 @@
|
||||
import Noty from 'noty';
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { authRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import configRepository from '../service/config';
|
||||
import { database } from '../service/database';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { request } from '../service/request';
|
||||
import security from '../service/security';
|
||||
import webApiService from '../service/webapi';
|
||||
@@ -59,7 +59,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
password: '',
|
||||
rePassword: '',
|
||||
beforeClose(done) {
|
||||
$app._data.enablePrimaryPassword = false;
|
||||
// $app._data.enablePrimaryPassword = false;
|
||||
done();
|
||||
}
|
||||
},
|
||||
@@ -211,8 +211,8 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
state.loginForm.lastUserLoggedIn
|
||||
];
|
||||
if (user?.loginParmas?.endpoint) {
|
||||
AppGlobal.endpointDomain = user.loginParmas.endpoint;
|
||||
AppGlobal.websocketDomain = user.loginParmas.websocket;
|
||||
AppDebug.endpointDomain = user.loginParmas.endpoint;
|
||||
AppDebug.websocketDomain = user.loginParmas.websocket;
|
||||
}
|
||||
// login at startup
|
||||
state.loginForm.loading = true;
|
||||
@@ -283,7 +283,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
if (advancedSettingsStore.enablePrimaryPassword) {
|
||||
state.enablePrimaryPasswordDialog.visible = true;
|
||||
} else {
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.primary_password.description'),
|
||||
t('prompt.primary_password.header'),
|
||||
{
|
||||
@@ -415,7 +415,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
if (!advancedSettingsStore.enablePrimaryPassword) {
|
||||
resolve(args.password);
|
||||
}
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.primary_password.description'),
|
||||
t('prompt.primary_password.header'),
|
||||
{
|
||||
@@ -443,11 +443,12 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
}
|
||||
|
||||
function logout() {
|
||||
$app.$confirm('Continue? Logout', 'Confirm', {
|
||||
ElMessageBox.confirm('Continue? Logout', 'Confirm', {
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'info',
|
||||
callback: (action) => {
|
||||
type: 'info'
|
||||
})
|
||||
.then((action) => {
|
||||
if (action === 'confirm') {
|
||||
const existingStyle = document.getElementById(
|
||||
'login-container-style'
|
||||
@@ -457,8 +458,8 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
}
|
||||
handleLogoutEvent();
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
async function relogin(user) {
|
||||
@@ -468,11 +469,11 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
}
|
||||
state.loginForm.lastUserLoggedIn = user.user.id; // for resend email 2fa
|
||||
if (loginParmas.endpoint) {
|
||||
AppGlobal.endpointDomain = loginParmas.endpoint;
|
||||
AppGlobal.websocketDomain = loginParmas.websocket;
|
||||
AppDebug.endpointDomain = loginParmas.endpoint;
|
||||
AppDebug.websocketDomain = loginParmas.websocket;
|
||||
} else {
|
||||
AppGlobal.endpointDomain = AppGlobal.endpointDomainVrchat;
|
||||
AppGlobal.websocketDomain = AppGlobal.websocketDomainVrchat;
|
||||
AppDebug.endpointDomain = AppDebug.endpointDomainVrchat;
|
||||
AppDebug.websocketDomain = AppDebug.websocketDomainVrchat;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
state.loginForm.loading = true;
|
||||
@@ -501,7 +502,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
});
|
||||
})
|
||||
.catch((_) => {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Incorrect primary password',
|
||||
type: 'error'
|
||||
});
|
||||
@@ -559,11 +560,11 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
if (!state.loginForm.loading) {
|
||||
state.loginForm.loading = true;
|
||||
if (state.loginForm.endpoint) {
|
||||
AppGlobal.endpointDomain = state.loginForm.endpoint;
|
||||
AppGlobal.websocketDomain = state.loginForm.websocket;
|
||||
AppDebug.endpointDomain = state.loginForm.endpoint;
|
||||
AppDebug.websocketDomain = state.loginForm.websocket;
|
||||
} else {
|
||||
AppGlobal.endpointDomain = AppGlobal.endpointDomainVrchat;
|
||||
AppGlobal.websocketDomain = AppGlobal.websocketDomainVrchat;
|
||||
AppDebug.endpointDomain = AppDebug.endpointDomainVrchat;
|
||||
AppDebug.websocketDomain = AppDebug.websocketDomainVrchat;
|
||||
}
|
||||
authRequest
|
||||
.getConfig()
|
||||
@@ -576,7 +577,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
state.loginForm.saveCredentials &&
|
||||
advancedSettingsStore.enablePrimaryPassword
|
||||
) {
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.primary_password.description'),
|
||||
t('prompt.primary_password.header'),
|
||||
{
|
||||
@@ -649,36 +650,40 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
}
|
||||
AppApi.FlashWindow();
|
||||
state.twoFactorAuthDialogVisible = true;
|
||||
$app.$prompt(t('prompt.totp.description'), t('prompt.totp.header'), {
|
||||
distinguishCancelAndClose: true,
|
||||
cancelButtonText: t('prompt.totp.use_otp'),
|
||||
confirmButtonText: t('prompt.totp.verify'),
|
||||
inputPlaceholder: t('prompt.totp.input_placeholder'),
|
||||
inputPattern: /^[0-9]{6}$/,
|
||||
inputErrorMessage: t('prompt.totp.input_error'),
|
||||
callback: (action, instance) => {
|
||||
if (action === 'confirm') {
|
||||
authRequest
|
||||
.verifyTOTP({
|
||||
code: instance.inputValue.trim()
|
||||
})
|
||||
.catch((err) => {
|
||||
clearCookiesTryLogin();
|
||||
throw err;
|
||||
})
|
||||
.then((args) => {
|
||||
userStore.getCurrentUser();
|
||||
return args;
|
||||
});
|
||||
} else if (action === 'cancel') {
|
||||
promptOTP();
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.totp.description'),
|
||||
t('prompt.totp.header'),
|
||||
{
|
||||
distinguishCancelAndClose: true,
|
||||
cancelButtonText: t('prompt.totp.use_otp'),
|
||||
confirmButtonText: t('prompt.totp.verify'),
|
||||
inputPlaceholder: t('prompt.totp.input_placeholder'),
|
||||
inputPattern: /^[0-9]{6}$/,
|
||||
inputErrorMessage: t('prompt.totp.input_error'),
|
||||
callback: (action, instance) => {
|
||||
if (action === 'confirm') {
|
||||
authRequest
|
||||
.verifyTOTP({
|
||||
code: instance.inputValue.trim()
|
||||
})
|
||||
.catch((err) => {
|
||||
clearCookiesTryLogin();
|
||||
throw err;
|
||||
})
|
||||
.then((args) => {
|
||||
userStore.getCurrentUser();
|
||||
return args;
|
||||
});
|
||||
} else if (action === 'cancel') {
|
||||
promptOTP();
|
||||
}
|
||||
},
|
||||
beforeClose: (action, instance, done) => {
|
||||
state.twoFactorAuthDialogVisible = false;
|
||||
done();
|
||||
}
|
||||
},
|
||||
beforeClose: (action, instance, done) => {
|
||||
state.twoFactorAuthDialogVisible = false;
|
||||
done();
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
function promptOTP() {
|
||||
@@ -686,36 +691,40 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
return;
|
||||
}
|
||||
state.twoFactorAuthDialogVisible = true;
|
||||
$app.$prompt(t('prompt.otp.description'), t('prompt.otp.header'), {
|
||||
distinguishCancelAndClose: true,
|
||||
cancelButtonText: t('prompt.otp.use_totp'),
|
||||
confirmButtonText: t('prompt.otp.verify'),
|
||||
inputPlaceholder: t('prompt.otp.input_placeholder'),
|
||||
inputPattern: /^[a-z0-9]{4}-[a-z0-9]{4}$/,
|
||||
inputErrorMessage: t('prompt.otp.input_error'),
|
||||
callback: (action, instance) => {
|
||||
if (action === 'confirm') {
|
||||
authRequest
|
||||
.verifyOTP({
|
||||
code: instance.inputValue.trim()
|
||||
})
|
||||
.catch((err) => {
|
||||
clearCookiesTryLogin();
|
||||
throw err;
|
||||
})
|
||||
.then((args) => {
|
||||
userStore.getCurrentUser();
|
||||
return args;
|
||||
});
|
||||
} else if (action === 'cancel') {
|
||||
promptTOTP();
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.otp.description'),
|
||||
t('prompt.otp.header'),
|
||||
{
|
||||
distinguishCancelAndClose: true,
|
||||
cancelButtonText: t('prompt.otp.use_totp'),
|
||||
confirmButtonText: t('prompt.otp.verify'),
|
||||
inputPlaceholder: t('prompt.otp.input_placeholder'),
|
||||
inputPattern: /^[a-z0-9]{4}-[a-z0-9]{4}$/,
|
||||
inputErrorMessage: t('prompt.otp.input_error'),
|
||||
callback: (action, instance) => {
|
||||
if (action === 'confirm') {
|
||||
authRequest
|
||||
.verifyOTP({
|
||||
code: instance.inputValue.trim()
|
||||
})
|
||||
.catch((err) => {
|
||||
clearCookiesTryLogin();
|
||||
throw err;
|
||||
})
|
||||
.then((args) => {
|
||||
userStore.getCurrentUser();
|
||||
return args;
|
||||
});
|
||||
} else if (action === 'cancel') {
|
||||
promptTOTP();
|
||||
}
|
||||
},
|
||||
beforeClose: (action, instance, done) => {
|
||||
state.twoFactorAuthDialogVisible = false;
|
||||
done();
|
||||
}
|
||||
},
|
||||
beforeClose: (action, instance, done) => {
|
||||
state.twoFactorAuthDialogVisible = false;
|
||||
done();
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
function promptEmailOTP() {
|
||||
@@ -724,7 +733,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
}
|
||||
AppApi.FlashWindow();
|
||||
state.twoFactorAuthDialogVisible = true;
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.email_otp.description'),
|
||||
t('prompt.email_otp.header'),
|
||||
{
|
||||
@@ -840,20 +849,20 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
state.autoLoginAttempts.add(new Date().getTime());
|
||||
relogin(user)
|
||||
.then(() => {
|
||||
if (AppGlobal.errorNoty) {
|
||||
AppGlobal.errorNoty.close();
|
||||
if (AppDebug.errorNoty) {
|
||||
AppDebug.errorNoty.close();
|
||||
}
|
||||
AppGlobal.errorNoty = new Noty({
|
||||
AppDebug.errorNoty = new Noty({
|
||||
type: 'success',
|
||||
text: 'Automatically logged in.'
|
||||
}).show();
|
||||
console.log('Automatically logged in.');
|
||||
})
|
||||
.catch((err) => {
|
||||
if (AppGlobal.errorNoty) {
|
||||
AppGlobal.errorNoty.close();
|
||||
if (AppDebug.errorNoty) {
|
||||
AppDebug.errorNoty.close();
|
||||
}
|
||||
AppGlobal.errorNoty = new Noty({
|
||||
AppDebug.errorNoty = new Noty({
|
||||
type: 'error',
|
||||
text: 'Failed to login automatically.'
|
||||
}).show();
|
||||
@@ -861,7 +870,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
})
|
||||
.finally(() => {
|
||||
if (!navigator.onLine) {
|
||||
AppGlobal.errorNoty = new Noty({
|
||||
AppDebug.errorNoty = new Noty({
|
||||
type: 'error',
|
||||
text: `You're offline.`
|
||||
}).show();
|
||||
@@ -879,6 +888,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
loginForm,
|
||||
enablePrimaryPasswordDialog,
|
||||
saveCredentials,
|
||||
|
||||
+51
-74
@@ -1,10 +1,9 @@
|
||||
import Noty from 'noty';
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { avatarRequest, imageRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import { computed, reactive, watch, nextTick } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { avatarRequest, miscRequest } from '../api';
|
||||
import { database } from '../service/database';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import webApiService from '../service/webapi';
|
||||
import { watchState } from '../service/watchState';
|
||||
import {
|
||||
@@ -53,15 +52,16 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
cacheSize: '',
|
||||
cacheLocked: false,
|
||||
cachePath: '',
|
||||
fileAnalysis: {}
|
||||
fileAnalysis: []
|
||||
},
|
||||
cachedAvatarModerations: new Map(),
|
||||
avatarHistory: new Set(),
|
||||
avatarHistoryArray: [],
|
||||
cachedAvatars: new Map(),
|
||||
cachedAvatarNames: new Map()
|
||||
avatarHistoryArray: []
|
||||
});
|
||||
|
||||
let cachedAvatarModerations = new Map();
|
||||
let cachedAvatars = new Map();
|
||||
let cachedAvatarNames = new Map();
|
||||
|
||||
const avatarDialog = computed({
|
||||
get: () => state.avatarDialog,
|
||||
set: (value) => {
|
||||
@@ -76,34 +76,13 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const cachedAvatarModerations = computed({
|
||||
get: () => state.cachedAvatarModerations,
|
||||
set: (value) => {
|
||||
state.cachedAvatarModerations = value;
|
||||
}
|
||||
});
|
||||
|
||||
const cachedAvatars = computed({
|
||||
get: () => state.cachedAvatars,
|
||||
set: (value) => {
|
||||
state.cachedAvatars = value;
|
||||
}
|
||||
});
|
||||
|
||||
const cachedAvatarNames = computed({
|
||||
get: () => state.cachedAvatarNames,
|
||||
set: (value) => {
|
||||
state.cachedAvatarNames = value;
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => watchState.isLoggedIn,
|
||||
(isLoggedIn) => {
|
||||
state.avatarDialog.visible = false;
|
||||
state.cachedAvatars.clear();
|
||||
state.cachedAvatarNames.clear();
|
||||
state.cachedAvatarModerations.clear();
|
||||
cachedAvatars.clear();
|
||||
cachedAvatarNames.clear();
|
||||
cachedAvatarModerations.clear();
|
||||
state.avatarHistory.clear();
|
||||
state.avatarHistoryArray = [];
|
||||
if (isLoggedIn) {
|
||||
@@ -120,7 +99,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
function applyAvatar(json) {
|
||||
json.name = replaceBioSymbols(json.name);
|
||||
json.description = replaceBioSymbols(json.description);
|
||||
let ref = state.cachedAvatars.get(json.id);
|
||||
let ref = cachedAvatars.get(json.id);
|
||||
if (typeof ref === 'undefined') {
|
||||
ref = {
|
||||
acknowledgements: '',
|
||||
@@ -152,7 +131,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
version: 0,
|
||||
...json
|
||||
};
|
||||
state.cachedAvatars.set(ref.id, ref);
|
||||
cachedAvatars.set(ref.id, ref);
|
||||
} else {
|
||||
const { unityPackages } = ref;
|
||||
Object.assign(ref, json);
|
||||
@@ -212,7 +191,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
D.cacheSize = '';
|
||||
D.cacheLocked = false;
|
||||
D.cachePath = '';
|
||||
D.fileAnalysis = {};
|
||||
D.fileAnalysis = [];
|
||||
D.isQuestFallback = false;
|
||||
D.isPC = false;
|
||||
D.isQuest = false;
|
||||
@@ -228,8 +207,8 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
favoriteStore.cachedFavoritesByObjectId.has(avatarId) ||
|
||||
(userStore.currentUser.$isVRCPlus &&
|
||||
favoriteStore.localAvatarFavoritesList.includes(avatarId));
|
||||
D.isBlocked = state.cachedAvatarModerations.has(avatarId);
|
||||
const ref2 = state.cachedAvatars.get(avatarId);
|
||||
D.isBlocked = cachedAvatarModerations.has(avatarId);
|
||||
const ref2 = cachedAvatars.get(avatarId);
|
||||
if (typeof ref2 !== 'undefined') {
|
||||
D.ref = ref2;
|
||||
updateVRChatAvatarCache();
|
||||
@@ -277,12 +256,12 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
throw err;
|
||||
})
|
||||
.finally(() => {
|
||||
$app.$nextTick(() => (D.loading = false));
|
||||
nextTick(() => (D.loading = false));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.getAvatarGallery`
|
||||
*
|
||||
* @param {string} avatarId
|
||||
* @returns {Promise<string[]>}
|
||||
*/
|
||||
@@ -325,7 +304,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
json.created = new Date(json.created).toJSON();
|
||||
}
|
||||
|
||||
let ref = state.cachedAvatarModerations.get(json.targetAvatarId);
|
||||
let ref = cachedAvatarModerations.get(json.targetAvatarId);
|
||||
if (typeof ref === 'undefined') {
|
||||
ref = {
|
||||
avatarModerationType: '',
|
||||
@@ -333,7 +312,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
targetAvatarId: '',
|
||||
...json
|
||||
};
|
||||
state.cachedAvatarModerations.set(ref.targetAvatarId, ref);
|
||||
cachedAvatarModerations.set(ref.targetAvatarId, ref);
|
||||
} else {
|
||||
Object.assign(ref, json);
|
||||
}
|
||||
@@ -370,7 +349,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.getAvatarHistory`
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getAvatarHistory() {
|
||||
@@ -428,16 +407,15 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
}
|
||||
|
||||
function promptClearAvatarHistory() {
|
||||
$app.$confirm('Continue? Clear Avatar History', 'Confirm', {
|
||||
ElMessageBox.confirm('Continue? Clear Avatar History', 'Confirm', {
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'info',
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
clearAvatarHistory();
|
||||
}
|
||||
}
|
||||
});
|
||||
type: 'info'
|
||||
})
|
||||
.then(() => {
|
||||
clearAvatarHistory();
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -453,12 +431,12 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
avatarName: '-'
|
||||
};
|
||||
}
|
||||
if (state.cachedAvatarNames.has(fileId)) {
|
||||
return state.cachedAvatarNames.get(fileId);
|
||||
if (cachedAvatarNames.has(fileId)) {
|
||||
return cachedAvatarNames.get(fileId);
|
||||
}
|
||||
try {
|
||||
const args = await imageRequest.getAvatarImages({ fileId });
|
||||
return storeAvatarImage(args, state.cachedAvatarNames);
|
||||
const args = await miscRequest.getFile({ fileId });
|
||||
return storeAvatarImage(args, cachedAvatarNames);
|
||||
} catch (error) {
|
||||
console.error('Failed to get avatar images:', error);
|
||||
return {
|
||||
@@ -483,7 +461,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
}
|
||||
});
|
||||
const json = JSON.parse(response.data);
|
||||
if (AppGlobal.debugWebRequests) {
|
||||
if (AppDebug.debugWebRequests) {
|
||||
console.log(json, response);
|
||||
}
|
||||
if (response.status === 200 && typeof json === 'object') {
|
||||
@@ -511,7 +489,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
} catch (err) {
|
||||
const msg = `Avatar search failed for ${search} with ${avatarProviderStore.avatarRemoteDatabaseProvider}\n${err}`;
|
||||
console.error(msg);
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: msg,
|
||||
type: 'error'
|
||||
});
|
||||
@@ -563,7 +541,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
}
|
||||
});
|
||||
const json = JSON.parse(response.data);
|
||||
if (AppGlobal.debugWebRequests) {
|
||||
if (AppDebug.debugWebRequests) {
|
||||
console.log(json, response);
|
||||
}
|
||||
if (response.status === 200 && typeof json === 'object') {
|
||||
@@ -589,7 +567,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
} catch (err) {
|
||||
const msg = `Avatar lookup failed for ${authorId} with ${url}\n${err}`;
|
||||
console.error(msg);
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: msg,
|
||||
type: 'error'
|
||||
});
|
||||
@@ -598,22 +576,20 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
}
|
||||
|
||||
function selectAvatarWithConfirmation(id) {
|
||||
$app.$confirm(`Continue? Select Avatar`, 'Confirm', {
|
||||
ElMessageBox.confirm(`Continue? Select Avatar`, 'Confirm', {
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'info',
|
||||
callback: (action) => {
|
||||
if (action !== 'confirm') {
|
||||
return;
|
||||
}
|
||||
type: 'info'
|
||||
})
|
||||
.then(() => {
|
||||
selectAvatarWithoutConfirmation(id);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
function selectAvatarWithoutConfirmation(id) {
|
||||
if (userStore.currentUser.currentAvatar === id) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Avatar already selected',
|
||||
type: 'info'
|
||||
});
|
||||
@@ -624,7 +600,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
avatarId: id
|
||||
})
|
||||
.then(() => {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Avatar changed',
|
||||
type: 'success'
|
||||
});
|
||||
@@ -633,7 +609,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
|
||||
function checkAvatarCache(fileId) {
|
||||
let avatarId = '';
|
||||
for (let ref of state.cachedAvatars.values()) {
|
||||
for (let ref of cachedAvatars.values()) {
|
||||
if (extractFileId(ref.imageUrl) === fileId) {
|
||||
avatarId = ref.id;
|
||||
}
|
||||
@@ -659,7 +635,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
) {
|
||||
const fileId = extractFileId(currentAvatarImageUrl);
|
||||
if (!fileId) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Sorry, the author is unknown',
|
||||
type: 'error'
|
||||
});
|
||||
@@ -682,13 +658,13 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
}
|
||||
if (!avatarId) {
|
||||
if (avatarInfo.ownerId === refUserId) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message:
|
||||
"It's personal (own) avatar or not found in avatar database",
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Avatar not found in avatar database',
|
||||
type: 'warning'
|
||||
});
|
||||
@@ -712,6 +688,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
avatarDialog,
|
||||
avatarHistory,
|
||||
avatarHistoryArray,
|
||||
|
||||
+99
-188
@@ -1,7 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { favoriteRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import { database } from '../service/database';
|
||||
import { processBulk } from '../service/request';
|
||||
import { watchState } from '../service/watchState';
|
||||
@@ -12,7 +12,7 @@ import { useAppearanceSettingsStore } from './settings/appearance';
|
||||
import { useGeneralSettingsStore } from './settings/general';
|
||||
import { useUserStore } from './user';
|
||||
import { useWorldStore } from './world';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
const appearanceSettingsStore = useAppearanceSettingsStore();
|
||||
@@ -41,7 +41,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
},
|
||||
cachedFavoriteGroupsByTypeName: new Map(),
|
||||
cachedFavorites: new Map(),
|
||||
favoriteWorldGroups: [],
|
||||
favoriteAvatarGroups: [],
|
||||
isFavoriteLoading: false,
|
||||
@@ -77,6 +76,21 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
cachedFavoritesByObjectId: new Map()
|
||||
});
|
||||
|
||||
let cachedFavorites = new Map();
|
||||
|
||||
const cachedFavoriteGroups = computed({
|
||||
get: () => state.cachedFavoriteGroups,
|
||||
set: (value) => {
|
||||
state.cachedFavoriteGroups = value;
|
||||
}
|
||||
});
|
||||
const cachedFavoriteGroupsByTypeName = computed({
|
||||
get: () => state.cachedFavoriteGroupsByTypeName,
|
||||
set: (value) => {
|
||||
state.cachedFavoriteGroupsByTypeName = value;
|
||||
}
|
||||
});
|
||||
|
||||
const favoriteFriends = computed(() => {
|
||||
if (state.sortFavoriteFriends) {
|
||||
state.sortFavoriteFriends = false;
|
||||
@@ -144,10 +158,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const cachedFavoriteGroups = state.cachedFavoriteGroups;
|
||||
const cachedFavoriteGroupsByTypeName = state.cachedFavoriteGroupsByTypeName;
|
||||
const cachedFavorites = state.cachedFavorites;
|
||||
|
||||
const favoriteLimits = computed({
|
||||
get() {
|
||||
return state.favoriteLimits;
|
||||
@@ -265,15 +275,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const favoriteObjects = computed({
|
||||
get() {
|
||||
return state.favoriteObjects;
|
||||
},
|
||||
set(value) {
|
||||
state.favoriteObjects = value;
|
||||
}
|
||||
});
|
||||
|
||||
const localWorldFavoritesList = computed({
|
||||
get() {
|
||||
return state.localWorldFavoritesList;
|
||||
@@ -283,87 +284,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const favoriteFriends_ = computed({
|
||||
get() {
|
||||
return state.favoriteFriends_;
|
||||
},
|
||||
set(value) {
|
||||
state.favoriteFriends_ = value;
|
||||
}
|
||||
});
|
||||
|
||||
const favoriteFriendsSorted = computed({
|
||||
get() {
|
||||
return state.favoriteFriendsSorted;
|
||||
},
|
||||
set(value) {
|
||||
state.favoriteFriendsSorted = value;
|
||||
}
|
||||
});
|
||||
|
||||
const favoriteWorlds_ = computed({
|
||||
get() {
|
||||
return state.favoriteWorlds_;
|
||||
},
|
||||
set(value) {
|
||||
state.favoriteWorlds_ = value;
|
||||
}
|
||||
});
|
||||
|
||||
const favoriteWorldsSorted = computed({
|
||||
get() {
|
||||
return state.favoriteWorldsSorted;
|
||||
},
|
||||
set(value) {
|
||||
state.favoriteWorldsSorted = value;
|
||||
}
|
||||
});
|
||||
|
||||
const favoriteAvatars_ = computed({
|
||||
get() {
|
||||
return state.favoriteAvatars_;
|
||||
},
|
||||
set(value) {
|
||||
state.favoriteAvatars_ = value;
|
||||
}
|
||||
});
|
||||
|
||||
const favoriteAvatarsSorted = computed({
|
||||
get() {
|
||||
return state.favoriteAvatarsSorted;
|
||||
},
|
||||
set(value) {
|
||||
state.favoriteAvatarsSorted = value;
|
||||
}
|
||||
});
|
||||
|
||||
const sortFavoriteFriends = computed({
|
||||
get() {
|
||||
return state.sortFavoriteFriends;
|
||||
},
|
||||
set(value) {
|
||||
state.sortFavoriteFriends = value;
|
||||
}
|
||||
});
|
||||
|
||||
const sortFavoriteWorlds = computed({
|
||||
get() {
|
||||
return state.sortFavoriteWorlds;
|
||||
},
|
||||
set(value) {
|
||||
state.sortFavoriteWorlds = value;
|
||||
}
|
||||
});
|
||||
|
||||
const sortFavoriteAvatars = computed({
|
||||
get() {
|
||||
return state.sortFavoriteAvatars;
|
||||
},
|
||||
set(value) {
|
||||
state.sortFavoriteAvatars = value;
|
||||
}
|
||||
});
|
||||
|
||||
const cachedFavoritesByObjectId = computed({
|
||||
get() {
|
||||
return state.cachedFavoritesByObjectId;
|
||||
@@ -399,7 +319,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
() => watchState.isLoggedIn,
|
||||
(isLoggedIn) => {
|
||||
friendStore.localFavoriteFriends.clear();
|
||||
state.cachedFavorites.clear();
|
||||
cachedFavorites.clear();
|
||||
state.cachedFavoritesByObjectId.clear();
|
||||
state.cachedFavoriteGroups.clear();
|
||||
state.cachedFavoriteGroupsByTypeName.clear();
|
||||
@@ -536,7 +456,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
|
||||
function handleFavoriteGroupClear(args) {
|
||||
const key = `${args.params.type}:${args.params.group}`;
|
||||
for (const ref of state.cachedFavorites.values()) {
|
||||
for (const ref of cachedFavorites.values()) {
|
||||
if (ref.$isDeleted || ref.$groupKey !== key) {
|
||||
continue;
|
||||
}
|
||||
@@ -573,7 +493,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
|
||||
function expireFavorites() {
|
||||
friendStore.localFavoriteFriends.clear();
|
||||
state.cachedFavorites.clear();
|
||||
cachedFavorites.clear();
|
||||
state.cachedFavoritesByObjectId.clear();
|
||||
state.favoriteObjects.clear();
|
||||
state.favoriteFriends_ = [];
|
||||
@@ -625,7 +545,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.applyFavorite`
|
||||
*
|
||||
* @param {'friend' | 'world' | 'avatar'} type
|
||||
* @param {string} objectId
|
||||
* @param {boolean} sortTop
|
||||
@@ -952,7 +872,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
state.cachedFavoriteGroupsByTypeName.set(group.key, group);
|
||||
}
|
||||
}
|
||||
for (ref of state.cachedFavorites.values()) {
|
||||
for (ref of cachedFavorites.values()) {
|
||||
ref.$groupRef = null;
|
||||
if (ref.$isDeleted) {
|
||||
continue;
|
||||
@@ -1054,7 +974,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
* @returns {any}
|
||||
*/
|
||||
function applyFavoriteCached(json) {
|
||||
let ref = state.cachedFavorites.get(json.id);
|
||||
let ref = cachedFavorites.get(json.id);
|
||||
if (typeof ref === 'undefined') {
|
||||
ref = {
|
||||
id: '',
|
||||
@@ -1069,7 +989,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
//
|
||||
...json
|
||||
};
|
||||
state.cachedFavorites.set(ref.id, ref);
|
||||
cachedFavorites.set(ref.id, ref);
|
||||
state.cachedFavoritesByObjectId.set(ref.favoriteId, ref);
|
||||
if (
|
||||
ref.type === 'friend' &&
|
||||
@@ -1103,7 +1023,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
*
|
||||
*/
|
||||
function deleteExpiredFavorites() {
|
||||
for (const ref of state.cachedFavorites.values()) {
|
||||
for (const ref of cachedFavorites.values()) {
|
||||
if (ref.$isDeleted || ref.$isExpired === false) {
|
||||
continue;
|
||||
}
|
||||
@@ -1141,7 +1061,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
avatar: [0, favoriteRequest.getFavoriteAvatars]
|
||||
};
|
||||
const tags = [];
|
||||
for (const ref of state.cachedFavorites.values()) {
|
||||
for (const ref of cachedFavorites.values()) {
|
||||
if (ref.$isDeleted) {
|
||||
continue;
|
||||
}
|
||||
@@ -1187,9 +1107,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.clearBulkFavoriteSelection`
|
||||
*/
|
||||
function clearBulkFavoriteSelection() {
|
||||
let ctx;
|
||||
for (ctx of state.favoriteFriends_) {
|
||||
@@ -1216,7 +1133,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.getLocalWorldFavoriteGroupLength`
|
||||
*
|
||||
* @param {string} group
|
||||
* @returns {*|number}
|
||||
*/
|
||||
@@ -1229,7 +1146,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.addLocalWorldFavorite`
|
||||
*
|
||||
* @param {string} worldId
|
||||
* @param {string} group
|
||||
*/
|
||||
@@ -1271,7 +1188,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.hasLocalWorldFavorite`
|
||||
*
|
||||
* @param {string} worldId
|
||||
* @param {string} group
|
||||
* @returns {boolean}
|
||||
@@ -1290,7 +1207,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.addLocalAvatarFavorite`
|
||||
*
|
||||
* @param {string} avatarId
|
||||
* @param {string} group
|
||||
*/
|
||||
@@ -1332,7 +1249,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.hasLocalAvatarFavorite`
|
||||
*
|
||||
* @param {string} avatarId
|
||||
* @param {string} group
|
||||
* @returns {boolean}
|
||||
@@ -1351,7 +1268,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.getLocalAvatarFavoriteGroupLength`
|
||||
*
|
||||
* @param {string} group
|
||||
* @returns {*|number}
|
||||
*/
|
||||
@@ -1394,7 +1311,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.deleteLocalAvatarFavoriteGroup`
|
||||
*
|
||||
* @param {string} group
|
||||
*/
|
||||
function deleteLocalAvatarFavoriteGroup(group) {
|
||||
@@ -1465,9 +1382,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.sortLocalAvatarFavorites`
|
||||
*/
|
||||
function sortLocalAvatarFavorites() {
|
||||
state.localAvatarFavoriteGroups.sort();
|
||||
if (!appearanceSettingsStore.sortFavorites) {
|
||||
@@ -1481,13 +1395,13 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.renameLocalAvatarFavoriteGroup`
|
||||
*
|
||||
* @param {string} newName
|
||||
* @param {string} group
|
||||
*/
|
||||
function renameLocalAvatarFavoriteGroup(newName, group) {
|
||||
if (state.localAvatarFavoriteGroups.includes(newName)) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t('prompt.local_favorite_group_rename.message.error', {
|
||||
name: newName
|
||||
}),
|
||||
@@ -1505,12 +1419,12 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.newLocalAvatarFavoriteGroup`
|
||||
*
|
||||
* @param {string} group
|
||||
*/
|
||||
function newLocalAvatarFavoriteGroup(group) {
|
||||
if (state.localAvatarFavoriteGroups.includes(group)) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t('prompt.new_local_favorite_group.message.error', {
|
||||
name: group
|
||||
}),
|
||||
@@ -1528,52 +1442,56 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.getLocalAvatarFavorites`
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getLocalAvatarFavorites() {
|
||||
let ref;
|
||||
let i;
|
||||
state.localAvatarFavoriteGroups = [];
|
||||
state.localAvatarFavoritesList = [];
|
||||
state.localAvatarFavorites = {};
|
||||
const localGroups = new Set();
|
||||
const localListSet = new Set();
|
||||
const localFavorites = Object.create(null);
|
||||
|
||||
const avatarCache = await database.getAvatarCache();
|
||||
for (i = 0; i < avatarCache.length; ++i) {
|
||||
ref = avatarCache[i];
|
||||
for (let i = 0; i < avatarCache.length; ++i) {
|
||||
const ref = avatarCache[i];
|
||||
if (!avatarStore.cachedAvatars.has(ref.id)) {
|
||||
avatarStore.applyAvatar(ref);
|
||||
}
|
||||
}
|
||||
|
||||
const favorites = await database.getAvatarFavorites();
|
||||
for (i = 0; i < favorites.length; ++i) {
|
||||
for (let i = 0; i < favorites.length; ++i) {
|
||||
const favorite = favorites[i];
|
||||
if (!state.localAvatarFavoritesList.includes(favorite.avatarId)) {
|
||||
state.localAvatarFavoritesList.push(favorite.avatarId);
|
||||
|
||||
localListSet.add(favorite.avatarId);
|
||||
|
||||
if (!localFavorites[favorite.groupName]) {
|
||||
localFavorites[favorite.groupName] = [];
|
||||
}
|
||||
if (!state.localAvatarFavorites[favorite.groupName]) {
|
||||
state.localAvatarFavorites[favorite.groupName] = [];
|
||||
}
|
||||
if (!state.localAvatarFavoriteGroups.includes(favorite.groupName)) {
|
||||
state.localAvatarFavoriteGroups.push(favorite.groupName);
|
||||
}
|
||||
ref = avatarStore.cachedAvatars.get(favorite.avatarId);
|
||||
localGroups.add(favorite.groupName);
|
||||
|
||||
let ref = avatarStore.cachedAvatars.get(favorite.avatarId);
|
||||
if (typeof ref === 'undefined') {
|
||||
ref = {
|
||||
id: favorite.avatarId
|
||||
};
|
||||
ref = { id: favorite.avatarId };
|
||||
}
|
||||
state.localAvatarFavorites[favorite.groupName].unshift(ref);
|
||||
localFavorites[favorite.groupName].push(ref);
|
||||
}
|
||||
if (state.localAvatarFavoriteGroups.length === 0) {
|
||||
|
||||
let groupsArr = Array.from(localGroups);
|
||||
if (groupsArr.length === 0) {
|
||||
// default group
|
||||
state.localAvatarFavorites.Favorites = [];
|
||||
state.localAvatarFavoriteGroups.push('Favorites');
|
||||
localFavorites.Favorites = [];
|
||||
groupsArr = ['Favorites'];
|
||||
}
|
||||
|
||||
state.localAvatarFavoriteGroups = groupsArr;
|
||||
state.localAvatarFavoritesList = Array.from(localListSet);
|
||||
state.localAvatarFavorites = localFavorites;
|
||||
|
||||
sortLocalAvatarFavorites();
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.removeLocalAvatarFavorite`
|
||||
*
|
||||
* @param {string} avatarId
|
||||
* @param {string} group
|
||||
*/
|
||||
@@ -1631,7 +1549,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.deleteLocalWorldFavoriteGroup`
|
||||
*
|
||||
* @param {string} group
|
||||
*/
|
||||
function deleteLocalWorldFavoriteGroup(group) {
|
||||
@@ -1671,9 +1589,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.sortLocalWorldFavorites`
|
||||
*/
|
||||
function sortLocalWorldFavorites() {
|
||||
state.localWorldFavoriteGroups.sort();
|
||||
if (!appearanceSettingsStore.sortFavorites) {
|
||||
@@ -1687,13 +1602,13 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.renameLocalWorldFavoriteGroup`
|
||||
*
|
||||
* @param {string} newName
|
||||
* @param {string} group
|
||||
*/
|
||||
function renameLocalWorldFavoriteGroup(newName, group) {
|
||||
if (state.localWorldFavoriteGroups.includes(newName)) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t('prompt.local_favorite_group_rename.message.error', {
|
||||
name: newName
|
||||
}),
|
||||
@@ -1711,7 +1626,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.removeLocalWorldFavorite`
|
||||
*
|
||||
* @param {string} worldId
|
||||
* @param {string} group
|
||||
*/
|
||||
@@ -1767,13 +1682,14 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.getLocalWorldFavorites`
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getLocalWorldFavorites() {
|
||||
state.localWorldFavoriteGroups = [];
|
||||
state.localWorldFavoritesList = [];
|
||||
state.localWorldFavorites = {};
|
||||
const localGroups = new Set();
|
||||
const localListSet = new Set();
|
||||
const localFavorites = Object.create(null);
|
||||
|
||||
const worldCache = await database.getWorldCache();
|
||||
for (let i = 0; i < worldCache.length; ++i) {
|
||||
const ref = worldCache[i];
|
||||
@@ -1781,41 +1697,46 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
worldStore.applyWorld(ref);
|
||||
}
|
||||
}
|
||||
|
||||
const favorites = await database.getWorldFavorites();
|
||||
for (let i = 0; i < favorites.length; ++i) {
|
||||
const favorite = favorites[i];
|
||||
if (!state.localWorldFavoritesList.includes(favorite.worldId)) {
|
||||
state.localWorldFavoritesList.push(favorite.worldId);
|
||||
}
|
||||
if (!state.localWorldFavorites[favorite.groupName]) {
|
||||
state.localWorldFavorites[favorite.groupName] = [];
|
||||
}
|
||||
if (!state.localWorldFavoriteGroups.includes(favorite.groupName)) {
|
||||
state.localWorldFavoriteGroups.push(favorite.groupName);
|
||||
|
||||
localListSet.add(favorite.worldId);
|
||||
|
||||
if (!localFavorites[favorite.groupName]) {
|
||||
localFavorites[favorite.groupName] = [];
|
||||
}
|
||||
localGroups.add(favorite.groupName);
|
||||
|
||||
let ref = worldStore.cachedWorlds.get(favorite.worldId);
|
||||
if (typeof ref === 'undefined') {
|
||||
ref = {
|
||||
id: favorite.worldId
|
||||
};
|
||||
ref = { id: favorite.worldId };
|
||||
}
|
||||
state.localWorldFavorites[favorite.groupName].unshift(ref);
|
||||
localFavorites[favorite.groupName].push(ref);
|
||||
}
|
||||
if (state.localWorldFavoriteGroups.length === 0) {
|
||||
|
||||
let groupsArr = Array.from(localGroups);
|
||||
if (groupsArr.length === 0) {
|
||||
localFavorites.Favorites = [];
|
||||
// default group
|
||||
state.localWorldFavorites.Favorites = [];
|
||||
state.localWorldFavoriteGroups.push('Favorites');
|
||||
groupsArr = ['Favorites'];
|
||||
}
|
||||
|
||||
state.localWorldFavoriteGroups = groupsArr;
|
||||
state.localWorldFavoritesList = Array.from(localListSet);
|
||||
state.localWorldFavorites = localFavorites;
|
||||
|
||||
sortLocalWorldFavorites();
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.newLocalWorldFavoriteGroup`
|
||||
*
|
||||
* @param {string} group
|
||||
*/
|
||||
function newLocalWorldFavoriteGroup(group) {
|
||||
if (state.localWorldFavoriteGroups.includes(group)) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t('prompt.new_local_favorite_group.message.error', {
|
||||
name: group
|
||||
}),
|
||||
@@ -1833,7 +1754,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.deleteFavoriteNoConfirm`
|
||||
*
|
||||
* @param {string} objectId
|
||||
*/
|
||||
function deleteFavoriteNoConfirm(objectId) {
|
||||
@@ -1898,17 +1819,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
localAvatarFavoritesList,
|
||||
localAvatarFavoriteGroups,
|
||||
favoriteDialog,
|
||||
favoriteObjects,
|
||||
localWorldFavoritesList,
|
||||
favoriteFriends_,
|
||||
favoriteFriendsSorted,
|
||||
favoriteWorlds_,
|
||||
favoriteWorldsSorted,
|
||||
favoriteAvatars_,
|
||||
favoriteAvatarsSorted,
|
||||
sortFavoriteFriends,
|
||||
sortFavoriteWorlds,
|
||||
sortFavoriteAvatars,
|
||||
cachedFavoritesByObjectId,
|
||||
localWorldFavoriteGroups,
|
||||
groupedByGroupKeyFavoriteFriends,
|
||||
|
||||
+2
-1
@@ -25,7 +25,7 @@ export const useFeedStore = defineStore('Feed', () => {
|
||||
filter: [],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini',
|
||||
size: 'small',
|
||||
defaultSort: {
|
||||
prop: 'created_at',
|
||||
order: 'descending'
|
||||
@@ -229,6 +229,7 @@ export const useFeedStore = defineStore('Feed', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
feedTable,
|
||||
feedSessionTable,
|
||||
initFeedTable,
|
||||
|
||||
+98
-84
@@ -1,11 +1,11 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import { friendRequest, userRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import configRepository from '../service/config';
|
||||
import { database } from '../service/database';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { reconnectWebSocket } from '../service/websocket';
|
||||
import { watchState } from '../service/watchState';
|
||||
import {
|
||||
@@ -30,7 +30,7 @@ import { useSharedFeedStore } from './sharedFeed';
|
||||
import { useUiStore } from './ui';
|
||||
import { useUpdateLoopStore } from './updateLoop';
|
||||
import { useUserStore } from './user';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export const useFriendStore = defineStore('Friend', () => {
|
||||
const appearanceSettingsStore = useAppearanceSettingsStore();
|
||||
@@ -58,7 +58,6 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
localFavoriteFriends: new Set(),
|
||||
isRefreshFriendsLoading: false,
|
||||
onlineFriendCount: 0,
|
||||
friendLog: new Map(),
|
||||
friendLogTable: {
|
||||
data: [],
|
||||
filters: [
|
||||
@@ -81,7 +80,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini',
|
||||
size: 'small',
|
||||
defaultSort: {
|
||||
prop: 'created_at',
|
||||
order: 'descending'
|
||||
@@ -97,6 +96,26 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
friendNumber: 0
|
||||
});
|
||||
|
||||
let friendLog = new Map();
|
||||
|
||||
const friends = computed({
|
||||
get() {
|
||||
return state.friends;
|
||||
},
|
||||
set(value) {
|
||||
state.friends = value;
|
||||
}
|
||||
});
|
||||
|
||||
const localFavoriteFriends = computed({
|
||||
get() {
|
||||
return state.localFavoriteFriends;
|
||||
},
|
||||
set(value) {
|
||||
state.localFavoriteFriends = value;
|
||||
}
|
||||
});
|
||||
|
||||
async function init() {
|
||||
const friendLogTableFiltersValue = JSON.parse(
|
||||
await configRepository.getString('VRCX_friendLogTableFilters', '[]')
|
||||
@@ -106,8 +125,6 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
|
||||
init();
|
||||
|
||||
const friends = state.friends;
|
||||
|
||||
// friends_(array) may not have change records in pinia because does not use action
|
||||
const onlineFriends_ = computed({
|
||||
get() {
|
||||
@@ -173,7 +190,6 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
state.sortOfflineFriends = value;
|
||||
}
|
||||
});
|
||||
const localFavoriteFriends = state.localFavoriteFriends;
|
||||
|
||||
// VIP friends
|
||||
const vipFriends = computed(() => {
|
||||
@@ -247,15 +263,6 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const friendLog = computed({
|
||||
get() {
|
||||
return state.friendLog;
|
||||
},
|
||||
set(value) {
|
||||
state.friendLog = value;
|
||||
}
|
||||
});
|
||||
|
||||
const friendLogTable = computed({
|
||||
get() {
|
||||
return state.friendLogTable;
|
||||
@@ -270,7 +277,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
(isLoggedIn) => {
|
||||
state.friends.clear();
|
||||
state.friendNumber = 0;
|
||||
state.friendLog.clear();
|
||||
friendLog.clear();
|
||||
state.friendLogTable.data = [];
|
||||
groupStore.groupInstances = [];
|
||||
state.vipFriends_ = [];
|
||||
@@ -343,7 +350,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
if (
|
||||
watchState.isFriendsLoaded &&
|
||||
ref.isFriend &&
|
||||
!state.friendLog.has(ref.id) &&
|
||||
!friendLog.has(ref.id) &&
|
||||
ref.id !== userStore.currentUser.id
|
||||
) {
|
||||
addFriendship(ref.id);
|
||||
@@ -429,7 +436,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
}
|
||||
if (stateInput === 'online') {
|
||||
if (AppGlobal.debugFriendState && ctx.pendingOffline) {
|
||||
if (AppDebug.debugFriendState && ctx.pendingOffline) {
|
||||
const time = (Date.now() - ctx.pendingOfflineTime) / 1000;
|
||||
console.log(`${ctx.name} pendingOfflineCancelTime ${time}`);
|
||||
}
|
||||
@@ -534,12 +541,12 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
// prevent status flapping
|
||||
if (ctx.pendingOffline) {
|
||||
if (AppGlobal.debugFriendState) {
|
||||
if (AppDebug.debugFriendState) {
|
||||
console.log(ctx.name, 'pendingOfflineAlreadyWaiting');
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (AppGlobal.debugFriendState) {
|
||||
if (AppDebug.debugFriendState) {
|
||||
console.log(ctx.name, 'pendingOfflineBegin');
|
||||
}
|
||||
ctx.pendingOffline = true;
|
||||
@@ -547,7 +554,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
// wait 2minutes then check if user came back online
|
||||
workerTimers.setTimeout(() => {
|
||||
if (!ctx.pendingOffline) {
|
||||
if (AppGlobal.debugFriendState) {
|
||||
if (AppDebug.debugFriendState) {
|
||||
console.log(ctx.name, 'pendingOfflineAlreadyCancelled');
|
||||
}
|
||||
return;
|
||||
@@ -555,7 +562,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
ctx.pendingOffline = false;
|
||||
ctx.pendingOfflineTime = '';
|
||||
if (ctx.pendingState === ctx.state) {
|
||||
if (AppGlobal.debugFriendState) {
|
||||
if (AppDebug.debugFriendState) {
|
||||
console.log(
|
||||
ctx.name,
|
||||
'pendingOfflineCancelledStateMatched'
|
||||
@@ -563,7 +570,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (AppGlobal.debugFriendState) {
|
||||
if (AppDebug.debugFriendState) {
|
||||
console.log(ctx.name, 'pendingOfflineEnd');
|
||||
}
|
||||
updateFriendDelayedCheck(ctx, location, $location_at);
|
||||
@@ -602,7 +609,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
let worldName;
|
||||
const id = ctx.id;
|
||||
const newState = ctx.pendingState;
|
||||
if (AppGlobal.debugFriendState) {
|
||||
if (AppDebug.debugFriendState) {
|
||||
console.log(
|
||||
`${ctx.name} updateFriendState ${ctx.state} -> ${newState}`
|
||||
);
|
||||
@@ -736,7 +743,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* aka: `$app.refreshFriends`
|
||||
*
|
||||
* @param ref
|
||||
*/
|
||||
function refreshFriendsStatus(ref) {
|
||||
@@ -780,11 +787,11 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
const ref = userStore.cachedUsers.get(id);
|
||||
const isVIP = state.localFavoriteFriends.has(id);
|
||||
let name = '';
|
||||
const friend = state.friendLog.get(id);
|
||||
const friend = friendLog.get(id);
|
||||
if (friend) {
|
||||
name = friend.displayName;
|
||||
}
|
||||
const ctx = {
|
||||
const ctx = reactive({
|
||||
id,
|
||||
state: state_input || 'offline',
|
||||
isVIP,
|
||||
@@ -795,7 +802,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
pendingOfflineTime: '',
|
||||
pendingState: '',
|
||||
$nickName: ''
|
||||
};
|
||||
});
|
||||
if (watchState.isFriendsLoaded) {
|
||||
getUserMemo(id).then((memo) => {
|
||||
if (memo.userId === id) {
|
||||
@@ -809,7 +816,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
});
|
||||
}
|
||||
if (typeof ref === 'undefined') {
|
||||
const friendLogRef = state.friendLog.get(id);
|
||||
const friendLogRef = friendLog.get(id);
|
||||
if (friendLogRef?.displayName) {
|
||||
ctx.name = friendLogRef.displayName;
|
||||
}
|
||||
@@ -961,7 +968,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
const ref = state.friends.get(friend.id);
|
||||
if (ref?.state !== state_input) {
|
||||
if (AppGlobal.debugFriendState) {
|
||||
if (AppDebug.debugFriendState) {
|
||||
console.log(
|
||||
`Refetching friend state it does not match ${friend.displayName} from ${ref?.state} to ${state_input}`,
|
||||
friend
|
||||
@@ -972,7 +979,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
});
|
||||
friends[i] = args.json;
|
||||
} else if (friend.location === 'traveling') {
|
||||
if (AppGlobal.debugFriendState) {
|
||||
if (AppDebug.debugFriendState) {
|
||||
console.log(
|
||||
'Refetching traveling friend',
|
||||
friend.displayName
|
||||
@@ -995,8 +1002,9 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
async function refreshRemainingFriends(friends) {
|
||||
const friendsSet = new Set(friends.map((x) => x.id));
|
||||
for (const userId of userStore.currentUser.friends) {
|
||||
if (!friends.some((x) => x.id === userId)) {
|
||||
if (!friendsSet.has(userId)) {
|
||||
try {
|
||||
if (!watchState.isLoggedIn) {
|
||||
console.error(`User isn't logged in`);
|
||||
@@ -1062,26 +1070,33 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
|
||||
const data = await database.getAllUserStats(userIds, displayNames);
|
||||
|
||||
const dataByDisplayName = new Map();
|
||||
const friendsByDisplayName = new Map();
|
||||
|
||||
for (const ref of data) {
|
||||
if (ref.displayName && ref.userId) {
|
||||
dataByDisplayName.set(ref.displayName, ref.userId);
|
||||
}
|
||||
}
|
||||
|
||||
for (const ref of state.friends.values()) {
|
||||
if (ref?.ref?.id && ref.ref.displayName) {
|
||||
friendsByDisplayName.set(ref.ref.displayName, ref.id);
|
||||
}
|
||||
}
|
||||
|
||||
const friendListMap = new Map();
|
||||
for (item of data) {
|
||||
if (!item.userId) {
|
||||
// find userId from previous data with matching displayName
|
||||
for (ref of data) {
|
||||
if (ref.displayName === item.displayName && ref.userId) {
|
||||
item.userId = ref.userId;
|
||||
}
|
||||
}
|
||||
item.userId = dataByDisplayName.get(item.displayName);
|
||||
|
||||
// if still no userId, find userId from friends list
|
||||
if (!item.userId) {
|
||||
for (ref of state.friends.values()) {
|
||||
if (
|
||||
ref?.ref?.id &&
|
||||
ref.ref.displayName === item.displayName
|
||||
) {
|
||||
item.userId = ref.id;
|
||||
}
|
||||
}
|
||||
item.userId = friendsByDisplayName.get(item.displayName);
|
||||
}
|
||||
|
||||
// if still no userId, skip
|
||||
if (!item.userId) {
|
||||
continue;
|
||||
@@ -1118,7 +1133,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
function addFriendship(id) {
|
||||
if (
|
||||
!watchState.isFriendsLoaded ||
|
||||
state.friendLog.has(id) ||
|
||||
friendLog.has(id) ||
|
||||
id === userStore.currentUser.id
|
||||
) {
|
||||
return;
|
||||
@@ -1139,7 +1154,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
return;
|
||||
}
|
||||
handleFriendStatus(args);
|
||||
if (args.json.isFriend && !state.friendLog.has(id)) {
|
||||
if (args.json.isFriend && !friendLog.has(id)) {
|
||||
if (state.friendNumber === 0) {
|
||||
state.friendNumber = state.friends.size;
|
||||
}
|
||||
@@ -1165,7 +1180,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
trustLevel: ref.$trustLevel,
|
||||
friendNumber: ref.$friendNumber
|
||||
};
|
||||
state.friendLog.set(id, friendLogCurrent);
|
||||
friendLog.set(id, friendLogCurrent);
|
||||
database.setFriendLogCurrent(friendLogCurrent);
|
||||
uiStore.notifyMenu('friendLog');
|
||||
deleteFriendRequest(id);
|
||||
@@ -1208,7 +1223,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
* @param {string} id
|
||||
*/
|
||||
function deleteFriendship(id) {
|
||||
const ctx = state.friendLog.get(id);
|
||||
const ctx = friendLog.get(id);
|
||||
if (typeof ctx === 'undefined') {
|
||||
return;
|
||||
}
|
||||
@@ -1223,7 +1238,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
return;
|
||||
}
|
||||
handleFriendStatus(args);
|
||||
if (!args.json.isFriend && state.friendLog.has(id)) {
|
||||
if (!args.json.isFriend && friendLog.has(id)) {
|
||||
const friendLogHistory = {
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'Unfriend',
|
||||
@@ -1233,7 +1248,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
state.friendLogTable.data.push(friendLogHistory);
|
||||
database.addFriendLogHistory(friendLogHistory);
|
||||
notificationStore.queueFriendLogNoty(friendLogHistory);
|
||||
state.friendLog.delete(id);
|
||||
friendLog.delete(id);
|
||||
database.deleteFriendLogCurrent(id);
|
||||
if (!appearanceSettingsStore.hideUnfriends) {
|
||||
uiStore.notifyMenu('friendLog');
|
||||
@@ -1255,9 +1270,9 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
set.add(id);
|
||||
addFriendship(id);
|
||||
}
|
||||
for (id of state.friendLog.keys()) {
|
||||
for (id of friendLog.keys()) {
|
||||
if (id === userStore.currentUser.id) {
|
||||
state.friendLog.delete(id);
|
||||
friendLog.delete(id);
|
||||
database.deleteFriendLogCurrent(id);
|
||||
} else if (!set.has(id)) {
|
||||
deleteFriendship(id);
|
||||
@@ -1270,7 +1285,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
* @param {object} ref
|
||||
*/
|
||||
function updateFriendship(ref) {
|
||||
const ctx = state.friendLog.get(ref.id);
|
||||
const ctx = friendLog.get(ref.id);
|
||||
if (!watchState.isFriendsLoaded || typeof ctx === 'undefined') {
|
||||
return;
|
||||
}
|
||||
@@ -1301,7 +1316,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
trustLevel: ref.$trustLevel,
|
||||
friendNumber: ref.$friendNumber
|
||||
};
|
||||
state.friendLog.set(ref.id, friendLogCurrent);
|
||||
friendLog.set(ref.id, friendLogCurrent);
|
||||
database.setFriendLogCurrent(friendLogCurrent);
|
||||
ctx.displayName = ref.displayName;
|
||||
uiStore.notifyMenu('friendLog');
|
||||
@@ -1325,7 +1340,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
trustLevel: ref.$trustLevel,
|
||||
friendNumber: ref.$friendNumber
|
||||
};
|
||||
state.friendLog.set(ref.id, friendLogCurrent3);
|
||||
friendLog.set(ref.id, friendLogCurrent3);
|
||||
database.setFriendLogCurrent(friendLogCurrent3);
|
||||
return;
|
||||
}
|
||||
@@ -1347,7 +1362,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
trustLevel: ref.$trustLevel,
|
||||
friendNumber: ref.$friendNumber
|
||||
};
|
||||
state.friendLog.set(ref.id, friendLogCurrent2);
|
||||
friendLog.set(ref.id, friendLogCurrent2);
|
||||
database.setFriendLogCurrent(friendLogCurrent2);
|
||||
uiStore.notifyMenu('friendLog');
|
||||
sharedFeedStore.updateSharedFeed(true);
|
||||
@@ -1372,7 +1387,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
trustLevel: ref.$trustLevel,
|
||||
friendNumber: 0
|
||||
};
|
||||
state.friendLog.set(friend.id, row);
|
||||
friendLog.set(friend.id, row);
|
||||
sqlValues.unshift(row);
|
||||
}
|
||||
database.setFriendLogCurrentArray(sqlValues);
|
||||
@@ -1414,7 +1429,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
|
||||
const friendLogCurrentArray = await database.getFriendLogCurrent();
|
||||
for (friend of friendLogCurrentArray) {
|
||||
state.friendLog.set(friend.userId, friend);
|
||||
friendLog.set(friend.userId, friend);
|
||||
}
|
||||
refreshFriendsStatus(currentUser);
|
||||
|
||||
@@ -1443,12 +1458,12 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
* @param {string} userId
|
||||
*/
|
||||
function setFriendNumber(friendNumber, userId) {
|
||||
const ref = state.friendLog.get(userId);
|
||||
const ref = friendLog.get(userId);
|
||||
if (!ref) {
|
||||
return;
|
||||
}
|
||||
ref.friendNumber = friendNumber;
|
||||
state.friendLog.set(ref.userId, ref);
|
||||
friendLog.set(ref.userId, ref);
|
||||
database.setFriendLogCurrent(ref);
|
||||
const friendRef = state.friends.get(userId);
|
||||
if (friendRef?.ref) {
|
||||
@@ -1467,7 +1482,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
|
||||
// reset friendNumber and friendLog
|
||||
state.friendNumber = 0;
|
||||
for (const ref of state.friendLog.values()) {
|
||||
for (const ref of friendLog.values()) {
|
||||
ref.friendNumber = 0;
|
||||
}
|
||||
|
||||
@@ -1504,7 +1519,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
var status = false;
|
||||
state.friendNumber = 0;
|
||||
for (const ref of state.friendLog.values()) {
|
||||
for (const ref of friendLog.values()) {
|
||||
ref.friendNumber = 0;
|
||||
}
|
||||
try {
|
||||
@@ -1595,7 +1610,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
const friendLogTable = getFriendLogFriendOrder();
|
||||
for (let i = friendLogTable.length - 1; i > -1; i--) {
|
||||
const friendLog = friendLogTable[i];
|
||||
const ref = state.friendLog.get(friendLog.id);
|
||||
const ref = friendLog.get(friendLog.id);
|
||||
if (!ref) {
|
||||
continue;
|
||||
}
|
||||
@@ -1603,7 +1618,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
break;
|
||||
}
|
||||
ref.friendNumber = --state.friendNumber;
|
||||
state.friendLog.set(ref.userId, ref);
|
||||
friendLog.set(ref.userId, ref);
|
||||
database.setFriendLogCurrent(ref);
|
||||
const friendRef = state.friends.get(friendLog.id);
|
||||
if (friendRef?.ref) {
|
||||
@@ -1714,7 +1729,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
trustLevel: ref.$trustLevel,
|
||||
friendNumber: i + 1
|
||||
};
|
||||
state.friendLog.set(userId, friendLogCurrent);
|
||||
friendLog.set(userId, friendLogCurrent);
|
||||
database.setFriendLogCurrent(friendLogCurrent);
|
||||
state.friendNumber = i + 1;
|
||||
}
|
||||
@@ -1729,12 +1744,12 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
return;
|
||||
}
|
||||
for (const friendLog of friendLogTable) {
|
||||
const ref = state.friendLog.get(friendLog.id);
|
||||
const ref = friendLog.get(friendLog.id);
|
||||
if (!ref || ref.friendNumber) {
|
||||
continue;
|
||||
}
|
||||
ref.friendNumber = ++state.friendNumber;
|
||||
state.friendLog.set(ref.userId, ref);
|
||||
friendLog.set(ref.userId, ref);
|
||||
database.setFriendLogCurrent(ref);
|
||||
const friendRef = state.friends.get(friendLog.id);
|
||||
if (friendRef?.ref) {
|
||||
@@ -1744,19 +1759,18 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
|
||||
function confirmDeleteFriend(id) {
|
||||
$app.$confirm('Continue? Unfriend', 'Confirm', {
|
||||
ElMessageBox.confirm('Continue? Unfriend', 'Confirm', {
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'info',
|
||||
callback: async (action) => {
|
||||
if (action === 'confirm') {
|
||||
const args = await friendRequest.deleteFriend({
|
||||
userId: id
|
||||
});
|
||||
handleFriendDelete(args);
|
||||
}
|
||||
}
|
||||
});
|
||||
type: 'info'
|
||||
})
|
||||
.then(async () => {
|
||||
const args = await friendRequest.deleteFriend({
|
||||
userId: id
|
||||
});
|
||||
handleFriendDelete(args);
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
async function saveSidebarSortOrder() {
|
||||
@@ -1770,7 +1784,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
const userId = userStore.currentUser.id;
|
||||
state.isRefreshFriendsLoading = true;
|
||||
watchState.isFriendsLoaded = false;
|
||||
state.friendLog = new Map();
|
||||
friendLog = new Map();
|
||||
initFriendLogHistoryTable();
|
||||
|
||||
try {
|
||||
@@ -1780,8 +1794,8 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
await initFriendLog(userStore.currentUser);
|
||||
}
|
||||
} catch (err) {
|
||||
if (!AppGlobal.dontLogMeOut) {
|
||||
$app.$message({
|
||||
if (!AppDebug.dontLogMeOut) {
|
||||
ElMessage({
|
||||
message: t('message.friend.load_failed'),
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
+9
-47
@@ -1,6 +1,7 @@
|
||||
import Noty from 'noty';
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import {
|
||||
inventoryRequest,
|
||||
@@ -8,8 +9,7 @@ import {
|
||||
vrcPlusIconRequest,
|
||||
vrcPlusImageRequest
|
||||
} from '../api';
|
||||
import { $app } from '../app';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { watchState } from '../service/watchState';
|
||||
import {
|
||||
getEmojiFileName,
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
getPrintLocalDate
|
||||
} from '../shared/utils';
|
||||
import { useAdvancedSettingsStore } from './settings/advanced';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export const useGalleryStore = defineStore('Gallery', () => {
|
||||
const advancedSettingsStore = useAdvancedSettingsStore();
|
||||
@@ -45,8 +45,6 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
printTable: [],
|
||||
emojiTable: [],
|
||||
inventoryTable: [],
|
||||
previousImagesDialogVisible: false,
|
||||
previousImagesTable: [],
|
||||
fullscreenImageDialog: {
|
||||
visible: false,
|
||||
imageUrl: '',
|
||||
@@ -176,20 +174,6 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const previousImagesDialogVisible = computed({
|
||||
get: () => state.previousImagesDialogVisible,
|
||||
set: (value) => {
|
||||
state.previousImagesDialogVisible = value;
|
||||
}
|
||||
});
|
||||
|
||||
const previousImagesTable = computed({
|
||||
get: () => state.previousImagesTable,
|
||||
set: (value) => {
|
||||
state.previousImagesTable = value;
|
||||
}
|
||||
});
|
||||
|
||||
const fullscreenImageDialog = computed({
|
||||
get: () => state.fullscreenImageDialog,
|
||||
set: (value) => {
|
||||
@@ -200,14 +184,12 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
watch(
|
||||
() => watchState.isLoggedIn,
|
||||
(isLoggedIn) => {
|
||||
state.previousImagesTable = [];
|
||||
state.galleryTable = [];
|
||||
state.VRCPlusIconsTable = [];
|
||||
state.stickerTable = [];
|
||||
state.printTable = [];
|
||||
state.emojiTable = [];
|
||||
state.galleryDialogVisible = false;
|
||||
state.previousImagesDialogVisible = false;
|
||||
state.fullscreenImageDialog.visible = false;
|
||||
if (isLoggedIn) {
|
||||
tryDeleteOldPrints();
|
||||
@@ -290,7 +272,7 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
}
|
||||
if (files[0].size >= 100000000) {
|
||||
// 100MB
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t('message.file.too_large'),
|
||||
type: 'error'
|
||||
});
|
||||
@@ -298,7 +280,7 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
return;
|
||||
}
|
||||
if (!files[0].type.match(/image.*/)) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t('message.file.not_image'),
|
||||
type: 'error'
|
||||
});
|
||||
@@ -540,10 +522,10 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
for (const printId of idList) {
|
||||
await vrcPlusImageRequest.deletePrint(printId);
|
||||
const text = `Old print automatically deleted: ${printId}`;
|
||||
if (AppGlobal.errorNoty) {
|
||||
AppGlobal.errorNoty.close();
|
||||
if (AppDebug.errorNoty) {
|
||||
AppDebug.errorNoty.close();
|
||||
}
|
||||
AppGlobal.errorNoty = new Noty({
|
||||
AppDebug.errorNoty = new Noty({
|
||||
type: 'info',
|
||||
text
|
||||
}).show();
|
||||
@@ -554,24 +536,6 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
await refreshPrintTable();
|
||||
}
|
||||
|
||||
async function checkPreviousImageAvailable(images) {
|
||||
state.previousImagesTable = [];
|
||||
for (const image of images) {
|
||||
if (image.file && image.file.url) {
|
||||
const response = await fetch(image.file.url, {
|
||||
method: 'HEAD',
|
||||
redirect: 'follow'
|
||||
}).catch((error) => {
|
||||
console.error('Failed to check image availability:', error);
|
||||
return null;
|
||||
});
|
||||
if (response && response.status === 200) {
|
||||
state.previousImagesTable.push(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showFullscreenImageDialog(imageUrl, fileName) {
|
||||
if (!imageUrl) {
|
||||
return;
|
||||
@@ -656,6 +620,7 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
galleryTable,
|
||||
galleryDialogVisible,
|
||||
galleryDialogGalleryLoading,
|
||||
@@ -673,8 +638,6 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
printTable,
|
||||
emojiTable,
|
||||
inventoryTable,
|
||||
previousImagesDialogVisible,
|
||||
previousImagesTable,
|
||||
fullscreenImageDialog,
|
||||
|
||||
showGalleryDialog,
|
||||
@@ -689,7 +652,6 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
refreshEmojiTable,
|
||||
getInventory,
|
||||
tryDeleteOldPrints,
|
||||
checkPreviousImageAvailable,
|
||||
showFullscreenImageDialog,
|
||||
handleStickerAdd,
|
||||
handleGalleryImageAdd,
|
||||
|
||||
+5
-4
@@ -1,7 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import { $app } from '../app';
|
||||
import configRepository from '../service/config.js';
|
||||
import { database } from '../service/database';
|
||||
import {
|
||||
@@ -158,7 +158,7 @@ export const useGameStore = defineStore('Game', () => {
|
||||
}
|
||||
AppApi.FocusWindow();
|
||||
const message = 'VRChat crashed, attempting to rejoin last instance';
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message,
|
||||
type: 'info'
|
||||
});
|
||||
@@ -255,14 +255,14 @@ export const useGameStore = defineStore('Game', () => {
|
||||
);
|
||||
if (!result) {
|
||||
// failed to set key
|
||||
$app.$alert(
|
||||
ElMessageBox.alert(
|
||||
'VRCX has noticed VRChat debug logging is disabled. VRCX requires debug logging in order to function correctly. Please enable debug logging in VRChat quick menu settings > debug > enable debug logging, then rejoin the instance or restart VRChat.',
|
||||
'Enable debug logging'
|
||||
);
|
||||
console.error('Failed to enable debug logging', result);
|
||||
return;
|
||||
}
|
||||
$app.$alert(
|
||||
ElMessageBox.alert(
|
||||
'VRCX has noticed VRChat debug logging is disabled and automatically re-enabled it. VRCX requires debug logging in order to function correctly.',
|
||||
'Enabled debug logging'
|
||||
);
|
||||
@@ -281,6 +281,7 @@ export const useGameStore = defineStore('Game', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
VRChatUsedCacheSize,
|
||||
VRChatTotalCacheSize,
|
||||
VRChatCacheSizeLoading,
|
||||
|
||||
+10
-8
@@ -1,12 +1,12 @@
|
||||
import dayjs from 'dayjs';
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import { userRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import configRepository from '../service/config';
|
||||
import { database } from '../service/database';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import gameLogService from '../service/gamelog.js';
|
||||
import { watchState } from '../service/watchState';
|
||||
import {
|
||||
@@ -69,7 +69,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
filter: [],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini',
|
||||
size: 'small',
|
||||
defaultSort: {
|
||||
prop: 'created_at',
|
||||
order: 'descending'
|
||||
@@ -627,7 +627,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
// set $location_at to join time if user isn't a friend
|
||||
ref.$location_at = joinTime;
|
||||
} else {
|
||||
if (AppGlobal.debugGameLog || AppGlobal.debugWebRequests) {
|
||||
if (AppDebug.debugGameLog || AppDebug.debugWebRequests) {
|
||||
console.log('Fetching user from gameLog:', userId);
|
||||
}
|
||||
userRequest.getUser({ userId });
|
||||
@@ -744,7 +744,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
vrcxStore.processScreenshot(gameLog.screenshotPath);
|
||||
break;
|
||||
case 'api-request':
|
||||
if (AppGlobal.debugWebRequests) {
|
||||
if (AppDebug.debugWebRequests) {
|
||||
console.log('API Request:', gameLog.url);
|
||||
}
|
||||
// const userId = '';
|
||||
@@ -1387,7 +1387,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
rawLogs.slice(3)
|
||||
);
|
||||
if (
|
||||
AppGlobal.debugGameLog &&
|
||||
AppDebug.debugGameLog &&
|
||||
gameLog.type !== 'photon-id' &&
|
||||
gameLog.type !== 'api-request' &&
|
||||
gameLog.type !== 'udon-exception'
|
||||
@@ -1399,7 +1399,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
|
||||
async function disableGameLogDialog() {
|
||||
if (gameStore.isGameRunning) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message:
|
||||
'VRChat needs to be closed before this option can be changed',
|
||||
type: 'error'
|
||||
@@ -1407,7 +1407,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
return;
|
||||
}
|
||||
if (!advancedSettingsStore.gameLogDisabled) {
|
||||
$app.$confirm('Continue? Disable GameLog', 'Confirm', {
|
||||
ElMessageBox.confirm('Continue? Disable GameLog', 'Confirm', {
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'info',
|
||||
@@ -1431,11 +1431,13 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
nowPlaying,
|
||||
gameLogTable,
|
||||
gameLogSessionTable,
|
||||
lastVideoUrl,
|
||||
lastResourceloadUrl,
|
||||
|
||||
initGameLogTable,
|
||||
clearNowPlaying,
|
||||
tryLoadPlayerList,
|
||||
|
||||
+28
-30
@@ -1,5 +1,6 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { computed, reactive, watch, nextTick } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import {
|
||||
groupRequest,
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
userRequest,
|
||||
worldRequest
|
||||
} from '../api';
|
||||
import { $app } from '../app';
|
||||
import configRepository from '../service/config';
|
||||
import { watchState } from '../service/watchState';
|
||||
import { database } from '../service/database.js';
|
||||
@@ -83,12 +83,13 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
auditLogTypes: [],
|
||||
openWithUserId: ''
|
||||
},
|
||||
cachedGroups: new Map(),
|
||||
inGameGroupOrder: [],
|
||||
groupInstances: [],
|
||||
currentUserGroupsInit: false
|
||||
});
|
||||
|
||||
let cachedGroups = new Map();
|
||||
|
||||
const groupDialog = computed({
|
||||
get: () => state.groupDialog,
|
||||
set: (value) => {
|
||||
@@ -124,13 +125,6 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const cachedGroups = computed({
|
||||
get: () => state.cachedGroups,
|
||||
set: (value) => {
|
||||
state.cachedGroups = value;
|
||||
}
|
||||
});
|
||||
|
||||
const inGameGroupOrder = computed({
|
||||
get: () => state.inGameGroupOrder,
|
||||
set: (value) => {
|
||||
@@ -160,7 +154,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
state.moderateGroupDialog.visible = false;
|
||||
state.groupMemberModeration.visible = false;
|
||||
state.currentUserGroupsInit = false;
|
||||
state.cachedGroups.clear();
|
||||
cachedGroups.clear();
|
||||
state.currentUserGroups.clear();
|
||||
if (isLoggedIn) {
|
||||
initUserGroups();
|
||||
@@ -198,7 +192,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
.catch((err) => {
|
||||
D.loading = false;
|
||||
D.visible = false;
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Failed to load group',
|
||||
type: 'error'
|
||||
});
|
||||
@@ -506,7 +500,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
});
|
||||
}
|
||||
}
|
||||
$app.$nextTick(() => (D.isGetGroupDialogGroupLoading = false));
|
||||
nextTick(() => (D.isGetGroupDialogGroupLoading = false));
|
||||
return args;
|
||||
});
|
||||
}
|
||||
@@ -566,16 +560,19 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
}
|
||||
|
||||
function leaveGroupPrompt(groupId) {
|
||||
$app.$confirm('Are you sure you want to leave this group?', 'Confirm', {
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'info',
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
leaveGroup(groupId);
|
||||
}
|
||||
ElMessageBox.confirm(
|
||||
'Are you sure you want to leave this group?',
|
||||
'Confirm',
|
||||
{
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'info'
|
||||
}
|
||||
});
|
||||
)
|
||||
.then(() => {
|
||||
leaveGroup(groupId);
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
function updateGroupPostSearch() {
|
||||
@@ -602,7 +599,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
})
|
||||
.then((args) => {
|
||||
handleGroupMemberProps(args);
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Group visibility updated',
|
||||
type: 'success'
|
||||
});
|
||||
@@ -616,7 +613,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
* @returns {object} ref
|
||||
*/
|
||||
function applyGroup(json) {
|
||||
let ref = state.cachedGroups.get(json.id);
|
||||
let ref = cachedGroups.get(json.id);
|
||||
if (json.rules) {
|
||||
json.rules = replaceBioSymbols(json.rules);
|
||||
}
|
||||
@@ -684,7 +681,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
$languages: [],
|
||||
...json
|
||||
};
|
||||
state.cachedGroups.set(ref.id, ref);
|
||||
cachedGroups.set(ref.id, ref);
|
||||
} else {
|
||||
if (state.currentUserGroups.has(ref.id)) {
|
||||
// compare group props
|
||||
@@ -845,7 +842,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
const json = args.json;
|
||||
for (const groupId in json) {
|
||||
const permissions = json[groupId];
|
||||
const group = state.cachedGroups.get(groupId);
|
||||
const group = cachedGroups.get(groupId);
|
||||
if (group) {
|
||||
group.myMember.permissions = permissions;
|
||||
}
|
||||
@@ -896,7 +893,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
json.$fetchedAt = args.json.fetchedAt;
|
||||
}
|
||||
const instanceRef = instanceStore.applyInstance(json);
|
||||
const groupRef = state.cachedGroups.get(json.ownerId);
|
||||
const groupRef = cachedGroups.get(json.ownerId);
|
||||
if (typeof groupRef === 'undefined') {
|
||||
if (watchState.isFriendsLoaded) {
|
||||
const args = await groupRequest.getGroup({
|
||||
@@ -936,7 +933,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
}
|
||||
// update myMember without fetching member
|
||||
if (json?.userId === userStore.currentUser.id) {
|
||||
ref = state.cachedGroups.get(json.groupId);
|
||||
ref = cachedGroups.get(json.groupId);
|
||||
if (typeof ref !== 'undefined') {
|
||||
const newJson = {
|
||||
id: json.groupId,
|
||||
@@ -980,7 +977,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
'[]'
|
||||
)
|
||||
);
|
||||
state.cachedGroups.clear();
|
||||
cachedGroups.clear();
|
||||
state.currentUserGroups.clear();
|
||||
for (const group of savedGroups) {
|
||||
const json = {
|
||||
@@ -999,7 +996,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
|
||||
if (groups) {
|
||||
const promises = groups.map(async (groupId) => {
|
||||
const groupRef = state.cachedGroups.get(groupId);
|
||||
const groupRef = cachedGroups.get(groupId);
|
||||
|
||||
if (
|
||||
typeof groupRef !== 'undefined' &&
|
||||
@@ -1096,6 +1093,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
groupDialog,
|
||||
currentUserGroups,
|
||||
inviteGroupDialog,
|
||||
|
||||
+22
-28
@@ -1,7 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue, { computed, reactive, watch } from 'vue';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { instanceRequest, userRequest, worldRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import configRepository from '../service/config';
|
||||
import { database } from '../service/database';
|
||||
import { watchState } from '../service/watchState';
|
||||
@@ -29,7 +29,7 @@ import { useSharedFeedStore } from './sharedFeed';
|
||||
import { useUiStore } from './ui';
|
||||
import { useUserStore } from './user';
|
||||
import { useWorldStore } from './world';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export const useInstanceStore = defineStore('Instance', () => {
|
||||
const locationStore = useLocationStore();
|
||||
@@ -45,7 +45,6 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
const { t } = useI18n();
|
||||
|
||||
const state = reactive({
|
||||
cachedInstances: new Map(),
|
||||
currentInstanceWorld: {
|
||||
ref: {},
|
||||
instance: {},
|
||||
@@ -68,7 +67,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
data: [],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini',
|
||||
size: 'small',
|
||||
defaultSort: {
|
||||
prop: 'timer',
|
||||
order: 'descending'
|
||||
@@ -80,14 +79,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
updatePlayerListPending: false
|
||||
});
|
||||
|
||||
const cachedInstances = computed({
|
||||
get() {
|
||||
return state.cachedInstances;
|
||||
},
|
||||
set(value) {
|
||||
state.cachedInstances = value;
|
||||
}
|
||||
});
|
||||
let cachedInstances = new Map();
|
||||
|
||||
const currentInstanceWorld = computed({
|
||||
get: () => state.currentInstanceWorld,
|
||||
@@ -144,7 +136,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
state.currentInstanceUserList.data = [];
|
||||
state.instanceJoinHistory = new Map();
|
||||
state.previousInstancesInfoDialogVisible = false;
|
||||
state.cachedInstances.clear();
|
||||
cachedInstances.clear();
|
||||
state.queuedInstances.clear();
|
||||
if (isLoggedIn) {
|
||||
getInstanceJoinHistory();
|
||||
@@ -285,7 +277,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
});
|
||||
}
|
||||
if (isRealInstance(instanceId)) {
|
||||
const ref = state.cachedInstances.get(instanceId);
|
||||
const ref = cachedInstances.get(instanceId);
|
||||
if (typeof ref !== 'undefined') {
|
||||
state.currentInstanceWorld.instance = ref;
|
||||
} else {
|
||||
@@ -322,7 +314,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
if (!json.$fetchedAt) {
|
||||
json.$fetchedAt = new Date().toJSON();
|
||||
}
|
||||
let ref = state.cachedInstances.get(json.id);
|
||||
let ref = cachedInstances.get(json.id);
|
||||
if (typeof ref === 'undefined') {
|
||||
ref = {
|
||||
id: '',
|
||||
@@ -371,7 +363,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
$disabledContentSettings: [],
|
||||
...json
|
||||
};
|
||||
state.cachedInstances.set(ref.id, ref);
|
||||
cachedInstances.set(ref.id, ref);
|
||||
} else {
|
||||
Object.assign(ref, json);
|
||||
}
|
||||
@@ -516,6 +508,9 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
) {
|
||||
params.ageGate = true;
|
||||
}
|
||||
if (D.displayName) {
|
||||
params.displayName = D.displayName;
|
||||
}
|
||||
try {
|
||||
const args = await instanceRequest.createInstance(params);
|
||||
return args;
|
||||
@@ -651,6 +646,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
L.shortName = instance.shortName;
|
||||
}
|
||||
instance.$location = L;
|
||||
L.user = null;
|
||||
if (L.userId) {
|
||||
ref = userStore.cachedUsers.get(L.userId);
|
||||
if (typeof ref === 'undefined') {
|
||||
@@ -659,11 +655,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
userId: L.userId
|
||||
})
|
||||
.then((args) => {
|
||||
Vue.set(L, 'user', args.ref);
|
||||
return args;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error fetching user:', error);
|
||||
L.user = args.ref;
|
||||
});
|
||||
} else {
|
||||
L.user = ref;
|
||||
@@ -681,7 +673,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
}
|
||||
// get instance from cache
|
||||
for (const room of rooms) {
|
||||
ref = state.cachedInstances.get(room.tag);
|
||||
ref = cachedInstances.get(room.tag);
|
||||
if (typeof ref !== 'undefined') {
|
||||
room.ref = ref;
|
||||
}
|
||||
@@ -856,7 +848,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
}
|
||||
// get instance
|
||||
for (const room of rooms) {
|
||||
ref = cachedInstances.value.get(room.tag);
|
||||
ref = cachedInstances.get(room.tag);
|
||||
if (typeof ref !== 'undefined') {
|
||||
room.ref = ref;
|
||||
} else if (isRealInstance(room.tag)) {
|
||||
@@ -892,7 +884,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
|
||||
function removeAllQueuedInstances() {
|
||||
state.queuedInstances.forEach((ref) => {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: `Removed instance ${ref.$worldName} from queue`,
|
||||
type: 'info'
|
||||
});
|
||||
@@ -920,7 +912,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
function applyQueuedInstance(instanceId) {
|
||||
state.queuedInstances.forEach((ref) => {
|
||||
if (ref.location !== instanceId) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t('message.instance.removed_form_queue', {
|
||||
worldName: ref.$worldName
|
||||
}),
|
||||
@@ -976,7 +968,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
const groupName = group?.name ?? '';
|
||||
const worldName = ref?.$worldName ?? '';
|
||||
const location = displayLocation(instanceId, worldName, groupName);
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: `Instance ready to join ${location}`,
|
||||
type: 'success'
|
||||
});
|
||||
@@ -1026,7 +1018,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
ref.queueSize = queueSize;
|
||||
ref.updatedAt = Date.now();
|
||||
if (!ref.$msgBox || ref.$msgBox.closed) {
|
||||
ref.$msgBox = $app.$message({
|
||||
ref.$msgBox = ElMessage({
|
||||
message: '',
|
||||
type: 'info',
|
||||
duration: 0,
|
||||
@@ -1214,6 +1206,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
cachedInstances,
|
||||
currentInstanceWorld,
|
||||
currentInstanceLocation,
|
||||
@@ -1222,6 +1215,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
||||
previousInstancesInfoDialogInstanceId,
|
||||
instanceJoinHistory,
|
||||
currentInstanceUserList,
|
||||
|
||||
applyInstance,
|
||||
updateCurrentInstanceWorld,
|
||||
createNewInstance,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { instanceRequest, inviteMessagesRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import { watchState } from '../service/watchState';
|
||||
import { parseLocation } from '../shared/utils';
|
||||
import { useInstanceStore } from './instance';
|
||||
@@ -25,7 +25,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
data: [],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini'
|
||||
size: 'small'
|
||||
},
|
||||
layout: 'table',
|
||||
visible: false
|
||||
@@ -34,7 +34,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
data: [],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini'
|
||||
size: 'small'
|
||||
},
|
||||
layout: 'table',
|
||||
visible: false
|
||||
@@ -43,7 +43,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
data: [],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini'
|
||||
size: 'small'
|
||||
},
|
||||
layout: 'table',
|
||||
visible: false
|
||||
@@ -52,7 +52,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
data: [],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini'
|
||||
size: 'small'
|
||||
},
|
||||
layout: 'table',
|
||||
visible: false
|
||||
@@ -163,7 +163,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
instanceStore.createNewInstance(worldId).then((args) => {
|
||||
const location = args?.json?.location;
|
||||
if (!location) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Failed to create instance',
|
||||
type: 'error'
|
||||
});
|
||||
@@ -186,7 +186,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
worldId: L.worldId
|
||||
})
|
||||
.then((args) => {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Self invite sent',
|
||||
type: 'success'
|
||||
});
|
||||
@@ -197,6 +197,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
editInviteMessageDialog,
|
||||
inviteMessageTable,
|
||||
inviteResponseMessageTable,
|
||||
|
||||
+10
-9
@@ -1,7 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { computed, reactive, watch, nextTick } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { instanceRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import configRepository from '../service/config';
|
||||
import { watchState } from '../service/watchState';
|
||||
import { parseLocation } from '../shared/utils';
|
||||
@@ -57,7 +57,7 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
tag,
|
||||
shortName
|
||||
};
|
||||
$app.$nextTick(() => (state.launchDialogData.loading = false));
|
||||
nextTick(() => (state.launchDialogData.loading = false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
}
|
||||
console.log('Attach Game', launchUrl, result);
|
||||
if (!result) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message:
|
||||
'Failed open instance in VRChat, falling back to self invite',
|
||||
type: 'warning'
|
||||
@@ -123,7 +123,7 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
worldId: L.worldId,
|
||||
shortName
|
||||
});
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Self invite sent',
|
||||
type: 'success'
|
||||
});
|
||||
@@ -157,13 +157,13 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
args.join(' ')
|
||||
).then((result) => {
|
||||
if (!result) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message:
|
||||
'Failed to launch VRChat, invalid custom path set',
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'VRChat launched',
|
||||
type: 'success'
|
||||
});
|
||||
@@ -172,13 +172,13 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
} else {
|
||||
AppApi.StartGame(args.join(' ')).then((result) => {
|
||||
if (!result) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message:
|
||||
'Failed to find VRChat, set a custom path in launch options',
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'VRChat launched',
|
||||
type: 'success'
|
||||
});
|
||||
@@ -190,6 +190,7 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
isLaunchOptionsDialogVisible,
|
||||
launchDialogData,
|
||||
showLaunchOptions,
|
||||
|
||||
@@ -230,6 +230,7 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
lastLocation,
|
||||
lastLocationDestination,
|
||||
lastLocationDestinationTime,
|
||||
|
||||
@@ -271,6 +271,7 @@ export const useModerationStore = defineStore('Moderation', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
cachedPlayerModerations,
|
||||
cachedPlayerModerationsUserIds,
|
||||
isPlayerModerationsLoading,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import Noty from 'noty';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue, { computed, reactive, watch } from 'vue';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { notificationRequest, userRequest, worldRequest } from '../api';
|
||||
import configRepository from '../service/config';
|
||||
import { database } from '../service/database';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { watchState } from '../service/watchState';
|
||||
import {
|
||||
checkCanInvite,
|
||||
@@ -13,7 +13,8 @@ import {
|
||||
extractFileVersion,
|
||||
getUserMemo,
|
||||
parseLocation,
|
||||
removeFromArray
|
||||
removeFromArray,
|
||||
replaceBioSymbols
|
||||
} from '../shared/utils';
|
||||
import { useFavoriteStore } from './favorite';
|
||||
import { useFriendStore } from './friend';
|
||||
@@ -59,7 +60,7 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini',
|
||||
size: 'small',
|
||||
defaultSort: {
|
||||
prop: 'created_at',
|
||||
order: 'descending'
|
||||
@@ -135,7 +136,7 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
const { length } = array;
|
||||
for (let i = 0; i < length; ++i) {
|
||||
if (array[i].id === ref.id) {
|
||||
Vue.set(array, i, ref);
|
||||
array[i] = ref;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -283,14 +284,14 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
)
|
||||
.then((_args) => {
|
||||
const text = `Auto invite sent to ${ref.senderUsername}`;
|
||||
if (AppGlobal.errorNoty) {
|
||||
AppGlobal.errorNoty.close();
|
||||
if (AppDebug.errorNoty) {
|
||||
AppDebug.errorNoty.close();
|
||||
}
|
||||
AppGlobal.errorNoty = new Noty({
|
||||
AppDebug.errorNoty = new Noty({
|
||||
type: 'info',
|
||||
text
|
||||
});
|
||||
AppGlobal.errorNoty.show();
|
||||
AppDebug.errorNoty.show();
|
||||
console.log(text);
|
||||
notificationRequest.hideNotification({
|
||||
notificationId: ref.id
|
||||
@@ -368,6 +369,9 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
* @returns {object}
|
||||
*/
|
||||
function applyNotification(json) {
|
||||
if (json.message) {
|
||||
json.message = replaceBioSymbols(json.message);
|
||||
}
|
||||
let ref;
|
||||
const array = state.notificationTable.data;
|
||||
for (let i = array.length - 1; i >= 0; i--) {
|
||||
@@ -2323,6 +2327,7 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
notificationInitStatus,
|
||||
notificationTable,
|
||||
unseenNotifications,
|
||||
|
||||
+12
-12
@@ -1,12 +1,12 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import { instanceRequest, userRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import configRepository from '../service/config';
|
||||
import { database } from '../service/database';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { photonEventType } from '../shared/constants';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { photonEventType } from '../shared/constants/photon';
|
||||
import {
|
||||
checkVRChatCache,
|
||||
displayLocation,
|
||||
@@ -27,7 +27,7 @@ import { useNotificationStore } from './notification';
|
||||
import { useSharedFeedStore } from './sharedFeed';
|
||||
import { useUserStore } from './user';
|
||||
import { useVrStore } from './vr';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export const usePhotonStore = defineStore('Photon', () => {
|
||||
const vrStore = useVrStore();
|
||||
@@ -85,7 +85,7 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini'
|
||||
size: 'small'
|
||||
},
|
||||
pageSize: 10,
|
||||
paginationProps: {
|
||||
@@ -110,7 +110,7 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini'
|
||||
size: 'small'
|
||||
},
|
||||
pageSize: 10,
|
||||
paginationProps: {
|
||||
@@ -548,7 +548,7 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
userStore.lookupUser(ref);
|
||||
}
|
||||
} else {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'No user info available',
|
||||
type: 'error'
|
||||
});
|
||||
@@ -557,7 +557,7 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
}
|
||||
|
||||
function promptPhotonOverlayMessageTimeout() {
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.overlay_message_timeout.description'),
|
||||
t('prompt.overlay_message_timeout.header'),
|
||||
{
|
||||
@@ -586,7 +586,7 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
}
|
||||
|
||||
function promptPhotonLobbyTimeoutThreshold() {
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.photon_lobby_timeout.description'),
|
||||
t('prompt.photon_lobby_timeout.header'),
|
||||
{
|
||||
@@ -1291,7 +1291,7 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
const datetime = json.dt;
|
||||
const eventData = json.VRCEventData;
|
||||
const senderId = eventData.Sender;
|
||||
if (AppGlobal.debugPhotonLogging) {
|
||||
if (AppDebug.debugPhotonLogging) {
|
||||
console.log('VrcEvent:', json);
|
||||
}
|
||||
if (eventData.EventName === '_SendOnSpawn') {
|
||||
@@ -1353,7 +1353,7 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
'$1:'
|
||||
)}`;
|
||||
}
|
||||
if (AppGlobal.debugPhotonLogging) {
|
||||
if (AppDebug.debugPhotonLogging) {
|
||||
const displayName = getDisplayNameFromPhotonId(senderId);
|
||||
const feed = `RPC ${displayName} ${
|
||||
photonEventType[eventData.EventType]
|
||||
@@ -1891,7 +1891,7 @@ export const usePhotonStore = defineStore('Photon', () => {
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
// state,
|
||||
|
||||
photonLoggingEnabled,
|
||||
photonEventOverlay,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { instanceRequest, userRequest } from '../api';
|
||||
import { groupRequest } from '../api/';
|
||||
import { $app } from '../app';
|
||||
import removeConfusables, { removeWhitespace } from '../service/confusables';
|
||||
import { watchState } from '../service/watchState';
|
||||
import { compareByName, localeIncludes } from '../shared/utils';
|
||||
@@ -13,7 +13,7 @@ import { useAppearanceSettingsStore } from './settings/appearance';
|
||||
import { useUiStore } from './ui';
|
||||
import { useUserStore } from './user';
|
||||
import { useWorldStore } from './world';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export const useSearchStore = defineStore('Search', () => {
|
||||
const userStore = useUserStore();
|
||||
@@ -347,7 +347,7 @@ export const useSearchStore = defineStore('Search', () => {
|
||||
}
|
||||
|
||||
function promptOmniDirectDialog() {
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.direct_access_omni.description'),
|
||||
t('prompt.direct_access_omni.header'),
|
||||
{
|
||||
@@ -360,7 +360,7 @@ export const useSearchStore = defineStore('Search', () => {
|
||||
if (action === 'confirm' && instance.inputValue) {
|
||||
const input = instance.inputValue.trim();
|
||||
if (!directAccessParse(input)) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t(
|
||||
'prompt.direct_access_omni.message.error'
|
||||
),
|
||||
@@ -404,11 +404,13 @@ export const useSearchStore = defineStore('Search', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
searchText,
|
||||
searchUserResults,
|
||||
stringComparer,
|
||||
quickSearchItems,
|
||||
friendsListSearch,
|
||||
|
||||
clearSearch,
|
||||
searchUserByDisplayName,
|
||||
moreSearchUser,
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { $app } from '../../app';
|
||||
import { t } from '../../plugin';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import configRepository from '../../service/config';
|
||||
import { database } from '../../service/database';
|
||||
import webApiService from '../../service/webapi';
|
||||
import { watchState } from '../../service/watchState';
|
||||
import { useGameStore } from '../game';
|
||||
import { useVrcxStore } from '../vrcx';
|
||||
import { AppGlobal } from '../../service/appConfig';
|
||||
import { AppDebug } from '../../service/appConfig';
|
||||
|
||||
export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
const gameStore = useGameStore();
|
||||
const vrcxStore = useVrcxStore();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const state = reactive({
|
||||
enablePrimaryPassword: false,
|
||||
relaunchVRChatAfterCrash: false,
|
||||
@@ -500,7 +502,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
}
|
||||
});
|
||||
const json = JSON.parse(response.data);
|
||||
if (AppGlobal.debugWebRequests) {
|
||||
if (AppDebug.debugWebRequests) {
|
||||
console.log(json, response);
|
||||
}
|
||||
if (response.status === 200) {
|
||||
@@ -516,7 +518,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
|
||||
function cropPrintsChanged() {
|
||||
if (!state.cropInstancePrints) return;
|
||||
$app.$confirm(
|
||||
ElMessageBox.confirm(
|
||||
t(
|
||||
'view.settings.advanced.advanced.save_instance_prints_to_file.crop_convert_old'
|
||||
),
|
||||
@@ -531,20 +533,20 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
showInput: false,
|
||||
callback: async (action) => {
|
||||
if (action === 'confirm') {
|
||||
const msgBox = $app.$message({
|
||||
const msgBox = ElMessage({
|
||||
message: 'Batch print cropping in progress...',
|
||||
type: 'warning',
|
||||
duration: 0
|
||||
});
|
||||
try {
|
||||
await AppApi.CropAllPrints(state.ugcFolderPath);
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Batch print cropping complete',
|
||||
type: 'success'
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: `Batch print cropping failed: ${err}`,
|
||||
type: 'error'
|
||||
});
|
||||
@@ -558,7 +560,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
}
|
||||
|
||||
function askDeleteAllScreenshotMetadata() {
|
||||
$app.$confirm(
|
||||
ElMessageBox.confirm(
|
||||
t(
|
||||
'view.settings.advanced.advanced.delete_all_screenshot_metadata.ask'
|
||||
),
|
||||
@@ -581,7 +583,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
}
|
||||
|
||||
function deleteAllScreenshotMetadata() {
|
||||
$app.$confirm(
|
||||
ElMessageBox.confirm(
|
||||
t(
|
||||
'view.settings.advanced.advanced.delete_all_screenshot_metadata.confirm'
|
||||
),
|
||||
@@ -596,20 +598,20 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
showInput: false,
|
||||
callback: async (action) => {
|
||||
if (action === 'confirm') {
|
||||
const msgBox = $app.$message({
|
||||
const msgBox = ElMessage({
|
||||
message: 'Batch metadata removal in progress...',
|
||||
type: 'warning',
|
||||
duration: 0
|
||||
});
|
||||
try {
|
||||
await AppApi.DeleteAllScreenshotMetadata();
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Batch metadata removal complete',
|
||||
type: 'success'
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: `Batch metadata removal failed: ${err}`,
|
||||
type: 'error'
|
||||
});
|
||||
@@ -664,7 +666,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
}
|
||||
|
||||
function promptAutoClearVRCXCacheFrequency() {
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.auto_clear_cache.description'),
|
||||
t('prompt.auto_clear_cache.header'),
|
||||
{
|
||||
@@ -677,24 +679,21 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
2
|
||||
).toString(),
|
||||
inputPattern: /\d+$/,
|
||||
inputErrorMessage: t('prompt.auto_clear_cache.input_error'),
|
||||
callback: async (action, instance) => {
|
||||
if (
|
||||
action === 'confirm' &&
|
||||
instance.inputValue &&
|
||||
!isNaN(parseInt(instance.inputValue, 10))
|
||||
) {
|
||||
vrcxStore.clearVRCXCacheFrequency = Math.trunc(
|
||||
parseInt(instance.inputValue, 10) * 3600 * 2
|
||||
);
|
||||
await configRepository.setString(
|
||||
'VRCX_clearVRCXCacheFrequency',
|
||||
vrcxStore.clearVRCXCacheFrequency.toString()
|
||||
);
|
||||
}
|
||||
}
|
||||
inputErrorMessage: t('prompt.auto_clear_cache.input_error')
|
||||
}
|
||||
);
|
||||
)
|
||||
.then(async ({ value }) => {
|
||||
if (value && !isNaN(parseInt(value, 10))) {
|
||||
vrcxStore.clearVRCXCacheFrequency = Math.trunc(
|
||||
parseInt(value, 10) * 3600 * 2
|
||||
);
|
||||
await configRepository.setString(
|
||||
'VRCX_clearVRCXCacheFrequency',
|
||||
vrcxStore.clearVRCXCacheFrequency.toString()
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { $app } from '../../app';
|
||||
import { i18n, t } from '../../plugin';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
|
||||
import configRepository from '../../service/config';
|
||||
import { database } from '../../service/database';
|
||||
import { watchState } from '../../service/watchState';
|
||||
import {
|
||||
changeAppDarkStyle,
|
||||
changeAppThemeStyle,
|
||||
changeCJKFontsOrder,
|
||||
getNameColour,
|
||||
HueToHex,
|
||||
systemIsDarkMode,
|
||||
@@ -36,13 +36,14 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
const vrcxStore = useVrcxStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const { t, availableLocales, locale } = useI18n();
|
||||
|
||||
const state = reactive({
|
||||
appLanguage: 'en',
|
||||
themeMode: '',
|
||||
isDarkMode: false,
|
||||
displayVRCPlusIconsAsAvatar: false,
|
||||
hideNicknames: false,
|
||||
hideTooltips: false,
|
||||
isAgeGatedInstancesVisible: false,
|
||||
sortFavorites: true,
|
||||
instanceUsersSortAlphabetical: false,
|
||||
@@ -83,7 +84,6 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
themeMode,
|
||||
displayVRCPlusIconsAsAvatar,
|
||||
hideNicknames,
|
||||
hideTooltips,
|
||||
isAgeGatedInstancesVisible,
|
||||
sortFavorites,
|
||||
instanceUsersSortAlphabetical,
|
||||
@@ -105,7 +105,6 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
configRepository.getString('VRCX_ThemeMode', 'system'),
|
||||
configRepository.getBool('displayVRCPlusIconsAsAvatar', true),
|
||||
configRepository.getBool('VRCX_hideNicknames', false),
|
||||
configRepository.getBool('VRCX_hideTooltips', false),
|
||||
configRepository.getBool(
|
||||
'VRCX_isAgeGatedInstancesVisible',
|
||||
true
|
||||
@@ -158,23 +157,21 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
const result = await AppApi.CurrentLanguage();
|
||||
|
||||
const lang = result.split('-')[0];
|
||||
i18n.availableLocales.forEach((ref) => {
|
||||
availableLocales.forEach((ref) => {
|
||||
const refLang = ref.split('_')[0];
|
||||
if (refLang === lang) {
|
||||
changeAppLanguage(ref);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
state.appLanguage = appLanguage;
|
||||
changeAppLanguage(appLanguage);
|
||||
}
|
||||
changeCJKFontsOrder(state.appLanguage);
|
||||
|
||||
state.themeMode = themeMode;
|
||||
applyThemeMode(themeMode);
|
||||
applyThemeMode();
|
||||
|
||||
state.displayVRCPlusIconsAsAvatar = displayVRCPlusIconsAsAvatar;
|
||||
state.hideNicknames = hideNicknames;
|
||||
state.hideTooltips = hideTooltips;
|
||||
state.isAgeGatedInstancesVisible = isAgeGatedInstancesVisible;
|
||||
state.sortFavorites = sortFavorites;
|
||||
state.instanceUsersSortAlphabetical = instanceUsersSortAlphabetical;
|
||||
@@ -222,7 +219,6 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
() => state.displayVRCPlusIconsAsAvatar
|
||||
);
|
||||
const hideNicknames = computed(() => state.hideNicknames);
|
||||
const hideTooltips = computed(() => state.hideTooltips);
|
||||
const isAgeGatedInstancesVisible = computed(
|
||||
() => state.isAgeGatedInstancesVisible
|
||||
);
|
||||
@@ -280,8 +276,9 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
console.log('Language changed:', language);
|
||||
state.appLanguage = language;
|
||||
configRepository.setString('VRCX_appLanguage', language);
|
||||
changeCJKFontsOrder(state.appLanguage);
|
||||
i18n.locale = state.appLanguage;
|
||||
locale.value = state.appLanguage;
|
||||
const htmlElement = document.documentElement;
|
||||
htmlElement.setAttribute('lang', state.appLanguage);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -296,7 +293,7 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
async function changeThemeMode() {
|
||||
await changeAppThemeStyle(state.themeMode);
|
||||
vrStore.updateVRConfigVars();
|
||||
await updateTrustColor();
|
||||
await updateTrustColor(undefined, undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,6 +334,7 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
Array.from(userStore.cachedUsers.keys())
|
||||
);
|
||||
if (LINUX) {
|
||||
// @ts-ignore
|
||||
dictObject = Object.fromEntries(dictObject);
|
||||
}
|
||||
for (const [userId, hue] of Object.entries(dictObject)) {
|
||||
@@ -456,10 +454,6 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
state.hideNicknames = !state.hideNicknames;
|
||||
configRepository.setBool('VRCX_hideNicknames', state.hideNicknames);
|
||||
}
|
||||
function setHideTooltips() {
|
||||
state.hideTooltips = !state.hideTooltips;
|
||||
configRepository.setBool('VRCX_hideTooltips', state.hideTooltips);
|
||||
}
|
||||
function setIsAgeGatedInstancesVisible() {
|
||||
state.isAgeGatedInstancesVisible =
|
||||
!state.isAgeGatedInstancesVisible;
|
||||
@@ -673,35 +667,35 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
}
|
||||
|
||||
function promptMaxTableSizeDialog() {
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.change_table_size.description'),
|
||||
t('prompt.change_table_size.header'),
|
||||
{
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: t('prompt.change_table_size.save'),
|
||||
cancelButtonText: t('prompt.change_table_size.cancel'),
|
||||
inputValue: vrcxStore.maxTableSize,
|
||||
inputValue: vrcxStore.maxTableSize.toString(),
|
||||
inputPattern: /\d+$/,
|
||||
inputErrorMessage: t(
|
||||
'prompt.change_table_size.input_error'
|
||||
),
|
||||
callback: async (action, instance) => {
|
||||
if (action === 'confirm' && instance.inputValue) {
|
||||
if (instance.inputValue > 10000) {
|
||||
instance.inputValue = 10000;
|
||||
}
|
||||
vrcxStore.maxTableSize = instance.inputValue;
|
||||
await configRepository.setString(
|
||||
'VRCX_maxTableSize',
|
||||
vrcxStore.maxTableSize
|
||||
);
|
||||
database.setMaxTableSize(vrcxStore.maxTableSize);
|
||||
feedStore.feedTableLookup();
|
||||
gameLogStore.gameLogTableLookup();
|
||||
}
|
||||
}
|
||||
inputErrorMessage: t('prompt.change_table_size.input_error')
|
||||
}
|
||||
);
|
||||
)
|
||||
.then(async ({ value }) => {
|
||||
if (value) {
|
||||
let processedValue = Number(value);
|
||||
if (processedValue > 10000) {
|
||||
processedValue = 10000;
|
||||
}
|
||||
vrcxStore.maxTableSize = processedValue;
|
||||
await configRepository.setString(
|
||||
'VRCX_maxTableSize',
|
||||
vrcxStore.maxTableSize.toString()
|
||||
);
|
||||
database.setMaxTableSize(vrcxStore.maxTableSize);
|
||||
feedStore.feedTableLookup();
|
||||
gameLogStore.gameLogTableLookup();
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
async function tryInitUserColours() {
|
||||
@@ -721,7 +715,6 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
isDarkMode,
|
||||
displayVRCPlusIconsAsAvatar,
|
||||
hideNicknames,
|
||||
hideTooltips,
|
||||
isAgeGatedInstancesVisible,
|
||||
sortFavorites,
|
||||
instanceUsersSortAlphabetical,
|
||||
@@ -746,7 +739,6 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
setAppLanguage,
|
||||
setDisplayVRCPlusIconsAsAvatar,
|
||||
setHideNicknames,
|
||||
setHideTooltips,
|
||||
setIsAgeGatedInstancesVisible,
|
||||
setSortFavorites,
|
||||
setInstanceUsersSortAlphabetical,
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
ActivityType,
|
||||
StatusDisplayType
|
||||
} from '../../shared/constants/discord';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export const useDiscordPresenceSettingsStore = defineStore(
|
||||
'DiscordPresenceSettings',
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive } from 'vue';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import { $app } from '../../app';
|
||||
import { t } from '../../plugin';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import configRepository from '../../service/config';
|
||||
import { useVrcxStore } from '../vrcx';
|
||||
import { useVRCXUpdaterStore } from '../vrcxUpdater';
|
||||
@@ -12,6 +13,8 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
|
||||
const vrcxStore = useVrcxStore();
|
||||
const VRCXUpdaterStore = useVRCXUpdaterStore();
|
||||
const friendStore = useFriendStore();
|
||||
|
||||
const { t } = useI18n();
|
||||
const state = reactive({
|
||||
isStartAtWindowsStartup: false,
|
||||
isStartAsMinimizedState: false,
|
||||
@@ -259,7 +262,7 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
|
||||
}
|
||||
|
||||
function promptProxySettings() {
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.proxy_settings.description'),
|
||||
t('prompt.proxy_settings.header'),
|
||||
{
|
||||
@@ -267,9 +270,26 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
|
||||
confirmButtonText: t('prompt.proxy_settings.restart'),
|
||||
cancelButtonText: t('prompt.proxy_settings.close'),
|
||||
inputValue: vrcxStore.proxyServer,
|
||||
inputPlaceholder: t('prompt.proxy_settings.placeholder'),
|
||||
callback: async (action, instance) => {
|
||||
vrcxStore.proxyServer = instance.inputValue;
|
||||
inputPlaceholder: t('prompt.proxy_settings.placeholder')
|
||||
}
|
||||
)
|
||||
.then(async ({ value }) => {
|
||||
vrcxStore.proxyServer = value;
|
||||
await VRCXStorage.Set(
|
||||
'VRCX_ProxyServer',
|
||||
vrcxStore.proxyServer
|
||||
);
|
||||
await VRCXStorage.Flush();
|
||||
await new Promise((resolve) => {
|
||||
workerTimers.setTimeout(resolve, 100);
|
||||
});
|
||||
const { restartVRCX } = VRCXUpdaterStore;
|
||||
const isUpgrade = false;
|
||||
restartVRCX(isUpgrade);
|
||||
})
|
||||
.catch(async () => {
|
||||
// User clicked close/cancel, still save the value but don't restart
|
||||
if (vrcxStore.proxyServer !== undefined) {
|
||||
await VRCXStorage.Set(
|
||||
'VRCX_ProxyServer',
|
||||
vrcxStore.proxyServer
|
||||
@@ -278,14 +298,8 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
|
||||
await new Promise((resolve) => {
|
||||
workerTimers.setTimeout(resolve, 100);
|
||||
});
|
||||
if (action === 'confirm') {
|
||||
const { restartVRCX } = VRCXUpdaterStore;
|
||||
const isUpgrade = false;
|
||||
restartVRCX(isUpgrade);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive } from 'vue';
|
||||
import { $app } from '../../app';
|
||||
import { t } from '../../plugin';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import configRepository from '../../service/config';
|
||||
import { sharedFeedFiltersDefaults } from '../../shared/constants';
|
||||
import { useVrStore } from '../vr';
|
||||
@@ -10,6 +11,8 @@ export const useNotificationsSettingsStore = defineStore(
|
||||
'NotificationsSettings',
|
||||
() => {
|
||||
const vrStore = useVrStore();
|
||||
|
||||
const { t } = useI18n();
|
||||
const state = reactive({
|
||||
overlayToast: true,
|
||||
openVR: false,
|
||||
@@ -441,7 +444,7 @@ export const useNotificationsSettingsStore = defineStore(
|
||||
}
|
||||
|
||||
function promptNotificationTimeout() {
|
||||
$app.$prompt(
|
||||
ElMessageBox.prompt(
|
||||
t('prompt.notification_timeout.description'),
|
||||
t('prompt.notification_timeout.header'),
|
||||
{
|
||||
@@ -452,25 +455,22 @@ export const useNotificationsSettingsStore = defineStore(
|
||||
inputPattern: /\d+$/,
|
||||
inputErrorMessage: t(
|
||||
'prompt.notification_timeout.input_error'
|
||||
),
|
||||
callback: async (action, instance) => {
|
||||
if (
|
||||
action === 'confirm' &&
|
||||
instance.inputValue &&
|
||||
!isNaN(instance.inputValue)
|
||||
) {
|
||||
state.notificationTimeout = Math.trunc(
|
||||
Number(instance.inputValue) * 1000
|
||||
);
|
||||
await configRepository.setString(
|
||||
'VRCX_notificationTimeout',
|
||||
state.notificationTimeout
|
||||
);
|
||||
vrStore.updateVRConfigVars();
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
)
|
||||
.then(async ({ value }) => {
|
||||
if (value && !isNaN(value)) {
|
||||
state.notificationTimeout = Math.trunc(
|
||||
Number(value) * 1000
|
||||
);
|
||||
await configRepository.setString(
|
||||
'VRCX_notificationTimeout',
|
||||
state.notificationTimeout
|
||||
);
|
||||
vrStore.updateVRConfigVars();
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -10,9 +10,9 @@ export const useWristOverlaySettingsStore = defineStore(
|
||||
hidePrivateFromFeed: false,
|
||||
openVRAlways: false,
|
||||
overlaybutton: false,
|
||||
overlayHand: 0,
|
||||
overlayHand: '0',
|
||||
vrBackgroundEnabled: false,
|
||||
minimalFeed: false,
|
||||
minimalFeed: true,
|
||||
hideDevicesFromFeed: false,
|
||||
vrOverlayCpuUsage: false,
|
||||
hideUptimeFromFeed: false,
|
||||
@@ -39,7 +39,7 @@ export const useWristOverlaySettingsStore = defineStore(
|
||||
configRepository.getBool('VRCX_overlaybutton', false),
|
||||
configRepository.getInt('VRCX_overlayHand', 0),
|
||||
configRepository.getBool('VRCX_vrBackgroundEnabled', false),
|
||||
configRepository.getBool('VRCX_minimalFeed', false),
|
||||
configRepository.getBool('VRCX_minimalFeed', true),
|
||||
configRepository.getBool('VRCX_hideDevicesFromFeed', false),
|
||||
configRepository.getBool('VRCX_vrOverlayCpuUsage', false),
|
||||
configRepository.getBool('VRCX_hideUptimeFromFeed', false),
|
||||
@@ -50,7 +50,7 @@ export const useWristOverlaySettingsStore = defineStore(
|
||||
state.hidePrivateFromFeed = hidePrivateFromFeed;
|
||||
state.openVRAlways = openVRAlways;
|
||||
state.overlaybutton = overlaybutton;
|
||||
state.overlayHand = overlayHand;
|
||||
state.overlayHand = String(overlayHand);
|
||||
state.vrBackgroundEnabled = vrBackgroundEnabled;
|
||||
state.minimalFeed = minimalFeed;
|
||||
state.hideDevicesFromFeed = hideDevicesFromFeed;
|
||||
@@ -94,11 +94,12 @@ export const useWristOverlaySettingsStore = defineStore(
|
||||
* @param {string} value
|
||||
*/
|
||||
function setOverlayHand(value) {
|
||||
state.overlayHand = parseInt(value, 10);
|
||||
if (isNaN(state.overlayHand)) {
|
||||
state.overlayHand = 0;
|
||||
state.overlayHand = value;
|
||||
let overlayHandInt = parseInt(value, 10);
|
||||
if (isNaN(overlayHandInt)) {
|
||||
overlayHandInt = 0;
|
||||
}
|
||||
configRepository.setInt('VRCX_overlayHand', value);
|
||||
configRepository.setInt('VRCX_overlayHand', overlayHandInt);
|
||||
}
|
||||
function setVrBackgroundEnabled() {
|
||||
state.vrBackgroundEnabled = !state.vrBackgroundEnabled;
|
||||
|
||||
@@ -16,7 +16,6 @@ import { useNotificationsSettingsStore } from './settings/notifications';
|
||||
import { useWristOverlaySettingsStore } from './settings/wristOverlay';
|
||||
import { useUserStore } from './user';
|
||||
import { useWorldStore } from './world';
|
||||
import { useAuthStore } from './auth';
|
||||
|
||||
export const useSharedFeedStore = defineStore('SharedFeed', () => {
|
||||
const friendStore = useFriendStore();
|
||||
@@ -32,7 +31,6 @@ export const useSharedFeedStore = defineStore('SharedFeed', () => {
|
||||
const feedStore = useFeedStore();
|
||||
const worldStore = useWorldStore();
|
||||
const photonStore = usePhotonStore();
|
||||
const authStore = useAuthStore();
|
||||
|
||||
const state = reactive({
|
||||
sharedFeed: {
|
||||
@@ -314,7 +312,7 @@ export const useSharedFeedStore = defineStore('SharedFeed', () => {
|
||||
isFriend = friendStore.friends.has(ctx.userId);
|
||||
isFavorite = friendStore.localFavoriteFriends.has(ctx.userId);
|
||||
} else if (ctx.displayName) {
|
||||
for (var ref of userStore.cachedUsers.values()) {
|
||||
for (let ref of userStore.cachedUsers.values()) {
|
||||
if (ref.displayName === ctx.displayName) {
|
||||
isFriend = friendStore.friends.has(ref.id);
|
||||
isFavorite = friendStore.localFavoriteFriends.has(
|
||||
@@ -605,5 +603,9 @@ export const useSharedFeedStore = defineStore('SharedFeed', () => {
|
||||
state.sharedFeed.pendingUpdate = true;
|
||||
}
|
||||
|
||||
return { state, sharedFeed, updateSharedFeed };
|
||||
return {
|
||||
state,
|
||||
sharedFeed,
|
||||
updateSharedFeed
|
||||
};
|
||||
});
|
||||
|
||||
@@ -72,9 +72,11 @@ export const useUiStore = defineStore('Ui', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
menuActiveIndex,
|
||||
notifiedMenus,
|
||||
shiftHeld,
|
||||
|
||||
notifyMenu,
|
||||
selectMenu,
|
||||
removeNotify
|
||||
|
||||
+20
-41
@@ -1,5 +1,5 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { watch } from 'vue';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import { groupRequest } from '../api';
|
||||
import { database } from '../service/database';
|
||||
@@ -10,7 +10,6 @@ import { useGameStore } from './game';
|
||||
import { useGameLogStore } from './gameLog';
|
||||
import { useModerationStore } from './moderation';
|
||||
import { useDiscordPresenceSettingsStore } from './settings/discordPresence';
|
||||
import { useUiStore } from './ui';
|
||||
import { useUserStore } from './user';
|
||||
import { useVrcxStore } from './vrcx';
|
||||
import { useVRCXUpdaterStore } from './vrcxUpdater';
|
||||
@@ -18,7 +17,18 @@ import { useGroupStore } from './group';
|
||||
import { useVrStore } from './vr';
|
||||
|
||||
export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
const state = reactive({
|
||||
const authStore = useAuthStore();
|
||||
const userStore = useUserStore();
|
||||
const friendStore = useFriendStore();
|
||||
const gameStore = useGameStore();
|
||||
const moderationStore = useModerationStore();
|
||||
const vrcxStore = useVrcxStore();
|
||||
const discordPresenceSettingsStore = useDiscordPresenceSettingsStore();
|
||||
const gameLogStore = useGameLogStore();
|
||||
const vrcxUpdaterStore = useVRCXUpdaterStore();
|
||||
const groupStore = useGroupStore();
|
||||
const vrStore = useVrStore();
|
||||
const state = {
|
||||
nextCurrentUserRefresh: 300,
|
||||
nextFriendsRefresh: 3600,
|
||||
nextGroupInstanceRefresh: 0,
|
||||
@@ -30,7 +40,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
nextGetLogCheck: 0,
|
||||
nextGameRunningCheck: 0,
|
||||
nextDatabaseOptimize: 3600
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => watchState.isLoggedIn,
|
||||
@@ -42,47 +52,15 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
{ flush: 'sync' }
|
||||
);
|
||||
|
||||
const nextGroupInstanceRefresh = computed({
|
||||
get: () => state.nextGroupInstanceRefresh,
|
||||
set: (value) => {
|
||||
state.nextGroupInstanceRefresh = value;
|
||||
}
|
||||
});
|
||||
const nextGroupInstanceRefresh = state.nextGroupInstanceRefresh;
|
||||
|
||||
const nextCurrentUserRefresh = computed({
|
||||
get: () => state.nextCurrentUserRefresh,
|
||||
set: (value) => {
|
||||
state.nextCurrentUserRefresh = value;
|
||||
}
|
||||
});
|
||||
const nextCurrentUserRefresh = state.nextCurrentUserRefresh;
|
||||
|
||||
const nextDiscordUpdate = computed({
|
||||
get: () => state.nextDiscordUpdate,
|
||||
set: (value) => {
|
||||
state.nextDiscordUpdate = value;
|
||||
}
|
||||
});
|
||||
const nextDiscordUpdate = state.nextDiscordUpdate;
|
||||
|
||||
const ipcTimeout = computed({
|
||||
get: () => state.ipcTimeout,
|
||||
set: (value) => {
|
||||
state.ipcTimeout = value;
|
||||
}
|
||||
});
|
||||
const ipcTimeout = state.ipcTimeout;
|
||||
|
||||
async function updateLoop() {
|
||||
const authStore = useAuthStore();
|
||||
const userStore = useUserStore();
|
||||
const friendStore = useFriendStore();
|
||||
const gameStore = useGameStore();
|
||||
const moderationStore = useModerationStore();
|
||||
const vrcxStore = useVrcxStore();
|
||||
const discordPresenceSettingsStore = useDiscordPresenceSettingsStore();
|
||||
const gameLogStore = useGameLogStore();
|
||||
const vrcxUpdaterStore = useVRCXUpdaterStore();
|
||||
const uiStore = useUiStore();
|
||||
const groupStore = useGroupStore();
|
||||
const vrStore = useVrStore();
|
||||
try {
|
||||
if (watchState.isLoggedIn) {
|
||||
if (--state.nextCurrentUserRefresh <= 0) {
|
||||
@@ -170,7 +148,8 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
// state,
|
||||
|
||||
nextGroupInstanceRefresh,
|
||||
nextCurrentUserRefresh,
|
||||
nextDiscordUpdate,
|
||||
|
||||
+55
-44
@@ -1,6 +1,7 @@
|
||||
import Noty from 'noty';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue, { computed, reactive, watch } from 'vue';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import {
|
||||
avatarRequest,
|
||||
@@ -8,9 +9,8 @@ import {
|
||||
instanceRequest,
|
||||
userRequest
|
||||
} from '../api';
|
||||
import { $app } from '../app';
|
||||
import { database } from '../service/database';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { processBulk, request } from '../service/request';
|
||||
import { watchState } from '../service/watchState';
|
||||
import {
|
||||
@@ -172,7 +172,6 @@ export const useUserStore = defineStore('User', () => {
|
||||
$travelingToLocation: ''
|
||||
},
|
||||
currentTravelers: new Map(),
|
||||
cachedUsers: new Map(),
|
||||
userDialog: {
|
||||
visible: false,
|
||||
loading: false,
|
||||
@@ -263,7 +262,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
data: [],
|
||||
tableProps: {
|
||||
stripe: true,
|
||||
size: 'mini',
|
||||
size: 'small',
|
||||
defaultSort: {
|
||||
prop: 'updated_at',
|
||||
order: 'descending'
|
||||
@@ -278,6 +277,8 @@ export const useUserStore = defineStore('User', () => {
|
||||
notes: new Map()
|
||||
});
|
||||
|
||||
const cachedUsers = new Map();
|
||||
|
||||
const currentUser = computed({
|
||||
get: () => state.currentUser,
|
||||
set: (value) => {
|
||||
@@ -292,13 +293,6 @@ export const useUserStore = defineStore('User', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const cachedUsers = computed({
|
||||
get: () => state.cachedUsers,
|
||||
set: (value) => {
|
||||
state.cachedUsers = value;
|
||||
}
|
||||
});
|
||||
|
||||
const userDialog = computed({
|
||||
get: () => state.userDialog,
|
||||
set: (value) => {
|
||||
@@ -343,9 +337,16 @@ export const useUserStore = defineStore('User', () => {
|
||||
|
||||
watch(
|
||||
() => watchState.isLoggedIn,
|
||||
() => {
|
||||
state.userDialog.visible = false;
|
||||
state.languageDialog.visible = false;
|
||||
(isLoggedIn) => {
|
||||
if (!isLoggedIn) {
|
||||
state.currentTravelers.clear();
|
||||
state.showUserDialogHistory.clear();
|
||||
state.instancePlayerCount.clear();
|
||||
state.customUserTags.clear();
|
||||
state.notes.clear();
|
||||
state.pastDisplayNameTable.data = [];
|
||||
state.subsetOfLanguages = [];
|
||||
}
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
);
|
||||
@@ -435,7 +436,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
locationStore.updateCurrentUserLocation();
|
||||
}
|
||||
|
||||
const robotUrl = `${AppGlobal.endpointDomain}/file/file_0e8c4e32-7444-44ea-ade4-313c010d4bae/1/file`;
|
||||
const robotUrl = `${AppDebug.endpointDomain}/file/file_0e8c4e32-7444-44ea-ade4-313c010d4bae/1/file`;
|
||||
/**
|
||||
*
|
||||
* @param {import('../types/api/user').GetUserResponse} json
|
||||
@@ -444,7 +445,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
function applyUser(json) {
|
||||
let hasPropChanged = false;
|
||||
const changedProps = {};
|
||||
let ref = state.cachedUsers.get(json.id);
|
||||
let ref = cachedUsers.get(json.id);
|
||||
if (json.statusDescription) {
|
||||
json.statusDescription = replaceBioSymbols(json.statusDescription);
|
||||
json.statusDescription = removeEmojis(json.statusDescription);
|
||||
@@ -460,7 +461,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
delete json.currentAvatarThumbnailImageUrl;
|
||||
}
|
||||
if (typeof ref === 'undefined') {
|
||||
ref = {
|
||||
ref = reactive({
|
||||
ageVerificationStatus: '',
|
||||
ageVerified: false,
|
||||
allowAvatarCopying: false,
|
||||
@@ -527,7 +528,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
$moderations: {},
|
||||
//
|
||||
...json
|
||||
};
|
||||
});
|
||||
if (locationStore.lastLocation.playerList.has(json.id)) {
|
||||
// update $location_at from instance join time
|
||||
const player = locationStore.lastLocation.playerList.get(
|
||||
@@ -553,7 +554,8 @@ export const useUserStore = defineStore('User', () => {
|
||||
ref.$customTag = '';
|
||||
ref.$customTagColour = '';
|
||||
}
|
||||
state.cachedUsers.set(ref.id, ref);
|
||||
cachedUsers.set(ref.id, ref);
|
||||
friendStore.updateFriend(ref.id);
|
||||
} else {
|
||||
if (json.state !== 'online') {
|
||||
// offline event before GPS to offline location
|
||||
@@ -593,7 +595,11 @@ export const useUserStore = defineStore('User', () => {
|
||||
changedProps[prop] = [toBe, asIs];
|
||||
}
|
||||
}
|
||||
Object.assign(ref, json);
|
||||
for (const prop in json) {
|
||||
if (typeof ref[prop] !== 'undefined') {
|
||||
ref[prop] = json[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
ref.$moderations = moderationStore.getUserModerations(ref.id);
|
||||
ref.$isVRCPlus = ref.tags.includes('system_supporter');
|
||||
@@ -726,7 +732,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
ref.$location_at = ts;
|
||||
}
|
||||
handleUserUpdate(ref, changedProps);
|
||||
if (AppGlobal.debugUserDiff) {
|
||||
if (AppDebug.debugUserDiff) {
|
||||
delete changedProps.last_login;
|
||||
delete changedProps.last_activity;
|
||||
if (Object.keys(changedProps).length !== 0) {
|
||||
@@ -820,7 +826,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
.catch((err) => {
|
||||
D.loading = false;
|
||||
D.visible = false;
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Failed to load user',
|
||||
type: 'error'
|
||||
});
|
||||
@@ -1014,15 +1020,16 @@ export const useUserStore = defineStore('User', () => {
|
||||
});
|
||||
}
|
||||
D.$location = L;
|
||||
L.user = null;
|
||||
if (L.userId) {
|
||||
ref = state.cachedUsers.get(L.userId);
|
||||
ref = cachedUsers.get(L.userId);
|
||||
if (typeof ref === 'undefined') {
|
||||
userRequest
|
||||
.getUser({
|
||||
userId: L.userId
|
||||
})
|
||||
.then((args) => {
|
||||
Vue.set(L, 'user', args.ref);
|
||||
D.$location.user = args.ref;
|
||||
});
|
||||
} else {
|
||||
L.user = ref;
|
||||
@@ -1031,10 +1038,10 @@ export const useUserStore = defineStore('User', () => {
|
||||
const users = [];
|
||||
let friendCount = 0;
|
||||
const playersInInstance = locationStore.lastLocation.playerList;
|
||||
const cachedCurrentUser = state.cachedUsers.get(state.currentUser.id);
|
||||
const cachedCurrentUser = cachedUsers.get(state.currentUser.id);
|
||||
const currentLocation = cachedCurrentUser.$location.tag;
|
||||
if (!L.isOffline && currentLocation === L.tag) {
|
||||
ref = state.cachedUsers.get(state.currentUser.id);
|
||||
ref = cachedUsers.get(state.currentUser.id);
|
||||
if (typeof ref !== 'undefined') {
|
||||
users.push(ref); // add self
|
||||
}
|
||||
@@ -1051,7 +1058,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
return friend.userId === user.id;
|
||||
});
|
||||
if (addUser) {
|
||||
ref = state.cachedUsers.get(friend.userId);
|
||||
ref = cachedUsers.get(friend.userId);
|
||||
if (typeof ref !== 'undefined') {
|
||||
users.push(ref);
|
||||
}
|
||||
@@ -1185,7 +1192,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Own avatar not found',
|
||||
type: 'error'
|
||||
});
|
||||
@@ -1216,7 +1223,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
if (!ref.displayName || ref.displayName.substring(0, 3) === 'ID:') {
|
||||
return;
|
||||
}
|
||||
for (ctx of state.cachedUsers.values()) {
|
||||
for (ctx of cachedUsers.values()) {
|
||||
if (ctx.displayName === ref.displayName) {
|
||||
showUserDialog(ctx.id);
|
||||
return;
|
||||
@@ -1304,7 +1311,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
time = 0;
|
||||
}
|
||||
}
|
||||
if (AppGlobal.debugFriendState && previousLocation) {
|
||||
if (AppDebug.debugFriendState && previousLocation) {
|
||||
console.log(
|
||||
`${ref.displayName} GPS ${previousLocation} -> ${newLocation}`
|
||||
);
|
||||
@@ -1314,7 +1321,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
}
|
||||
if (!previousLocation) {
|
||||
// no previous location
|
||||
if (AppGlobal.debugFriendState) {
|
||||
if (AppDebug.debugFriendState) {
|
||||
console.log(
|
||||
ref.displayName,
|
||||
'Ignoring GPS, no previous location',
|
||||
@@ -1584,14 +1591,14 @@ export const useUserStore = defineStore('User', () => {
|
||||
})
|
||||
.then(() => {
|
||||
const text = `Status automaticly changed to ${newStatus}`;
|
||||
if (AppGlobal.errorNoty) {
|
||||
AppGlobal.errorNoty.close();
|
||||
if (AppDebug.errorNoty) {
|
||||
AppDebug.errorNoty.close();
|
||||
}
|
||||
AppGlobal.errorNoty = new Noty({
|
||||
AppDebug.errorNoty = new Noty({
|
||||
type: 'info',
|
||||
text
|
||||
});
|
||||
AppGlobal.errorNoty.show();
|
||||
AppDebug.errorNoty.show();
|
||||
console.log(text);
|
||||
});
|
||||
}
|
||||
@@ -1613,7 +1620,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
'updateHudFeedTag',
|
||||
JSON.stringify(feedUpdate)
|
||||
);
|
||||
const ref = state.cachedUsers.get(data.UserId);
|
||||
const ref = cachedUsers.get(data.UserId);
|
||||
if (typeof ref !== 'undefined') {
|
||||
ref.$customTag = data.Tag;
|
||||
ref.$customTagColour = data.TagColour;
|
||||
@@ -1627,7 +1634,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
state.notes.clear();
|
||||
try {
|
||||
// todo: get users from store
|
||||
const users = state.cachedUsers;
|
||||
const users = cachedUsers;
|
||||
const dbNotes = await database.getAllUserNotes();
|
||||
for (const note of dbNotes) {
|
||||
state.notes.set(note.userId, note.note);
|
||||
@@ -1688,7 +1695,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
console.error('Error fetching user notes:', error);
|
||||
}
|
||||
// todo: get users from store
|
||||
const users = state.cachedUsers;
|
||||
const users = cachedUsers;
|
||||
|
||||
for (const note of newNotes.values()) {
|
||||
const newNote = {
|
||||
@@ -1754,9 +1761,13 @@ export const useUserStore = defineStore('User', () => {
|
||||
ref.$previousAvatarSwapTime = Date.now();
|
||||
}
|
||||
}
|
||||
Object.assign(ref, json);
|
||||
for (const prop in json) {
|
||||
if (typeof ref[prop] !== 'undefined') {
|
||||
ref[prop] = json[prop];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ref = {
|
||||
ref = reactive({
|
||||
acceptedPrivacyVersion: 0,
|
||||
acceptedTOSVersion: 0,
|
||||
accountDeletionDate: null,
|
||||
@@ -1842,7 +1853,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
username: '',
|
||||
viveId: '',
|
||||
// VRCX
|
||||
$online_for: Date.now(),
|
||||
$online_for: null,
|
||||
$offline_for: null,
|
||||
$location_at: Date.now(),
|
||||
$travelingToTime: Date.now(),
|
||||
@@ -1860,11 +1871,11 @@ export const useUserStore = defineStore('User', () => {
|
||||
$locationTag: '',
|
||||
$travelingToLocation: '',
|
||||
...json
|
||||
};
|
||||
});
|
||||
if (gameStore.isGameRunning) {
|
||||
ref.$previousAvatarSwapTime = Date.now();
|
||||
}
|
||||
state.cachedUsers.clear(); // clear before running applyUser
|
||||
cachedUsers.clear(); // clear before running applyUser
|
||||
state.currentUser = ref;
|
||||
authStore.loginComplete();
|
||||
}
|
||||
|
||||
+2
-1
@@ -152,7 +152,7 @@ export const useVrStore = defineStore('Vr', () => {
|
||||
hmdOverlay,
|
||||
wristOverlay: wristOverlaySettingsStore.overlayWrist,
|
||||
menuButton: wristOverlaySettingsStore.overlaybutton,
|
||||
overlayHand: wristOverlaySettingsStore.overlayHand
|
||||
overlayHand: parseInt(wristOverlaySettingsStore.overlayHand, 10)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -179,6 +179,7 @@ export const useVrStore = defineStore('Vr', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
vrInit,
|
||||
saveOpenVROption,
|
||||
updateVrNowPlaying,
|
||||
|
||||
+26
-26
@@ -1,10 +1,10 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { worldRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import configRepository from '../service/config';
|
||||
import { database } from '../service/database';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { failedGetRequests } from '../service/request';
|
||||
import { watchState } from '../service/watchState';
|
||||
import { debounce, parseLocation, refreshCustomCss } from '../shared/utils';
|
||||
@@ -24,7 +24,7 @@ import { useAdvancedSettingsStore } from './settings/advanced';
|
||||
import { useUpdateLoopStore } from './updateLoop';
|
||||
import { useUserStore } from './user';
|
||||
import { useWorldStore } from './world';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import Noty from 'noty';
|
||||
|
||||
export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
@@ -47,7 +47,6 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
const { t } = useI18n();
|
||||
|
||||
const state = reactive({
|
||||
isRunningUnderWine: false,
|
||||
databaseVersion: 0,
|
||||
clearVRCXCacheFrequency: 172800,
|
||||
proxyServer: '',
|
||||
@@ -174,6 +173,13 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const proxyServer = computed({
|
||||
get: () => state.proxyServer,
|
||||
set: async (value) => {
|
||||
state.proxyServer = value;
|
||||
}
|
||||
});
|
||||
|
||||
// Make sure file drops outside of the screenshot manager don't navigate to the file path dropped.
|
||||
// This issue persists on prompts created with prompt(), unfortunately. Not sure how to fix that.
|
||||
document.body.addEventListener('drop', function (e) {
|
||||
@@ -189,27 +195,20 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
}
|
||||
} else if (e.altKey && e.key === 'R') {
|
||||
refreshCustomCss();
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Custom CSS refreshed',
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const isRunningUnderWine = computed({
|
||||
get: () => state.isRunningUnderWine,
|
||||
set: (value) => {
|
||||
state.isRunningUnderWine = value;
|
||||
}
|
||||
});
|
||||
|
||||
function showConsole() {
|
||||
AppApi.ShowDevTools();
|
||||
if (
|
||||
AppGlobal.debug ||
|
||||
AppGlobal.debugWebRequests ||
|
||||
AppGlobal.debugWebSocket ||
|
||||
AppGlobal.debugUserDiff
|
||||
AppDebug.debug ||
|
||||
AppDebug.debugWebRequests ||
|
||||
AppDebug.debugWebSocket ||
|
||||
AppDebug.debugUserDiff
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -229,7 +228,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
let msgBox;
|
||||
if (state.databaseVersion < databaseVersion) {
|
||||
if (state.databaseVersion) {
|
||||
msgBox = $app.$message({
|
||||
msgBox = ElMessage({
|
||||
message:
|
||||
'DO NOT CLOSE VRCX, database upgrade in progress...',
|
||||
type: 'warning',
|
||||
@@ -260,7 +259,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
msgBox?.close();
|
||||
if (state.databaseVersion) {
|
||||
// only display when database exists
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Database upgrade complete',
|
||||
type: 'success'
|
||||
});
|
||||
@@ -269,7 +268,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
msgBox?.close();
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message:
|
||||
'Database upgrade failed, check console for details',
|
||||
type: 'error',
|
||||
@@ -450,7 +449,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
console.log('Game closed, skipped event', data);
|
||||
return;
|
||||
}
|
||||
if (AppGlobal.debugPhotonLogging) {
|
||||
if (AppDebug.debugPhotonLogging) {
|
||||
console.log(
|
||||
'OnEvent',
|
||||
data.OnEventData.Code,
|
||||
@@ -465,7 +464,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
console.log('Game closed, skipped event', data);
|
||||
return;
|
||||
}
|
||||
if (AppGlobal.debugPhotonLogging) {
|
||||
if (AppDebug.debugPhotonLogging) {
|
||||
console.log(
|
||||
'OnOperationResponse',
|
||||
data.OnOperationResponseData.OperationCode,
|
||||
@@ -483,7 +482,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
console.log('Game closed, skipped event', data);
|
||||
return;
|
||||
}
|
||||
if (AppGlobal.debugPhotonLogging) {
|
||||
if (AppDebug.debugPhotonLogging) {
|
||||
console.log(
|
||||
'OnOperationRequest',
|
||||
data.OnOperationRequestData.OperationCode,
|
||||
@@ -507,7 +506,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
photonStore.photonLastEvent7List = Date.parse(data.dt);
|
||||
break;
|
||||
case 'VrcxMessage':
|
||||
if (AppGlobal.debugPhotonLogging) {
|
||||
if (AppDebug.debugPhotonLogging) {
|
||||
console.log('VrcxMessage:', data);
|
||||
}
|
||||
eventVrcxMessage(data);
|
||||
@@ -601,7 +600,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
const regexAvatarId =
|
||||
/avtr_[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}/g;
|
||||
if (!avatarId.match(regexAvatarId) || avatarId.length !== 41) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Invalid Avatar ID',
|
||||
type: 'error'
|
||||
});
|
||||
@@ -699,7 +698,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
return;
|
||||
}
|
||||
// popup message about auto restore
|
||||
$app.$alert(
|
||||
ElMessageBox.alert(
|
||||
t('dialog.registry_backup.restore_prompt'),
|
||||
t('dialog.registry_backup.header')
|
||||
);
|
||||
@@ -764,7 +763,8 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
isRunningUnderWine,
|
||||
|
||||
proxyServer,
|
||||
currentlyDroppingFile,
|
||||
isRegistryBackupDialogVisible,
|
||||
ipcEnabled,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import * as workerTimers from 'worker-timers';
|
||||
import { $app } from '../app';
|
||||
import configRepository from '../service/config';
|
||||
import { branches } from '../shared/constants';
|
||||
import { changeLogRemoveLinks } from '../shared/utils';
|
||||
import { useUiStore } from './ui';
|
||||
import { useI18n } from 'vue-i18n-bridge';
|
||||
import { AppGlobal } from '../service/appConfig';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
|
||||
export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
|
||||
const uiStore = useUiStore();
|
||||
@@ -253,7 +253,7 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
|
||||
}
|
||||
state.pendingVRCXUpdate = false;
|
||||
const json = JSON.parse(response.data);
|
||||
if (AppGlobal.debugWebRequests) {
|
||||
if (AppDebug.debugWebRequests) {
|
||||
console.log(json, response);
|
||||
}
|
||||
if (json === Object(json) && json.name && json.published_at) {
|
||||
@@ -315,12 +315,12 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
|
||||
state.checkingForVRCXUpdate = false;
|
||||
}
|
||||
const json = JSON.parse(response.data);
|
||||
if (AppGlobal.debugWebRequests) {
|
||||
if (AppDebug.debugWebRequests) {
|
||||
console.log(json, response);
|
||||
}
|
||||
const releases = [];
|
||||
if (typeof json !== 'object' || json.message) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t('message.vrcx_updater.failed', {
|
||||
message: json.message
|
||||
}),
|
||||
@@ -364,7 +364,7 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
|
||||
state.pendingVRCXInstall = releaseName;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: `${t('message.vrcx_updater.failed_install')} ${err}`,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
+12
-17
@@ -1,7 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { instanceRequest, miscRequest, worldRequest } from '../api';
|
||||
import { $app } from '../app';
|
||||
import { database } from '../service/database';
|
||||
import { watchState } from '../service/watchState';
|
||||
import {
|
||||
@@ -42,7 +42,7 @@ export const useWorldStore = defineStore('World', () => {
|
||||
cacheSize: '',
|
||||
cacheLocked: false,
|
||||
cachePath: '',
|
||||
fileAnalysis: {},
|
||||
fileAnalysis: [],
|
||||
lastVisit: '',
|
||||
visitCount: 0,
|
||||
timeSpent: 0,
|
||||
@@ -50,10 +50,11 @@ export const useWorldStore = defineStore('World', () => {
|
||||
isQuest: false,
|
||||
isIos: false,
|
||||
hasPersistData: false
|
||||
},
|
||||
cachedWorlds: new Map()
|
||||
}
|
||||
});
|
||||
|
||||
let cachedWorlds = new Map();
|
||||
|
||||
const worldDialog = computed({
|
||||
get: () => state.worldDialog,
|
||||
set: (value) => {
|
||||
@@ -61,24 +62,17 @@ export const useWorldStore = defineStore('World', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const cachedWorlds = computed({
|
||||
get: () => state.cachedWorlds,
|
||||
set: (value) => {
|
||||
state.cachedWorlds = value;
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => watchState.isLoggedIn,
|
||||
() => {
|
||||
state.worldDialog.visible = false;
|
||||
state.cachedWorlds.clear();
|
||||
cachedWorlds.clear();
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
);
|
||||
|
||||
/**
|
||||
* aka: `$app.methods.showWorldDialog`
|
||||
*
|
||||
* @param {string} tag
|
||||
* @param {string} shortName
|
||||
*/
|
||||
@@ -100,7 +94,7 @@ export const useWorldStore = defineStore('World', () => {
|
||||
D.cacheSize = '';
|
||||
D.cacheLocked = false;
|
||||
D.cachePath = '';
|
||||
D.fileAnalysis = {};
|
||||
D.fileAnalysis = [];
|
||||
D.rooms = [];
|
||||
D.lastVisit = '';
|
||||
D.visitCount = 0;
|
||||
@@ -145,7 +139,7 @@ export const useWorldStore = defineStore('World', () => {
|
||||
.catch((err) => {
|
||||
D.loading = false;
|
||||
D.visible = false;
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: 'Failed to load world',
|
||||
type: 'error'
|
||||
});
|
||||
@@ -240,7 +234,7 @@ export const useWorldStore = defineStore('World', () => {
|
||||
if (json.description) {
|
||||
json.description = replaceBioSymbols(json.description);
|
||||
}
|
||||
let ref = state.cachedWorlds.get(json.id);
|
||||
let ref = cachedWorlds.get(json.id);
|
||||
if (typeof ref === 'undefined') {
|
||||
ref = {
|
||||
id: '',
|
||||
@@ -283,7 +277,7 @@ export const useWorldStore = defineStore('World', () => {
|
||||
//
|
||||
...json
|
||||
};
|
||||
state.cachedWorlds.set(ref.id, ref);
|
||||
cachedWorlds.set(ref.id, ref);
|
||||
} else {
|
||||
Object.assign(ref, json);
|
||||
}
|
||||
@@ -326,6 +320,7 @@ export const useWorldStore = defineStore('World', () => {
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
worldDialog,
|
||||
cachedWorlds,
|
||||
showWorldDialog,
|
||||
|
||||
Reference in New Issue
Block a user