mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
fix(debrid): validate aiostreamsAuth during nzb check
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user