Add Approve/Deny verdicts to pending requests on P104
All checks were successful
Deploy / deploy (push) Successful in 55s

Every TV request now needs a decision, so P104 offers the two verdicts
inline on the rows actually waiting rather than sending the visitor to
Ombi's own UI.

Ombi is now the one service the app writes to. Three details the new
ombi_write() helper and /api/ombi/decide route have to get right:
approve is a POST but deny is a PUT; a TV decision acts on the child
request id, not the show, so get_ombi_summary() carries child["id"] for
TV rows and m["id"] for movies; and Ombi answers 200 with
{"result": false, ...} on a logical refusal, so the body is checked
rather than the status code. A successful decision clears _ombi_cache —
the 4-hour TTL would otherwise keep calling the row pending for the
rest of the afternoon.

The buttons reuse the existing two-tap arming and share its armed slot,
so arming one disarms the other: an approval starts a download and a
denial is somebody's answer, neither wants a stray tap. They reverse
into green and red rather than the shared red of .tt-btn.armed, so the
confirming press states which verdict it is about to send. After a
decision the row's status flips in place and the Pending figure and its
"N of M" both settle; at zero the page drops its warn weight, since
nothing waits on a human any more (discipline 5). Below 560px the
verdicts take a full line of their own rather than shrinking below the
tap target.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YNc3gd3GRPudFwgPXNEm8A
This commit is contained in:
Barely Removable 2026-09-02 09:05:53 -07:00
parent 8115ed4855
commit d38ab1b561
5 changed files with 208 additions and 7 deletions

View file

@ -35,6 +35,18 @@ the user's Unraid home server. Server-side project directory is still named
SABnzbd history 10 min, Ombi requests 4 hours, Rotten Tomatoes scrapes
4 hours. Active streams (Tautulli) and the SABnzbd queue are always
fetched live, never cached — those need to be current-second accurate.
- Ombi is the one service the app **writes** to: P104's Approve/Deny
buttons post to `/api/ombi/decide`, which fans out to Ombi's four
write endpoints via `ombi_write()`. Three things there are easy to
get wrong: approve is a `POST` but deny is a `PUT`; a TV decision
acts on the **child request** id, not the show, which is why
`get_ombi_summary()` carries `child["id"]` for a TV row and
`m["id"]` for a movie; and Ombi answers `200` with
`{"result": false, "errorMessage": ...}` on a logical refusal
("already approved"), so `ombi_write()` checks the body rather than
trusting the status code. A successful decision clears
`_ombi_cache` — the 4-hour TTL would otherwise keep calling the row
pending for the rest of the afternoon.
- Rotten Tomatoes / IMDB are scraped directly (`requests` +
`BeautifulSoup`, JSON-LD parsing), not via an official API — brittle
to upstream HTML changes by nature.