fix(ui): handle any session expired and trigger transparently a refresh token

this change replace original window.fetch by a wrapper that check any 401 response, is so it will request a refresh token
this solve current issue with Favorites & Recent sections that give blank page when token is expired

- exclusion of requests to other domain (401 will not be handled here)
- security with shares /api/s is not handled

- check with CSRF, no risk
This commit is contained in:
Edouard Vanbelle
2026-05-07 00:42:26 +02:00
parent 405721c679
commit a69dde35ce
4 changed files with 115 additions and 8 deletions
+2 -2
View File
@@ -182,8 +182,8 @@ async function loadFiles(options = { insertHistory: true }) {
// not required anymore
clearTimeout(loadingFiles);
if (response.status === 401 || response.status === 403) {
console.warn('Auth error when loading files, showing empty list');
if (response.status === 403) {
console.warn('Forbidden when loading files');
// FIXME: i18n
ui.showError(`<p>Could not load files</p>`);
return;
+4
View File
@@ -3,6 +3,10 @@
* This file contains the core functionality, initialization and state management
*/
import { installFetchInterceptor } from '../core/fetchWrapper.js';
installFetchInterceptor();
import { formatFileSize, formatQuotaSize } from '../core/formatters.js';
import { i18n } from '../core/i18n.js';
import { Modal } from '../core/modal.js';