feat: Recently Completed downloads history, tab UI, and light theme refresh #7

Merged
Gandalf merged 19 commits from develop into main 2026-05-17 13:55:08 +01:00
Owner
## Summary

Merges the `develop` branch into `main`, delivering the "Recently Completed" feature (#6) plus several UI and infrastructure improvements.

## Changes

### Feature: Recently Completed History
- New [`GET /api/history/recent`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/server/routes/history.js) endpoint — returns Sonarr/Radarr history filtered to the last N days, scoped to the authenticated user's tag
- New [`historyFetcher`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/server/utils/historyFetcher.js) utility — dedicated fetcher with 5-minute cache, event classification (`imported`/`failed`), and multi-instance support
- `RECENT_COMPLETED_DAYS` env var (default 7, max 90), overridable per-request via `?days=N`
- Admin `?showAll=true` returns all tagged items with per-tag Emby user classification (matched/unmatched badges) — consistent with active downloads behaviour
- Failed imports surfaced with distinct styling; `failureMessage` exposed to admins only

### UI: Tab layout
- Active Downloads and Recently Completed split into two tabs
- Tab selection persisted in `localStorage`
- History loads lazily on first tab activation; background refresh continues regardless of active tab
- Show All toggle reloads both tabs immediately

### Design: Light theme refresh
- Replaced purple/violet background with a clean off-white/blue-grey page background derived from the logo palette
- Accent, series, and interactive colours aligned to the teal/steel blue tones in the logo
- All text/background combinations verified WCAG AA compliant (≥ 4.5:1); previously failing colours (`--text-muted`, `--footer-text`, unmatched tag) corrected
- Dark and Mono themes unchanged

### Infrastructure & quality
- Unit and integration tests added for the history endpoint and fetcher — 141 tests passing ([`tests/unit/historyFetcher.test.js`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/tests/unit/historyFetcher.test.js), [`tests/integration/history.test.js`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/tests/integration/history.test.js))
- [ARCHITECTURE.md](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/docs/ARCHITECTURE.md) updated: directory structure, route table, cache keys, env vars, API reference, component diagram; Mermaid diagrams replace ASCII art
- [`README.md`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/README.md) updated with feature description and `RECENT_COMPLETED_DAYS` config entry
- Legacy `.env.example` removed (superseded by [.env.sample](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/.env.sample)

## Closes

Closes #6
```markdown ## Summary Merges the `develop` branch into `main`, delivering the "Recently Completed" feature (#6) plus several UI and infrastructure improvements. ## Changes ### Feature: Recently Completed History - New [`GET /api/history/recent`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/server/routes/history.js) endpoint — returns Sonarr/Radarr history filtered to the last N days, scoped to the authenticated user's tag - New [`historyFetcher`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/server/utils/historyFetcher.js) utility — dedicated fetcher with 5-minute cache, event classification (`imported`/`failed`), and multi-instance support - `RECENT_COMPLETED_DAYS` env var (default 7, max 90), overridable per-request via `?days=N` - Admin `?showAll=true` returns all tagged items with per-tag Emby user classification (matched/unmatched badges) — consistent with active downloads behaviour - Failed imports surfaced with distinct styling; `failureMessage` exposed to admins only ### UI: Tab layout - Active Downloads and Recently Completed split into two tabs - Tab selection persisted in `localStorage` - History loads lazily on first tab activation; background refresh continues regardless of active tab - Show All toggle reloads both tabs immediately ### Design: Light theme refresh - Replaced purple/violet background with a clean off-white/blue-grey page background derived from the logo palette - Accent, series, and interactive colours aligned to the teal/steel blue tones in the logo - All text/background combinations verified WCAG AA compliant (≥ 4.5:1); previously failing colours (`--text-muted`, `--footer-text`, unmatched tag) corrected - Dark and Mono themes unchanged ### Infrastructure & quality - Unit and integration tests added for the history endpoint and fetcher — 141 tests passing ([`tests/unit/historyFetcher.test.js`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/tests/unit/historyFetcher.test.js), [`tests/integration/history.test.js`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/tests/integration/history.test.js)) - [ARCHITECTURE.md](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/docs/ARCHITECTURE.md) updated: directory structure, route table, cache keys, env vars, API reference, component diagram; Mermaid diagrams replace ASCII art - [`README.md`](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/README.md) updated with feature description and `RECENT_COMPLETED_DAYS` config entry - Legacy `.env.example` removed (superseded by [.env.sample](https://git.i3omb.com/Gandalf/sofarr/src/branch/develop/.env.sample) ## Closes Closes #6 ```
Gandalf added the Kind/Feature label 2026-05-17 13:36:18 +01:00
Gandalf added 18 commits 2026-05-17 13:36:19 +01:00
docs(diagrams): review + fix all .puml files; touch all to trigger render
Some checks failed
Build and Push Docker Image / build (push) Successful in 31s
CI / Security audit (push) Successful in 51s
CI / Tests & coverage (push) Successful in 1m6s
Render PlantUML Diagrams / Render .puml → .png (push) Failing after 47s
9751dbf98d
seq-auth:
- startAutoRefresh() -> startSSE(), stopAutoRefresh() -> stopSSE()
- Cookie secure flag: 'secure (prod)' -> 'secure (if TRUST_PROXY)'

component:
- Fix typo creatApp -> createApp
- Add GET /csrf, POST /logout to browser->auth arrow
- Add GET /stream (SSE) to browser->dashboard arrow

class-server:
- Add subscribers Set, onPollComplete(), offPollComplete() to Poller class

class-data:
- Add SSE Event /stream shape alongside API Response /user-downloads
- Add sser *-- dl relationship

state-ui:
- Fix invalid multi-line transition labels with raw Unicode arrows
  (broke PlantUML parser); replace with valid \n escapes on single line

seq-dashboard, seq-polling, state-poller, activity-matching:
- Whitespace touch to trigger render-diagrams CI workflow
fix(diagrams): replace par/and/end with group in seq-polling
Some checks failed
Build and Push Docker Image / build (push) Successful in 22s
CI / Security audit (push) Successful in 1m4s
CI / Tests & coverage (push) Has been cancelled
Render PlantUML Diagrams / Render .puml → .png (push) Successful in 1m2s
a05aaf8d71
par keyword is not supported in the PlantUML version on the Gitea runner.
Replace with a group block (universally supported) and a spanning note
to convey the parallelism.
docs: migrate all diagrams from PlantUML to Mermaid
All checks were successful
Build and Push Docker Image / build (push) Successful in 38s
CI / Security audit (push) Successful in 52s
CI / Tests & coverage (push) Successful in 1m0s
CI / Security audit (pull_request) Successful in 48s
CI / Tests & coverage (pull_request) Successful in 57s
224ec33a14
- Replace section 13 of ARCHITECTURE.md with 9 inline Mermaid diagrams
  (component, auth sequence, dashboard SSE sequence, polling sequence,
  server class, data model, UI state, poller state, matching flowchart)
- Diagrams render natively in Gitea/GitHub — no CI job required
- Delete docs/diagrams/*.puml (all 9 files)
- Delete .gitea/workflows/render-diagrams.yml
- Update CI/CD table note and ToC entry
feat: native HTTPS support with bundled snakeoil default cert
All checks were successful
Build and Push Docker Image / build (push) Successful in 32s
CI / Security audit (push) Successful in 48s
CI / Tests & coverage (push) Successful in 56s
da0898f52a
server/index.js:
- Import http and https modules
- Resolve TLS_ENABLED early (before Helmet) so upgradeInsecureRequests
  CSP directive fires when TLS is active directly (not only via proxy)
- loadTlsCredentials() reads TLS_CERT/TLS_KEY (defaulting to bundled
  snakeoil) and returns null on failure (graceful HTTP fallback)
- Start https.createServer or http.createServer depending on credentials
- Startup banner now shows protocol, TLS cert path, and snakeoil warning

certs/:
- Add bundled snakeoil self-signed certificate (RSA 2048, 10yr, SAN for
  localhost + 127.0.0.1) for out-of-the-box HTTPS without configuration
- .gitignore allows only snakeoil.{crt,key} — real certs must not be
  committed

Dockerfile:
- COPY certs/ into image so snakeoil default is always available
- HEALTHCHECK updated to https:// with --no-check-certificate

docker-compose.yaml:
- Port now exposes HTTPS directly by default
- TLS_CERT/TLS_KEY/TLS_ENABLED/TRUST_PROXY documented with Option A/B
- cert volume mount examples added (commented out)
- healthcheck updated to https with --no-check-certificate

.env.sample:
- New TLS/HTTPS section with TLS_ENABLED, TLS_CERT, TLS_KEY
- openssl self-signed cert generation example included

docs/ARCHITECTURE.md:
- Configuration table: TLS_ENABLED, TLS_CERT, TLS_KEY env vars added
- Docker image section: TLS default behaviour documented
- Docker Compose example: Option A (direct TLS) / Option B (proxy) layout
- Security checklist: HTTPS now first item, updated for TLS modes
ci: add v2-develop branch to build pipeline (tags as sofarr:v2-develop)
All checks were successful
Build and Push Docker Image / build (push) Successful in 22s
CI / Security audit (push) Successful in 38s
CI / Tests & coverage (push) Successful in 39s
71880c6298
design(light-theme): replace purple scheme with logo-aligned teal palette, WCAG AA compliant
All checks were successful
Build and Push Docker Image / build (push) Successful in 21s
CI / Security audit (push) Successful in 39s
CI / Tests & coverage (push) Successful in 42s
2b089871a0
ci: remove v2-develop branch from build pipeline
All checks were successful
Build and Push Docker Image / build (push) Successful in 20s
CI / Security audit (push) Successful in 37s
CI / Tests & coverage (push) Successful in 41s
CI / Security audit (pull_request) Successful in 34s
CI / Tests & coverage (pull_request) Successful in 39s
742f34f6eb
Gandalf closed this pull request 2026-05-17 13:39:18 +01:00
Gandalf reopened this pull request 2026-05-17 13:40:57 +01:00
Gandalf added 1 commit 2026-05-17 13:50:22 +01:00
merge: resolve ARCHITECTURE.md conflict, keep develop version (Mermaid + history docs)
All checks were successful
CI / Security audit (pull_request) Successful in 44s
CI / Tests & coverage (pull_request) Successful in 47s
Build and Push Docker Image / build (push) Successful in 24s
CI / Security audit (push) Successful in 43s
CI / Tests & coverage (push) Successful in 45s
c1fb55c5b8
Gandalf merged commit 80d43fbaa8 into main 2026-05-17 13:55:08 +01:00
Sign in to join this conversation.