Files
jellyfin-plugin-floatplane/Jellyfin.Plugin.Floatplane/PluginServiceRegistrator.cs
claude 9e33a343ab
Some checks failed
release / build-release (push) Has been cancelled
Floatplane channel plugin for Jellyfin 10.10.x: browse, HLS proxy, cookie session, CI release
- IChannel: creators -> sub-channels -> video posts (public listing API, search mapped)
- IRequiresMediaInfoCallback -> signed proxy URLs; stream controller rewrites HLS so the
  AES-128 key is fetched server-side with the session cookie, segments stay on the CDN
- delivery/info cached per token lifetime and throttled (~2/min)
- config page: paste sails.sid + validate, extra creators, quality, search test
- scripts/package.sh -> plugin folder + zip + md5 + manifest.json; Gitea release workflow
- research docs, HAR analysis (HAR itself gitignored), install-pi5.sh

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 09:42:27 +01:00

51 lines
2.1 KiB
C#

using System;
using System.Net.Http;
using Jellyfin.Plugin.Floatplane.Api;
using Jellyfin.Plugin.Floatplane.Channel;
using Jellyfin.Plugin.Floatplane.Playback;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Plugins;
using Microsoft.Extensions.DependencyInjection;
namespace Jellyfin.Plugin.Floatplane;
/// <summary>
/// Registers the plugin's services. Found by Jellyfin through type scanning; needs a
/// parameterless constructor. In 10.10 <c>ChannelManager</c> takes <c>IEnumerable&lt;IChannel&gt;</c>
/// from DI, so the channel must be registered here.
/// </summary>
public class PluginServiceRegistrator : IPluginServiceRegistrator
{
/// <summary>Named HttpClient for Floatplane API + CDN traffic.</summary>
public const string HttpClientName = "Floatplane";
/// <inheritdoc />
public void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost)
{
serviceCollection
.AddHttpClient(HttpClientName, client =>
{
client.Timeout = TimeSpan.FromSeconds(60);
client.DefaultRequestHeaders.UserAgent.ParseAdd(Plugin.UserAgent);
})
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
// The session cookie is attached per request; no cookie jar, no redirects
// (a 302 from the CDN would otherwise be followed with the cookie attached).
UseCookies = false,
AllowAutoRedirect = false,
AutomaticDecompression = System.Net.DecompressionMethods.All
});
serviceCollection.AddSingleton<FloatplaneApiClient>();
serviceCollection.AddSingleton<CatalogService>();
serviceCollection.AddSingleton<DeliveryResolver>();
// One instance: the status endpoint and the sync task must see the same caches
// as the channel Jellyfin serves from.
serviceCollection.AddSingleton<FloatplaneChannel>();
serviceCollection.AddSingleton<IChannel>(sp => sp.GetRequiredService<FloatplaneChannel>());
}
}