Compare commits
2 Commits
b7336eefb8
...
7a5278012b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a5278012b | ||
|
|
63f87a0310 |
@ -72,14 +72,20 @@ 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)\b/,
|
/\b(401|403|429)\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));
|
||||||
}
|
}
|
||||||
@ -524,23 +530,34 @@ class UploadManager extends EventEmitter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Account rotation: mark the current account failed, wait for main to
|
// Account rotation: mark the current account failed (if not already),
|
||||||
// resolve the next fallback, then retry. Loop so A → B → C → ... works
|
// wait for main to resolve the next fallback, then retry. Loops so
|
||||||
// for hosters with 3+ accounts (the old code only did one level: A → B
|
// A → B → C → ... works for hosters with 3+ accounts.
|
||||||
// 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 && !this._failedAccounts.has(task.hoster + ':' + task.accountId)) {
|
while (task.accountId) {
|
||||||
if (signal.aborted || this.stopAfterActive) break;
|
if (signal.aborted || this.stopAfterActive) break;
|
||||||
this._failedAccounts.set(task.hoster + ':' + task.accountId, true);
|
const alreadyMarked = this._failedAccounts.has(task.hoster + ':' + task.accountId);
|
||||||
this._rotLog('mark-failed', {
|
if (!alreadyMarked) {
|
||||||
hoster: task.hoster, fileName, accountId: task.accountId,
|
this._failedAccounts.set(task.hoster + ':' + task.accountId, true);
|
||||||
lastError: lastError ? lastError.message : null
|
this._rotLog('mark-failed', {
|
||||||
});
|
hoster: task.hoster, fileName, accountId: task.accountId,
|
||||||
this.emit('account-failed', { hoster: task.hoster, accountId: task.accountId });
|
lastError: lastError ? lastError.message : null
|
||||||
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', {
|
||||||
@ -556,6 +573,13 @@ 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,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "3.0.4",
|
"version": "3.0.5",
|
||||||
"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": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user