plugin: ship JFVR as a real Jellyfin plugin (self-hosted catalog)

Replaces the deploy.py approach (which sed-patched index.html inside the
container, and was therefore lost on every jellyfin/jellyfin upgrade) with a
proper plugin installable from a Jellyfin plugin repository.

The web bundle is unchanged: the same src/*.js -> dist/jfvr.js is now embedded
in Jellyfin.Plugin.JFVR.dll and served from /JFVR/jfvr.js with a content-hash
cache key. index.html is rewritten at request time by an IStartupFilter
middleware, so nothing on disk is touched.

Verified before this commit:
  - dotnet build: 0 warnings, 0 errors (net10.0, Jellyfin.Controller 12.1.0)
  - the DLL embeds dist/jfvr.js byte for byte
  - 19/19 checks on the rewrite logic (injection, idempotency, legacy-tag
    takeover, no </body> safety, other scripts preserved, URL override)
  - manifest.json passes Jellyfin's PackageInfo/VersionInfo expectations
  - the packaged zip's MD5 matches the checksum the manifest advertises

Details that were checked against the Jellyfin source rather than assumed:
  - a catalog version survives when targetAbi <= serverVersion, so a single
    targetAbi 12.0.0.0 package covers all of 12.x (server is 12.1.0)
  - Jellyfin writes meta.json itself at install time, so the zip needs only
    the DLL
  - Jellyfin verifies the MD5 at install time

Also adds pack.py (build -> package -> manifest -> Gitea release) and documents
the plugin route in README/HANDOFF, keeping deploy.py as a fallback.
This commit is contained in:
2026-10-17 23:17:00 +08:00
parent 0713f35513
commit f4fe3d61fc
15 changed files with 1256 additions and 9 deletions
@@ -0,0 +1,25 @@
using MediaBrowser.Model.Plugins;
namespace Jellyfin.Plugin.JFVR;
/// <summary>
/// JFVR plugin configuration. Persisted by Jellyfin as XML under
/// <c>&lt;config&gt;/plugins/configurations/Jellyfin.Plugin.JFVR.xml</c>, so it
/// survives container recreation and Jellyfin upgrades.
/// </summary>
public class PluginConfiguration : BasePluginConfiguration
{
/// <summary>
/// Gets or sets a value indicating whether the plugin rewrites the served
/// <c>index.html</c>. When disabled the response is passed through untouched
/// (the legacy injection, if any, is left alone too) but the bundle endpoint
/// stays reachable.
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// Gets or sets an optional URL used instead of the embedded bundle. Leave
/// empty to serve <c>../JFVR/jfvr.js?v=&lt;hash&gt;</c> from this plugin.
/// </summary>
public string ScriptUrlOverride { get; set; } = string.Empty;
}