Compare commits

..

No commits in common. "7a5278012bd23e94cb26374fb799c3d2ba809b1c" and "b7336eefb8d21d8555afe8d39a9818fbd4c375cd" have entirely different histories.

2 changed files with 15 additions and 39 deletions

View File

@ -72,20 +72,14 @@ class UploadManager extends EventEmitter {
/limit (reached|exceeded|überschritten)/i, /limit (reached|exceeded|überschritten)/i,
/rate[- ]?limit/i, /rate[- ]?limit/i,
/too many requests/i, /too many requests/i,
/\b(401|403|429)\b/, /\b(401|403)\b/,
/Falscher (User|Username|Passwort)/i, /Falscher (User|Username|Passwort)/i,
/Incorrect (Login|Password)/i, /Incorrect (Login|Password)/i,
/invalid (credentials|api[- ]?key|token|session)/i, /invalid (credentials|api[- ]?key|token|session)/i,
/(account|user) (banned|suspended|disabled|gesperrt)/i, /(account|user) (banned|suspended|disabled|gesperrt)/i,
/not authorized/i, /not authorized/i,
/forbidden/i, /forbidden/i,
/session (expired|abgelaufen)/i, /session (expired|abgelaufen)/i
// Session/CSRF hints — the account's server session went stale, which
// no amount of retrying will fix. Re-login happens on the next account.
/CSRF[- ]?Token nicht gefunden/i,
/CSRF[- ]?token not found/i,
/Bist du eingeloggt/i,
/not logged in/i
]; ];
return PATTERNS.some(p => p.test(m)); return PATTERNS.some(p => p.test(m));
} }
@ -530,34 +524,23 @@ class UploadManager extends EventEmitter {
return; return;
} }
// Account rotation: mark the current account failed (if not already), // Account rotation: mark the current account failed, wait for main to
// wait for main to resolve the next fallback, then retry. Loops so // resolve the next fallback, then retry. Loop so A → B → C → ... works
// A → B → C → ... works for hosters with 3+ accounts. // for hosters with 3+ accounts (the old code only did one level: A → B
// // and stopped, even if C would have worked).
// CRITICAL: we must ALWAYS check for an existing override, even if this
// account is already in _failedAccounts (e.g. another concurrent job
// already marked it failed). Otherwise the second job falls straight
// through to final-error instead of using the already-resolved fallback.
this._rotLog('retries-exhausted', { this._rotLog('retries-exhausted', {
hoster: task.hoster, fileName, accountId: task.accountId, hoster: task.hoster, fileName, accountId: task.accountId,
lastError: lastError ? lastError.message : null lastError: lastError ? lastError.message : null
}); });
while (task.accountId) { while (task.accountId && !this._failedAccounts.has(task.hoster + ':' + task.accountId)) {
if (signal.aborted || this.stopAfterActive) break; if (signal.aborted || this.stopAfterActive) break;
const alreadyMarked = this._failedAccounts.has(task.hoster + ':' + task.accountId); this._failedAccounts.set(task.hoster + ':' + task.accountId, true);
if (!alreadyMarked) { this._rotLog('mark-failed', {
this._failedAccounts.set(task.hoster + ':' + task.accountId, true); hoster: task.hoster, fileName, accountId: task.accountId,
this._rotLog('mark-failed', { lastError: lastError ? lastError.message : null
hoster: task.hoster, fileName, accountId: task.accountId, });
lastError: lastError ? lastError.message : null this.emit('account-failed', { hoster: task.hoster, accountId: task.accountId });
}); await this._sleep(800, signal);
this.emit('account-failed', { hoster: task.hoster, accountId: task.accountId });
await this._sleep(800, signal);
} else {
this._rotLog('already-marked', {
hoster: task.hoster, fileName, accountId: task.accountId
});
}
const override = this._accountOverrides.get(task.hoster); const override = this._accountOverrides.get(task.hoster);
if (!override) { if (!override) {
this._rotLog('rotation-end', { this._rotLog('rotation-end', {
@ -573,13 +556,6 @@ class UploadManager extends EventEmitter {
}); });
break; break;
} }
if (override.id === task.accountId) {
this._rotLog('rotation-end', {
hoster: task.hoster, fileName, reason: 'override-same-as-current',
lastFailedAccountId: task.accountId
});
break;
}
// Switch to fallback account and retry this file // Switch to fallback account and retry this file
this._rotLog('rotate', { this._rotLog('rotate', {
hoster: task.hoster, fileName, hoster: task.hoster, fileName,

View File

@ -1,6 +1,6 @@
{ {
"name": "multi-hoster-uploader", "name": "multi-hoster-uploader",
"version": "3.0.5", "version": "3.0.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": {