Compare commits

..

No commits in common. "f6afdad5baea29a2fe0ad55e53496085c2280f9d" and "7fe4a92b66c1eda7d549746bb147d04f5e2a3cd3" have entirely different histories.

2 changed files with 54 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "multi-hoster-uploader", "name": "multi-hoster-uploader",
"version": "2.5.0", "version": "2.4.4",
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously", "description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@ -1292,6 +1292,9 @@ function getSelectedJobLinks() {
// --- Upload --- // --- Upload ---
async function startUpload() { async function startUpload() {
if (uploading) return; if (uploading) return;
// Wait for any running health check to finish (e.g. startup auto-check)
// eslint-disable-next-line no-unmodified-loop-condition -- healthCheckRunning is modified externally between awaits
for (let _hcWait = 0; healthCheckRunning && _hcWait < 300; _hcWait++) await new Promise(r => setTimeout(r, 100)); // max 30s
uploading = true; // set immediately to prevent double-click race uploading = true; // set immediately to prevent double-click race
updateQueueActionButtons(); updateQueueActionButtons();
@ -1302,6 +1305,30 @@ async function startUpload() {
const jobsToStart = queueJobs.filter((job) => job.status === 'preview' || job.status === 'queued'); const jobsToStart = queueJobs.filter((job) => job.status === 'preview' || job.status === 'queued');
if (jobsToStart.length === 0) { uploading = false; updateQueueActionButtons(); return; } if (jobsToStart.length === 0) { uploading = false; updateQueueActionButtons(); return; }
// Auto health check — only check hosters that have jobs to start
if (autoHealthCheckEnabled) {
const jobHosters = new Set(jobsToStart.map(j => j.hoster));
const checkHosters = [...jobHosters].filter(name => name === 'doodstream.com' || name === 'vidmoly.me' || name === 'voe.sx' || name === 'byse.sx');
if (checkHosters.length > 0) {
healthCheckRunning = true;
try {
const rows = await executeHealthCheck(checkHosters, 'auto');
const errors = rows.filter(r => r.status === 'error');
if (errors.length > 0) {
alert(`Auto-Check fehlgeschlagen:\n${errors.map(r => `${r.hoster}: ${r.message}`).join('\n')}\n\nUpload wurde nicht gestartet.`);
uploading = false; updateQueueActionButtons();
return;
}
} catch (err) {
alert(`Auto-Check fehlgeschlagen: ${err.message}\nUpload wurde nicht gestartet.`);
uploading = false; updateQueueActionButtons();
return;
} finally {
healthCheckRunning = false;
}
}
}
try { try {
queueJobs.forEach(j => { queueJobs.forEach(j => {
if (j.status === 'preview') j.status = 'queued'; if (j.status === 'preview') j.status = 'queued';
@ -1338,6 +1365,8 @@ async function startUpload() {
async function startSelectedUpload() { async function startSelectedUpload() {
if (uploading) return; if (uploading) return;
// eslint-disable-next-line no-unmodified-loop-condition -- healthCheckRunning is modified externally between awaits
for (let _hcWait = 0; healthCheckRunning && _hcWait < 300; _hcWait++) await new Promise(r => setTimeout(r, 100)); // max 30s
uploading = true; // set immediately to prevent double-click race uploading = true; // set immediately to prevent double-click race
updateQueueActionButtons(); updateQueueActionButtons();
@ -1347,6 +1376,30 @@ async function startSelectedUpload() {
const jobsToStart = queueJobs.filter((job) => selectedJobIds.has(job.id) && (job.status === 'preview' || job.status === 'queued')); const jobsToStart = queueJobs.filter((job) => selectedJobIds.has(job.id) && (job.status === 'preview' || job.status === 'queued'));
if (jobsToStart.length === 0) { uploading = false; updateQueueActionButtons(); return; } if (jobsToStart.length === 0) { uploading = false; updateQueueActionButtons(); return; }
// Auto health check — only check hosters that have jobs to start
if (autoHealthCheckEnabled) {
const jobHosters = new Set(jobsToStart.map(j => j.hoster));
const checkHosters = [...jobHosters].filter(name => name === 'doodstream.com' || name === 'vidmoly.me' || name === 'voe.sx' || name === 'byse.sx');
if (checkHosters.length > 0) {
healthCheckRunning = true;
try {
const rows = await executeHealthCheck(checkHosters, 'auto');
const errors = rows.filter(r => r.status === 'error');
if (errors.length > 0) {
alert(`Auto-Check fehlgeschlagen:\n${errors.map(r => `${r.hoster}: ${r.message}`).join('\n')}\n\nUpload wurde nicht gestartet.`);
uploading = false; updateQueueActionButtons();
return;
}
} catch (err) {
alert(`Auto-Check fehlgeschlagen: ${err.message}\nUpload wurde nicht gestartet.`);
uploading = false; updateQueueActionButtons();
return;
} finally {
healthCheckRunning = false;
}
}
}
try { try {
jobsToStart.forEach(j => { jobsToStart.forEach(j => {
if (j.status === 'preview') j.status = 'queued'; if (j.status === 'preview') j.status = 'queued';