Compare commits
No commits in common. "39ccb904ef7fccc528a98bfb49898d50b857ebc7" and "153ea2b193d0ae8c17661c594bff3a9791315c58" have entirely different histories.
39ccb904ef
...
153ea2b193
@ -10,7 +10,7 @@ const UPLOAD_TIMEOUT = 1800000; // 30 min
|
||||
function _debugLog(msg) {
|
||||
try {
|
||||
const ts = new Date().toISOString();
|
||||
fs.appendFileSync(path.join(__dirname, '..', 'doodstream-debug.log'), `[${ts}] ${msg}\n`);
|
||||
fs.appendFileSync(path.join(process.cwd(), 'doodstream-debug.log'), `[${ts}] ${msg}\n`);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
|
||||
@ -254,7 +254,6 @@ function createUploadBody(filePath, formFields, onProgress, throttle, signal) {
|
||||
yield preambleBuf;
|
||||
const fileStream = fs.createReadStream(filePath, { highWaterMark: CHUNK_SIZE });
|
||||
for await (const chunk of fileStream) {
|
||||
if (signal && signal.aborted) throw new Error('Aborted');
|
||||
if (throttle) await throttle.consume(chunk.length, signal);
|
||||
bytesRead += chunk.length;
|
||||
yield chunk;
|
||||
|
||||
@ -21,7 +21,6 @@ class Throttle {
|
||||
bytes -= available;
|
||||
}
|
||||
if (bytes > 0) {
|
||||
if (signal && signal.aborted) return;
|
||||
// Wait 50ms for tokens to refill
|
||||
await new Promise((r) => setTimeout(r, 50));
|
||||
}
|
||||
|
||||
@ -56,8 +56,7 @@ function findLatestYml(assets) {
|
||||
async function fetchJson(url, signal) {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), CHECK_TIMEOUT);
|
||||
const onAbort = () => controller.abort();
|
||||
if (signal) signal.addEventListener('abort', onAbort);
|
||||
if (signal) signal.addEventListener('abort', () => controller.abort());
|
||||
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
@ -68,7 +67,6 @@ async function fetchJson(url, signal) {
|
||||
return await res.json();
|
||||
} finally {
|
||||
clearTimeout(timeout);
|
||||
if (signal) signal.removeEventListener('abort', onAbort);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,20 +48,13 @@ class UploadManager extends EventEmitter {
|
||||
sem.updateLimit(settings.parallelCount);
|
||||
}
|
||||
// Update global throttle if speed limit changed
|
||||
const newKbs = (this.globalSettings.globalMaxSpeedKbs || 0);
|
||||
if (newKbs > 0) {
|
||||
if (this.globalThrottle) {
|
||||
if (this.globalThrottle) {
|
||||
const newKbs = (this.globalSettings.globalMaxSpeedKbs || 0);
|
||||
if (newKbs > 0) {
|
||||
this.globalThrottle.updateRate(newKbs * 1024);
|
||||
} else {
|
||||
this.globalThrottle = new Throttle(newKbs * 1024);
|
||||
this.globalThrottle = null;
|
||||
}
|
||||
} else {
|
||||
this.globalThrottle = null;
|
||||
}
|
||||
// Update global semaphore live
|
||||
const globalLimit = this._getGlobalParallelLimit();
|
||||
if (globalLimit > 0 && this.globalSemaphore) {
|
||||
this.globalSemaphore.updateLimit(globalLimit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,7 +262,7 @@ class UploadManager extends EventEmitter {
|
||||
attempt,
|
||||
maxAttempts
|
||||
});
|
||||
await this._sleep(3000, signal);
|
||||
await this._sleep(2500, signal);
|
||||
}
|
||||
|
||||
const jobStart = Date.now();
|
||||
|
||||
1
main.js
1
main.js
@ -577,7 +577,6 @@ ipcMain.handle('start-upload', (_event, payload) => {
|
||||
// This ensures webContents.send() calls from upload events
|
||||
// are not interleaved with the handle() response.
|
||||
process.nextTick(() => {
|
||||
if (!uploadManager) { debugLog('nextTick: uploadManager was nulled before startBatch'); return; }
|
||||
debugLog('nextTick: calling startBatch now');
|
||||
uploadManager.startBatch(tasks).catch((err) => {
|
||||
debugLog(`startBatch REJECTED: ${err && err.stack ? err.stack : err}`);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "multi-hoster-uploader",
|
||||
"version": "1.6.9",
|
||||
"version": "1.6.8",
|
||||
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
@ -691,7 +691,6 @@ function sortQueueJobs(jobs) {
|
||||
else if (key === 'host') cmp = a.hoster.localeCompare(b.hoster);
|
||||
else if (key === 'status') cmp = getStatusOrder(a.status) - getStatusOrder(b.status);
|
||||
else if (key === 'speed') cmp = (a.speedKbs || 0) - (b.speedKbs || 0);
|
||||
else if (key === 'progress') cmp = (a.progress || 0) - (b.progress || 0);
|
||||
return cmp * factor;
|
||||
});
|
||||
}
|
||||
@ -1952,11 +1951,12 @@ async function loadHistory() {
|
||||
for (const file of (batch.files || [])) {
|
||||
for (const result of (file.results || [])) {
|
||||
if (result.status === 'aborted' || result.status === 'error') continue;
|
||||
const isError = result.status === 'error';
|
||||
historyRowsData.push({
|
||||
date: dt.text, dateTs: dt.ts,
|
||||
filename: file.name || '', host: result.hoster || '',
|
||||
link: result.download_url || result.embed_url || '',
|
||||
isError: false, order: order++
|
||||
link: isError ? `[Fehler] ${result.error || ''}` : (result.download_url || result.embed_url || ''),
|
||||
isError, order: order++
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -2135,7 +2135,6 @@ function setupListeners() {
|
||||
const tr = e.target.closest('.recent-file-row');
|
||||
if (!tr) return;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const id = parseInt(tr.dataset.order, 10);
|
||||
if (!selectedRecentIds.has(id)) {
|
||||
selectedRecentIds.clear();
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
<th class="col-elapsed">Zeit</th>
|
||||
<th class="col-remaining">Rest</th>
|
||||
<th class="col-speed sortable" data-sort="speed">Speed</th>
|
||||
<th class="col-progress sortable" data-sort="progress">Fortschritt</th>
|
||||
<th class="col-progress">Fortschritt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="queueBody"></tbody>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user