return specific error video for blocked AD access
Some checks are pending
Deploy Addon / build (SSH_HOST_2, SSH_KEY_2) (push) Waiting to run
Deploy Addon / build (SSH_HOST_3, SSH_KEY_3) (push) Waiting to run
Deploy Addon / build (SSH_HOST_4, SSH_KEY_4) (push) Waiting to run

This commit is contained in:
TheBeastLT 2024-11-26 12:18:09 +02:00
parent 6779fca502
commit 694bc56029
2 changed files with 13 additions and 4 deletions

View file

@ -65,10 +65,15 @@ export async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex
return _resolve(AD, infoHash, cachedEntryInfo, fileIndex)
.catch(error => {
if (errorExpiredSubscriptionError(error)) {
if (isExpiredSubscriptionError(error)) {
console.log(`Access denied to AllDebrid ${infoHash} [${fileIndex}]`);
return StaticResponse.FAILED_ACCESS;
} else if (error.code === 'MAGNET_TOO_MANY') {
}
if (isBlockedAccessError(error)) {
console.log(`Access blocked to AllDebrid ${infoHash} [${fileIndex}]`);
return StaticResponse.BLOCKED_ACCESS;
}
if (error.code === 'MAGNET_TOO_MANY') {
console.log(`Deleting and retrying adding to AllDebrid ${infoHash} [${fileIndex}]...`);
return _deleteAndRetry(AD, infoHash, cachedEntryInfo, fileIndex);
}
@ -177,7 +182,11 @@ function statusReady(statusCode) {
return statusCode === 4;
}
function errorExpiredSubscriptionError(error) {
return ['AUTH_BAD_APIKEY', 'AUTH_BLOCKED', 'MUST_BE_PREMIUM', 'MAGNET_MUST_BE_PREMIUM', 'FREE_TRIAL_LIMIT_REACHED', 'AUTH_USER_BANNED']
function isExpiredSubscriptionError(error) {
return ['AUTH_BAD_APIKEY', 'MUST_BE_PREMIUM', 'MAGNET_MUST_BE_PREMIUM', 'FREE_TRIAL_LIMIT_REACHED', 'AUTH_USER_BANNED']
.includes(error.code);
}
function isBlockedAccessError(error) {
return ['AUTH_BLOCKED'].includes(error.code);
}

Binary file not shown.