From e0f7d54ab5b5e47911f1d590ce62d31e353dfe26 Mon Sep 17 00:00:00 2001 From: Natsumi Date: Fri, 11 Oct 2024 16:06:16 +1300 Subject: [PATCH] Fix 2FA dialog not opening & notifications table --- html/src/app.js | 11 +++++++++++ html/src/repository/database.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/html/src/app.js b/html/src/app.js index f57750e2..aee89b7f 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -488,6 +488,17 @@ speechSynthesis.getVoices(); this.$emit('AUTOLOGIN'); throw new Error('401: Missing Credentials'); } + if ( + status === 401 && + data.error.message === '"Unauthorized"' && + endpoint !== 'auth/user' + ) { + // trigger 2FA dialog + if (!$app.twoFactorAuthDialogVisible) { + $app.API.getCurrentUser(); + } + throw new Error('401: Unauthorized'); + } if (status === 403 && endpoint.substring(0, 6) === 'config') { $app.$alert( 'VRChat currently blocks most VPNs. Please disable any connected VPNs and try again.', diff --git a/html/src/repository/database.js b/html/src/repository/database.js index 70ccbe76..799ccbf9 100644 --- a/html/src/repository/database.js +++ b/html/src/repository/database.js @@ -800,7 +800,7 @@ class Database { row.$isExpired = true; } notifications.unshift(row); - }, `SELECT * FROM ${Database.userPrefix}_notifications ORDER BY id DESC LIMIT ${Database.maxTableSize}`); + }, `SELECT * FROM ${Database.userPrefix}_notifications ORDER BY created_at DESC LIMIT ${Database.maxTableSize}`); return notifications; }