Files
officer a7f1a71785 jellyfin, extracted from the platform as a plugin
Eighth plugin out, and the second resurrection: like soulseek, hono.ts carried
the router import and its mount commented out since 2026-08-13, with the
permission reduced to api: [], so the server booted clean while every panel
request 404'd. jellyfin_servers was also absent from the drizzle barrel, so
bun db:push would have dropped it.

Easier than soulseek in one specific way: mountPrefix derives /jellyfin from
the appName, which is exactly what the router already hardcoded, so no frontend
call site needed repointing. Soulseek needed 47 because its appName and its old
prefix differed. The frontend also already routed through one helper, so there
were five call sites rather than forty-seven.

Self-contained, unlike transmission and soulseek: jellyfin_servers is a
registry this plugin owns outright — label, URL, encrypted token, one active —
because more than one Jellyfin is a thing someone has, and more than one
Transmission is not.

Carries its own .prettierignore for the vendored hls.mjs, rather than leaving a
stale rule behind in the platform naming a path that no longer exists.
2026-08-19 03:17:32 +00:00

26 lines
1.1 KiB
TypeScript

import { createSidecarProxy } from '@@/sidecar/create-proxy';
import { mountPrefix } from '@@/plugins/manifest';
import { manifest } from '../manifest';
// /api/jellyfin/* — auth, then forward to officer-jellyfin. No routes of its own and no Jellyfin knowledge:
// this file must never grow app logic.
//
// The sidecar owns the Jellyfin contract and holds its credentials.
//
// `timeoutSeconds` is generous because this proxy carries VIDEO. A direct-play stream holds one connection
// open for the length of the film, and the first request against a fresh transcode waits on ffmpeg starting
// up. The default 60s idle drop would cut both.
const proxy = createSidecarProxy({
name: 'jellyfin',
// DERIVED, never written out: `mountPrefix` returns `/jellyfin` for a first-party plugin and
// `/p/<publisher>/jellyfin` for anyone else's, so a literal is right only by coincidence.
prefix: `/api${mountPrefix({ appName: 'jellyfin', manifest })}`,
timeoutSeconds: 3600,
});
export const router = proxy.router;
/** Base URL of the sidecar's HTTP server, or null if it hasn't reported in yet. */
export const getJellyfinServerUrl = proxy.getHttpUrl;