download re implemented

This commit is contained in:
2025-10-30 22:06:41 +01:00
parent 6ebc2ed2ea
commit 3be175522f
16 changed files with 359 additions and 1335 deletions

View File

@@ -505,19 +505,6 @@ class AniWorldApp {
this.hideStatus();
});
// Download controls
document.getElementById('pause-download').addEventListener('click', () => {
this.pauseDownload();
});
document.getElementById('resume-download').addEventListener('click', () => {
this.resumeDownload();
});
document.getElementById('cancel-download').addEventListener('click', () => {
this.cancelDownload();
});
// Logout functionality
document.getElementById('logout-btn').addEventListener('click', () => {
this.logout();
@@ -2006,57 +1993,6 @@ class AniWorldApp {
}
}
async pauseDownload() {
if (!this.isDownloading || this.isPaused) return;
try {
const response = await this.makeAuthenticatedRequest('/api/queue/pause', { method: 'POST' });
if (!response) return;
const data = await response.json();
document.getElementById('pause-download').classList.add('hidden');
document.getElementById('resume-download').classList.remove('hidden');
this.showToast('Queue paused', 'warning');
} catch (error) {
console.error('Pause error:', error);
this.showToast('Failed to pause queue', 'error');
}
}
async resumeDownload() {
if (!this.isDownloading || !this.isPaused) return;
try {
const response = await this.makeAuthenticatedRequest('/api/queue/resume', { method: 'POST' });
if (!response) return;
const data = await response.json();
document.getElementById('pause-download').classList.remove('hidden');
document.getElementById('resume-download').classList.add('hidden');
this.showToast('Queue resumed', 'success');
} catch (error) {
console.error('Resume error:', error);
this.showToast('Failed to resume queue', 'error');
}
}
async cancelDownload() {
if (!this.isDownloading) return;
if (confirm('Are you sure you want to stop the download queue?')) {
try {
const response = await this.makeAuthenticatedRequest('/api/queue/stop', { method: 'POST' });
if (!response) return;
const data = await response.json();
this.showToast('Queue stopped', 'warning');
} catch (error) {
console.error('Stop error:', error);
this.showToast('Failed to stop queue', 'error');
}
}
}
showDownloadQueue(data) {
const queueSection = document.getElementById('download-queue-section');
const queueProgress = document.getElementById('queue-progress');