From 19f08e62938f0e817f66f7f396bd6847692933d3 Mon Sep 17 00:00:00 2001 From: ponzischeme89 Date: Fri, 14 Aug 2026 10:30:25 +1200 Subject: [PATCH] Fix Sonarr TV request policy and bump gateway to 0.1.40 --- CHANGELOG.md | 3 + admin-ui/src/api/types.ts | 15 +++ admin-ui/src/pages/Integrations.tsx | 55 +++++++++- admin-ui/src/pages/Requests.tsx | 2 +- server/internal/api/admin.go | 2 + server/internal/api/admin_sonarr_requests.go | 110 +++++++++++++++++++ server/internal/api/requests.go | 89 ++++++++++++++- server/internal/buildinfo/VERSION | 2 +- server/internal/sonarr/client.go | 51 ++++++--- server/internal/sonarr/client_test.go | 12 +- server/internal/store/settings.go | 54 +++++++++ 11 files changed, 366 insertions(+), 29 deletions(-) create mode 100644 server/internal/api/admin_sonarr_requests.go diff --git a/CHANGELOG.md b/CHANGELOG.md index aeb030b..c4b55fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.1.40 — 2026-08-14 +- Fixed: TV requests use Memby's safe Sonarr request policy: a selected 720p profile, normal monitoring and no immediate backlog search unless an operator enables it. + ## 0.2.62 — 2026-08-13 - Fixed: Playback is back to the way it worked in 0.2.60. The groundwork for Memby playing video itself caused problems, so it has been withdrawn and will return once it is ready. diff --git a/admin-ui/src/api/types.ts b/admin-ui/src/api/types.ts index 63a5e7f..d3de647 100644 --- a/admin-ui/src/api/types.ts +++ b/admin-ui/src/api/types.ts @@ -377,6 +377,21 @@ export interface IntegrationsResponse { dropped: number; } +export interface SonarrProfileOption { + id: number; + name: string; + recommended: boolean; +} + +export interface SonarrRequestPolicy { + qualityProfileId: number; + searchImmediately: boolean; + profiles: SonarrProfileOption[]; + recommendedId: number; + configured: boolean; + error?: string; +} + /* ---------- logs ---------- */ export interface LogEvent { diff --git a/admin-ui/src/pages/Integrations.tsx b/admin-ui/src/pages/Integrations.tsx index 77805ca..7c4d2d6 100644 --- a/admin-ui/src/pages/Integrations.tsx +++ b/admin-ui/src/pages/Integrations.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { api } from '../api/client'; import { useAction, useQuery } from '../lib/hooks'; import { useToast } from '../lib/toast'; @@ -18,7 +18,7 @@ import { Tag, Toggle, } from '../components/ui'; -import type { Integration, IntegrationEventOption, IntegrationsResponse } from '../api/types'; +import type { Integration, IntegrationEventOption, IntegrationsResponse, SonarrRequestPolicy } from '../api/types'; /* Integrations: administrative events going out to somewhere else. * @@ -111,6 +111,8 @@ export function IntegrationsPage() { + + {(data?.dropped ?? 0) > 0 ? ( {num(data?.dropped ?? 0)} events could not be queued for delivery. The queue is deliberately @@ -168,6 +170,55 @@ export function IntegrationsPage() { ); } +function SonarrRequestCard() { + const { wrap } = useToast(); + const { busy, run } = useAction(); + const { data, error, loading, reload } = useQuery('/admin/api/sonarr-request-policy'); + const [profileId, setProfileId] = useState(0); + const [searchImmediately, setSearchImmediately] = useState(false); + useEffect(() => { + if (data) { + setProfileId(data.qualityProfileId); + setSearchImmediately(data.searchImmediately); + } + }, [data]); + const save = () => run('sonarr-request-policy', async () => { + await wrap( + () => api.post('/admin/api/sonarr-request-policy', { qualityProfileId: profileId, searchImmediately }), + 'Sonarr TV request policy saved.', + ); + await reload(); + }); + const selected = data?.profiles.find((profile) => profile.id === profileId); + + return ( + configured : needs attention} + footer={} + > + + {loading ? : ( + <> +
+ + + +
+ + {selected ? Requested series will use {selected.name} (profile ID {selected.id}), be monitored using Memby’s existing all-episodes strategy, and {searchImmediately ? 'start an immediate search.' : 'not start an immediate search.'} : null} + + )} +
+ ); +} + function IntegrationCard({ integration, catalogue, diff --git a/admin-ui/src/pages/Requests.tsx b/admin-ui/src/pages/Requests.tsx index 5ea086b..1ba43d8 100644 --- a/admin-ui/src/pages/Requests.tsx +++ b/admin-ui/src/pages/Requests.tsx @@ -33,7 +33,7 @@ export function RequestsPage() { <>