This commit is contained in:
2025-09-29 11:51:58 +02:00
parent f9102d7bcd
commit b2d77a099b
7 changed files with 539 additions and 66 deletions

View File

@@ -206,6 +206,7 @@ class AniWorldApp {
this.socket.on('download_started', (data) => {
this.isDownloading = true;
this.isPaused = false;
this.updateProcessStatus('download', true);
this.showDownloadQueue(data);
this.showStatus(`Starting download of ${data.total_series} series...`, true, true);
});
@@ -237,6 +238,21 @@ class AniWorldApp {
this.showToast(`${this.localization.getText('download-failed')}: ${data.message}`, 'error');
});
// Download queue status events
this.socket.on('download_queue_completed', () => {
this.updateProcessStatus('download', false);
this.showToast('All downloads completed!', 'success');
});
this.socket.on('download_stop_requested', () => {
this.showToast('Stopping downloads...', 'info');
});
this.socket.on('download_stopped', () => {
this.updateProcessStatus('download', false);
this.showToast('Downloads stopped', 'success');
});
// Download queue events
this.socket.on('download_queue_update', (data) => {
this.updateDownloadQueue(data);
@@ -476,7 +492,13 @@ class AniWorldApp {
}
async makeAuthenticatedRequest(url, options = {}) {
const response = await fetch(url, options);
// Ensure credentials are included for session-based authentication
const requestOptions = {
credentials: 'same-origin',
...options
};
const response = await fetch(url, requestOptions);
if (response.status === 401) {
window.location.href = '/login';