fix(debrid): validate aiostreamsAuth during nzb check

This commit is contained in:
Viren070
2025-11-10 16:16:28 +00:00
parent 8184442cce
commit 8f29d017ba
3 changed files with 18 additions and 0 deletions
+1
View File
@@ -39,6 +39,7 @@ export class AltmountService extends UsenetStreamService {
webdavPassword: parsedConfig.webdavPassword,
apiUrl: `${parsedConfig.altmountUrl}/sabnzbd/api`,
apiKey: parsedConfig.altmountApiKey,
aiostreamsAuth: parsedConfig.aiostreamsAuth,
};
super(config, auth, 'altmount');
+1
View File
@@ -41,6 +41,7 @@ export class NzbDAVService extends UsenetStreamService {
webdavPassword: parsedConfig.webdavPassword,
apiUrl: `${parsedConfig.nzbdavUrl}/api`,
apiKey: parsedConfig.nzbdavApiKey,
aiostreamsAuth: parsedConfig.aiostreamsAuth,
};
super(config, auth, 'nzbdav');
@@ -387,6 +387,7 @@ export interface UsenetStreamServiceConfig {
webdavPassword: string;
apiUrl: string;
apiKey: string;
aiostreamsAuth?: string;
}
/**
@@ -566,6 +567,21 @@ export abstract class UsenetStreamService implements DebridService {
}
public async checkNzbs(hashes: string[]): Promise<DebridDownload[]> {
// if aiostreamsAuth is present, validate it.
if (this.auth.aiostreamsAuth) {
try {
BuiltinProxy.validateAuth(this.auth.aiostreamsAuth);
} catch (error) {
throw new DebridError('Invalid AIOStreams Proxy Auth', {
statusCode: 401,
statusText: 'Unauthorized',
code: 'UNAUTHORIZED',
headers: {},
body: null,
type: 'api_error',
});
}
}
// All NZBs are "cached" since it's streaming-based
return hashes.map((h, index) => ({
id: index,