moved routing

This commit is contained in:
2025-09-29 14:13:15 +02:00
parent b73210a3c9
commit 423b77033c
20 changed files with 2328 additions and 1267 deletions

View File

@@ -212,11 +212,36 @@ class AniWorldApp {
});
this.socket.on('download_progress', (data) => {
if (data.total_bytes) {
const percent = ((data.downloaded_bytes || 0) / data.total_bytes * 100).toFixed(1);
this.updateProgress(percent, `Downloading: ${percent}%`);
let status = '';
let percent = 0;
if (data.progress !== undefined) {
percent = data.progress;
status = `Downloading: ${percent.toFixed(1)}%`;
// Add speed information if available
if (data.speed_mbps && data.speed_mbps > 0) {
status += ` (${data.speed_mbps.toFixed(1)} Mbps)`;
}
// Add ETA information if available
if (data.eta_seconds && data.eta_seconds > 0) {
const eta = this.formatETA(data.eta_seconds);
status += ` - ETA: ${eta}`;
}
} else if (data.total_bytes) {
percent = ((data.downloaded_bytes || 0) / data.total_bytes * 100);
status = `Downloading: ${percent.toFixed(1)}%`;
} else if (data.downloaded_mb !== undefined) {
status = `Downloaded: ${data.downloaded_mb.toFixed(1)} MB`;
} else {
this.updateStatus(`Downloading: ${data.percent || '0%'}`);
status = `Downloading: ${data.percent || '0%'}`;
}
if (percent > 0) {
this.updateProgress(percent, status);
} else {
this.updateStatus(status);
}
});
@@ -1980,6 +2005,25 @@ class AniWorldApp {
console.log('Mobile & Accessibility features initialized');
}
formatETA(seconds) {
if (!seconds || seconds <= 0) return '---';
if (seconds < 60) {
return `${Math.round(seconds)}s`;
} else if (seconds < 3600) {
const minutes = Math.round(seconds / 60);
return `${minutes}m`;
} else if (seconds < 86400) {
const hours = Math.floor(seconds / 3600);
const minutes = Math.round((seconds % 3600) / 60);
return `${hours}h ${minutes}m`;
} else {
const days = Math.floor(seconds / 86400);
const hours = Math.round((seconds % 86400) / 3600);
return `${days}d ${hours}h`;
}
}
}
// Initialize the application when DOM is loaded