Files
jellyfin-herald/DECISIONS.md
T
JoshiCodes 28b6244a17
Build / build (push) Successful in 1m50s
ci: serve the plugin repository from manifest.json on main
The install URL is now the raw manifest in the source tree. The workflow
adds each release to it and commits it back.
2026-11-13 22:37:04 +01:00

7.4 KiB

Decisions

One line per decision, with the reason.

Target and build

  • Target Jellyfin 10.11.11 (Jellyfin.Controller / Jellyfin.Model 10.11.11, net9.0): it is the last 10.11 release on NuGet; the nuspec of that package lists net9.0 as its only framework. Versions live in Directory.Build.props.
  • targetAbi is 10.11.0.0: the plugin only uses APIs that exist across 10.11, so it should not be pinned to the patch release it was compiled against.
  • Removed the template's .github workflows and Renovate preset: they call reusable workflows and secrets of the Jellyfin organisation and cannot run elsewhere. Replaced by one self-contained workflow for Gitea Actions in .gitea/workflows; it talks to the Gitea API with curl, so it needs no forge-specific CLI on the runner.
  • Releases are driven by the version, not by hand-made tags: a push to main whose build.yaml version has no v<version> tag is tagged and released by the workflow. The plugin repository is manifest.json in the source tree, installed through its raw link on main; the workflow adds each release to it and commits the file back ([skip ci]), so the install URL does not depend on a release asset.
  • Removed the template's .vscode folder: it assumes a local checkout of the Jellyfin server and web client next to the repo.
  • No analyzer warnings are suppressed project-wide. The only suppressions are three CA2100 pragmas in Storage/ where a command text is assigned from a constant string, which the analyzer cannot see through a helper.
  • The test project does not reference the StyleCop/AllEnabledByDefault analyzer set: XML docs and naming rules on test methods add noise without value. It still builds with warnings as errors.

Storage

  • SQLite via Microsoft.Data.Sqlite, not JSON files. Jellyfin 10.11.11 ships Microsoft.Data.Sqlite 9.0.11 itself; the plugin references exactly that version with ExcludeAssets="runtime;native", so no SQLite DLL (managed or native) ends up in the plugin folder and the host's copy is used. Verified in the 10.11.11 container: the plugin zip contains only Jellyfin.Plugin.Herald.dll, and the database is created and migrated on first use.
  • Database path is <data dir>/herald/herald.db (IApplicationPaths.DataPath), not BasePlugin.DataFolderPath: the latter resolves to a folder inside plugins/ whose name can include the plugin version, so data would be left behind on every update.
  • Writes go through one lock and one transaction each; the file runs in WAL mode so reads are not blocked. Schema changes are numbered scripts tracked in PRAGMA user_version.
  • A database newer than the plugin (downgrade) fails loudly instead of being opened.

Notices

  • Target is an object { AllUsers, UserIds }: clearer than "empty list means everyone", which would turn a notice for one deleted user into a notice for all.
  • Editing a notice does not show it again. Only "Re-show to everyone" bumps Revision: fixing a typo should not interrupt everybody.
  • The first response of a user to a revision is kept; later ones for the same revision are ignored. This keeps the record of what the user actually did.
  • Ack with an outdated revision returns 409, for a missing, disabled or not-addressed notice 404, and Dismissed on a must-accept notice 400.
  • The acknowledgement report covers the current revision only. Older rounds stay in the database but are not exposed; nobody asked for history.
  • The pending-users list in the report only contains users that still exist. Responses of deleted users are kept and shown without a name.
  • GET /Herald/Notices/Pending with an API key (no user) returns an empty list rather than an error.
  • Body format is the Markdown subset from the task (bold, italic, links, lists) rendered in the browser with DOM nodes; the server stores the text as typed. Links are limited to http, https and mailto.
  • Notice titles and ids are logged. Bodies and user names are not.

Client injection

  • Registration with File Transformation is done purely by reflection, including building the payload: the JObject is created by calling Parse on the parameter type of RegisterTransformation, so the plugin has no Newtonsoft reference of its own.
  • The file pattern is the literal index.html, the same string every other plugin registers. File Transformation groups callbacks by pattern string and, for a request, runs only the group whose key equals the requested path; a regex fallback is used only when no key matches exactly. The earlier anchored ^index\.html$ was therefore never called once MediaBar (or any plugin using index.html) was installed. Found by reproducing a server with MediaBar and Jellyfin Enhanced.
  • As a regular expression index.html also matches script chunks such as session-login-index-html.<hash>.chunk.js, so those are handed to the callback too. The transformer returns anything that is not an HTML page (<html and </body> present) unchanged.
  • The script tag uses the relative URL ../Herald/client.js so it keeps working behind a base URL.
  • GET /Herald/client.js is anonymous: a <script> tag cannot send Jellyfin's auth header, and the file holds nothing secret.
  • Jellyfin 10.11 has no "Custom HTML" setting (branding only offers custom CSS, a login disclaimer and the splash screen; checked against BrandingOptions). The documented manual fallbacks are therefore the JavaScript Injector plugin and editing index.html.
  • Login and user switches are detected by comparing ApiClient.getCurrentUserId() on a 3 s local timer. That costs no request; the server is only asked after a change of user and then at most every 10 minutes. jellyfin-web's own login events are not reachable from an injected script in a stable way.
  • The modal reuses jellyfin-web's dialog, raised, button-submit and emby-button classes so the active theme colours it; own CSS only handles layout.

Admin UI

  • The config page is flagged EnableInMainMenu, so it has its own entry in the dashboard sidebar under "Plugins". Jellyfin 10.11 draws a fixed icon there; MenuIcon is set for versions that honour it.

Watch-time stats

  • Time is measured on the server clock between two reports of the same playback, not from playback positions: a seek changes the position by minutes without anyone watching, and position deltas also break with playback speed.
  • Each delta is capped at 60 s; a playback without a report for 5 minutes counts as closed and the gap adds nothing.
  • Progress events flagged IsAutomated are ignored. The server generates those itself on a timer while a client is silent, so they say nothing about someone still watching.
  • A playback is keyed by session id plus item id. Switching items without a stop report simply lets the old entry time out.
  • PlayCount counts playback start events. A progress report for an unknown playback (server restarted mid-film) is tracked but not counted as a play.
  • A delta that crosses local midnight is split between both days.
  • Stats for deleted users stay until they age out and are returned with UserName: null.
  • GET /Herald/Stats returns WatchedSeconds next to the requested hours: rounded hours are useless for short sessions.
  • No chart. A hairline under the 30-day value shows each user's share of the busiest user's time; that is all the table needs.
  • The cleanup task is discovered by Jellyfin as an IScheduledTask (daily at 03:30) and is not registered in DI, which is how Jellyfin 10.11 finds tasks.