mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 14:46:04 +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,
|
||||
|
||||
Reference in New Issue
Block a user