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.
67 lines
2.2 KiB
C#
67 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Jellyfin.Plugin.JFVR.Services;
|
|
using MediaBrowser.Common.Configuration;
|
|
using MediaBrowser.Common.Plugins;
|
|
using MediaBrowser.Model.Plugins;
|
|
using MediaBrowser.Model.Serialization;
|
|
|
|
namespace Jellyfin.Plugin.JFVR;
|
|
|
|
/// <summary>
|
|
/// The JFVR plugin. Owns the identity (GUID + version) that the Jellyfin plugin
|
|
/// catalog matches on, and serves the embedded web bundle.
|
|
/// </summary>
|
|
public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="Plugin"/> class.
|
|
/// </summary>
|
|
/// <param name="applicationPaths">Jellyfin application paths.</param>
|
|
/// <param name="xmlSerializer">XML serializer for the configuration.</param>
|
|
/// <param name="bundle">Embedded web bundle.</param>
|
|
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, BundleProvider bundle)
|
|
: base(applicationPaths, xmlSerializer)
|
|
{
|
|
Instance = this;
|
|
Bundle = bundle;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the current plugin instance. Set by the DI container at startup;
|
|
/// the injection middleware reads the configuration through it.
|
|
/// </summary>
|
|
public static Plugin? Instance { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets the embedded web bundle.
|
|
/// </summary>
|
|
public BundleProvider Bundle { get; }
|
|
|
|
/// <inheritdoc />
|
|
public override string Name => "Jellyfin Web VR";
|
|
|
|
/// <inheritdoc />
|
|
public override Guid Id => Guid.Parse("7d33ef59-f9b0-412b-93bd-5cd5353018de");
|
|
|
|
/// <inheritdoc />
|
|
public override string Description =>
|
|
"Injects a VR play button into Jellyfin Web so Meta Quest 3 can play VR180/VR360 in WebXR.";
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<PluginPageInfo> GetPages()
|
|
{
|
|
return new[]
|
|
{
|
|
new PluginPageInfo
|
|
{
|
|
Name = "JFVR",
|
|
DisplayName = "Jellyfin Web VR",
|
|
EmbeddedResourcePath = GetType().Namespace + ".Configuration.configPage.html",
|
|
EnableInMainMenu = true,
|
|
MenuIcon = "view_in_ar"
|
|
}
|
|
};
|
|
}
|
|
}
|