mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 22:36:05 +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:
+30
-14
@@ -1,6 +1,6 @@
|
||||
import Noty from 'noty';
|
||||
import { $app } from '../app.js';
|
||||
import { t } from '../plugin';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { i18n } from '../plugin/i18n';
|
||||
import { statusCodes } from '../shared/constants/api.js';
|
||||
import { escapeTag } from '../shared/utils';
|
||||
import {
|
||||
@@ -10,13 +10,15 @@ import {
|
||||
useUpdateLoopStore,
|
||||
useUserStore
|
||||
} from '../stores';
|
||||
import { AppGlobal } from './appConfig.js';
|
||||
import { AppDebug } from './appConfig.js';
|
||||
import webApiService from './webapi.js';
|
||||
import { watchState } from './watchState';
|
||||
|
||||
const pendingGetRequests = new Map();
|
||||
export let failedGetRequests = new Map();
|
||||
|
||||
const t = i18n.global.t;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {string} endpoint
|
||||
@@ -38,7 +40,7 @@ export function request(endpoint, options) {
|
||||
}
|
||||
let req;
|
||||
const init = {
|
||||
url: `${AppGlobal.endpointDomain}/${endpoint}`,
|
||||
url: `${AppDebug.endpointDomain}/${endpoint}`,
|
||||
method: 'GET',
|
||||
...options
|
||||
};
|
||||
@@ -50,7 +52,7 @@ export function request(endpoint, options) {
|
||||
if (lastRun >= Date.now() - 900000) {
|
||||
// 15mins
|
||||
$throw(
|
||||
0,
|
||||
-1,
|
||||
t('api.error.message.403_404_bailing_request'),
|
||||
endpoint
|
||||
);
|
||||
@@ -102,14 +104,14 @@ export function request(endpoint, options) {
|
||||
throw `API request blocked while logged out: ${endpoint}`;
|
||||
}
|
||||
if (!response.data) {
|
||||
if (AppGlobal.debugWebRequests) {
|
||||
if (AppDebug.debugWebRequests) {
|
||||
console.log(init, 'no data', response);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
try {
|
||||
response.data = JSON.parse(response.data);
|
||||
if (AppGlobal.debugWebRequests) {
|
||||
if (AppDebug.debugWebRequests) {
|
||||
console.log(init, 'parsed data', response.data);
|
||||
}
|
||||
return response;
|
||||
@@ -179,7 +181,7 @@ export function request(endpoint, options) {
|
||||
}
|
||||
}
|
||||
if (status === 403 && endpoint === 'config') {
|
||||
$app.$alert(
|
||||
ElMessageBox.alert(
|
||||
t('api.error.message.vpn_in_use'),
|
||||
`403 ${t('api.error.message.login_error')}`
|
||||
);
|
||||
@@ -191,7 +193,7 @@ export function request(endpoint, options) {
|
||||
status === 404 &&
|
||||
endpoint.startsWith('avatars/')
|
||||
) {
|
||||
$app.$message({
|
||||
ElMessage({
|
||||
message: t('message.api_handler.avatar_private_or_deleted'),
|
||||
type: 'error'
|
||||
});
|
||||
@@ -276,15 +278,29 @@ export function $throw(code, error, endpoint) {
|
||||
);
|
||||
}
|
||||
const text = message.map((s) => escapeTag(s)).join('<br>');
|
||||
if (text.length) {
|
||||
if (AppGlobal.errorNoty) {
|
||||
AppGlobal.errorNoty.close();
|
||||
let ignoreError = false;
|
||||
if (
|
||||
(code === 404 || code === -1) &&
|
||||
endpoint.split('/').length === 2 &&
|
||||
(endpoint.startsWith('users/') ||
|
||||
endpoint.startsWith('worlds/') ||
|
||||
endpoint.startsWith('avatars/') ||
|
||||
endpoint.startsWith('file/'))
|
||||
) {
|
||||
ignoreError = true;
|
||||
}
|
||||
if (endpoint.startsWith('analysis/')) {
|
||||
ignoreError = true;
|
||||
}
|
||||
if (text.length && !ignoreError) {
|
||||
if (AppDebug.errorNoty) {
|
||||
AppDebug.errorNoty.close();
|
||||
}
|
||||
AppGlobal.errorNoty = new Noty({
|
||||
AppDebug.errorNoty = new Noty({
|
||||
type: 'error',
|
||||
text
|
||||
});
|
||||
AppGlobal.errorNoty.show();
|
||||
AppDebug.errorNoty.show();
|
||||
}
|
||||
const e = new Error(text);
|
||||
e.status = code;
|
||||
|
||||
Reference in New Issue
Block a user