mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
fix: simplify and fix configuration generation for services and providers in TorrentioPreset
This commit is contained in:
@@ -286,19 +286,24 @@ export class TorrentioPreset extends Preset {
|
||||
providers = TorrentioPreset.defaultProviders;
|
||||
}
|
||||
|
||||
const configString = services.length
|
||||
? this.urlEncodeKeyValuePairs([
|
||||
...services.map((service) => [
|
||||
service,
|
||||
this.getServiceCredential(service, userData, {
|
||||
[constants.PUTIO_SERVICE]: (credentials: any) =>
|
||||
`${credentials.clientId}@${credentials.token}`,
|
||||
}),
|
||||
]),
|
||||
['providers', providers.join(',')],
|
||||
])
|
||||
: '';
|
||||
let config: string[][] = [];
|
||||
|
||||
// add services to config
|
||||
if (services.length) {
|
||||
// generate a [serviceId, credential] array for each service and push it to config
|
||||
config = services.map((service) => [
|
||||
service,
|
||||
this.getServiceCredential(service, userData, {
|
||||
[constants.PUTIO_SERVICE]: (credentials: any) =>
|
||||
`${credentials.clientId}@${credentials.token}`,
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
// add providers to config
|
||||
config.push(['providers', providers.join(',')]);
|
||||
|
||||
const configString = this.urlEncodeKeyValuePairs(config);
|
||||
return `${url}${configString ? '/' + configString : ''}/manifest.json`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user