Files
jellyfin-herald/SUMMARY.md
T

50 lines
5.4 KiB
Markdown

# Summary
## What was built
`Jellyfin.Plugin.Herald`, a plugin for Jellyfin 10.11.x (built against 10.11.11, `net9.0`), started from `jellyfin/jellyfin-plugin-template`.
- **Notices**: data model with revisions and per-user acknowledgements, REST API under `/Herald` (pending notices and ack for users; CRUD, re-show and ack report for admins), an admin page in the dashboard, and a dependency-free client script that shows pending notices in jellyfin-web one at a time.
- **Client injection**: registered with the File Transformation plugin by reflection at startup; a warning is logged when that plugin is missing. Manual fallbacks are documented.
- **Watch-time stats**: playback start/progress/stop events are turned into daily per-user aggregates; `GET /Herald/Stats` and a sortable "Stats" tab show them; a daily scheduled task drops rows older than 90 days.
- **Storage**: one SQLite database in Jellyfin's data directory, using the `Microsoft.Data.Sqlite` that the server ships. Versioned migrations, serialized writes.
- **Project plumbing**: xUnit test project (58 tests), `build.yaml` for jprm, a Gitea Actions workflow (build, test, package; tags and releases automatically when the version changes), a sample `manifest.json`, `README.md`, `DECISIONS.md`.
## What was verified, and how
| Check | Result |
| --- | --- |
| `dotnet build -c Release` | Succeeds, 0 warnings, 0 errors (template analyzers kept, warnings as errors). |
| `dotnet test -c Release` | 58 passed. Covers watch-time deltas (pause, seek, gaps, stale sessions, midnight incl. a non-UTC zone), pending-notice selection (revision bump, targeting, disabled), ack validation, the SQLite stores incl. concurrent writes and migrations, and the index.html transformer. |
| `jprm plugin build` | Produces `artifacts/herald_1.0.0.0.zip` containing only `Jellyfin.Plugin.Herald.dll` and `meta.json`. `jprm repo add` accepted it and generated a manifest. |
| Docker, `jellyfin/jellyfin:10.11.11` + File Transformation 3.0.3.0 (its 10.11.11 build) | The zip from jprm was unpacked into `plugins/Herald_1.0.0.0/`. Log: `Loaded plugin: Herald 1.0.0.0`, `Registered the Herald client script with File Transformation 3.0.3.0`, scheduled task registered, no `[ERR]` lines. `/Plugins` reports both plugins as `Active`. |
| Injection | `GET /web/index.html` and `GET /web/` contain the `<script data-herald-client … src="../Herald/client.js">` tag; script chunks are untouched. |
| Without File Transformation | Plugin still loads, the warning is logged, `index.html` is unchanged, `/Herald/client.js` still answers. |
| API (curl, admin and non-admin token) | Create/read/update/delete/re-show, pending, ack, ack report and stats all answer as documented; non-admin gets `403` on admin routes, anonymous gets `401`; dismissing a must-accept notice gives `400`, an outdated revision `409`, a notice not addressed to the caller `404`. |
| Config page (headless Chromium) | Page opens under Dashboard → Plugins → Herald; list, create form with user picker, edit prefill, enable toggle, responses view, re-show with confirmation, and the Stats tab with sorting all work; no console errors. |
| Popup (headless Chromium, logged in as a normal user) | Must-accept notice shows only "Accept", Escape and outside click do nothing; next notice shows "Close" and Escape dismisses it; one `Pending` request after login and none on navigation; HTML and `javascript:` links in a notice are rendered as text. |
| Stats end to end | A playback was reported through `/Sessions/Playing*` for a generated test video: 5 s + 5 s playing, 6 s paused, 4 s + 3 s playing with a seek in between. Stored: 17.15 s, 1 play. |
Two bugs were found and fixed through the container test: the transformer touched a JavaScript chunk that File Transformation also matches against the `index.html` pattern, which broke the login page, and jellyfin-web's `document.createElement` shim rejected the element-options form used by the admin page.
## Known gaps
- Notices only appear in clients built on jellyfin-web. Native clients are not covered and cannot be from a plugin.
- The popup was tested in Chromium against the default dark theme and NeutralFin, at desktop and phone size. The TV layout and real mobile wrappers were not tried.
- The JavaScript Injector fallback and the manual `index.html` edit are documented but were not run.
- File Transformation was tested in version 3.0.3.0 only, alone and together with MediaBar 3.0.2.0 and Jellyfin Enhanced 12.15.0.0. Its registration API is found by reflection, so a rename on their side turns into the logged warning, not a crash.
- Stats were verified with simulated reports, not with a real player. The systematic inaccuracies are listed in the README.
- The UI is English only.
- Must-accept is a record of consent, not an access gate: nothing on the server is blocked for users who have not accepted.
## Environment notes
- No .NET SDK was installed, so the .NET 9 SDK (9.0.321) was installed with Microsoft's `dotnet-install.sh` into `~/.dotnet`. Use `export PATH=$HOME/.dotnet:$PATH DOTNET_ROOT=$HOME/.dotnet` to build, or remove that folder if you prefer a system package.
- The Docker image `jellyfin/jellyfin:10.11.11` was pulled and is still present; the test container was removed.
- `TASK.md` is left untracked.
## Next steps
- Try the popup on the themes and devices your users actually have.
- Optional: start/end dates for notices, a history of earlier rounds in the responses view, translations.