refactor: Phase 1 code cleanup - constants, logging, and repository organization
This commit is contained in:
@@ -113,7 +113,14 @@ module.exports = function(ctx, helpers) {
|
||||
signal: AbortSignal.timeout(10000)
|
||||
});
|
||||
const profiles = profilesRes.ok ? await profilesRes.json() : [];
|
||||
const defaultProfile = profiles[0] || { id: 1, name: 'Any' };
|
||||
|
||||
// Use stored quality profile preference, fallback to first profile
|
||||
const radarrMeta = await ctx.credentialManager.getMetadata('arr.radarr.apikey');
|
||||
let defaultProfile = profiles[0] || { id: 1, name: 'Any' };
|
||||
if (radarrMeta?.qualityProfileId) {
|
||||
const stored = profiles.find(p => p.id === radarrMeta.qualityProfileId);
|
||||
if (stored) defaultProfile = stored;
|
||||
}
|
||||
|
||||
// Fetch root folders
|
||||
const rootFoldersRes = await ctx.fetchT(`${radarrUrl}/api/v3/rootfolder`, {
|
||||
@@ -173,7 +180,14 @@ module.exports = function(ctx, helpers) {
|
||||
signal: AbortSignal.timeout(10000)
|
||||
});
|
||||
const profiles = profilesRes.ok ? await profilesRes.json() : [];
|
||||
const defaultProfile = profiles[0] || { id: 1, name: 'Any' };
|
||||
|
||||
// Use stored quality profile preference, fallback to first profile
|
||||
const sonarrMeta = await ctx.credentialManager.getMetadata('arr.sonarr.apikey');
|
||||
let defaultProfile = profiles[0] || { id: 1, name: 'Any' };
|
||||
if (sonarrMeta?.qualityProfileId) {
|
||||
const stored = profiles.find(p => p.id === sonarrMeta.qualityProfileId);
|
||||
if (stored) defaultProfile = stored;
|
||||
}
|
||||
|
||||
const rootFoldersRes = await ctx.fetchT(`${sonarrUrl}/api/v3/rootfolder`, {
|
||||
headers: { 'X-Api-Key': connectedServices.sonarr.apiKey },
|
||||
|
||||
Reference in New Issue
Block a user