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:
@@ -16,9 +16,43 @@ VR180 / VR360 沉浸播放,不用再手动切全屏 + 选投影。
|
||||
| 备份 | `/vol2/jellyfin/config/_vr_backup/index.html.orig` |
|
||||
| 两个入口都生效 | `http://192.168.123.199:8096/web/` 与 `https://jellyfin.cat-shark.xyz/web/` |
|
||||
|
||||
> ⚠️ 注入写在**容器内文件**里,`jellyfin/jellyfin:latest` 一升级就没了,重跑 `deploy.py` 即可。
|
||||
> 正式版应改用 **JavaScript Injector 插件**(`n00bcodr/jellyfin-plugins` 的 `12/manifest.json`,targetAbi 12.0.0.0)
|
||||
> 或 **File Transformation**,这样升级不丢、可开关。
|
||||
> ⚠️ 老路子(`deploy.py`):注入写在**容器内文件**里,`jellyfin/jellyfin:latest` 一升级就没了,
|
||||
> 得重跑 `deploy.py`。**现在已经有插件版了,见下面 §1.1,优先用插件。**
|
||||
|
||||
### 1.1 插件化(推荐,已实现)
|
||||
|
||||
JFVR 同时也是一个标准的 **Jellyfin 插件**,通过自建 Gitea 仓库分发,走 Dashboard 的
|
||||
「添加存储库 → Catalog 安装」,**不再改容器内任何文件**。
|
||||
|
||||
| 项 | 值 |
|
||||
|---|---|
|
||||
| 插件仓库地址 | `https://git.cat-shark.xyz/cat-shark/jellyfin_vr_web_plugin/raw/branch/main/manifest.json` |
|
||||
| 插件名 / GUID | `Jellyfin Web VR` / `7d33ef59-f9b0-412b-93bd-5cd5353018de` |
|
||||
| 目标 ABI | `12.0.0.0`(Jellyfin 只保留 `targetAbi <= 服务器版本` 的条目,所以一份包覆盖整个 12.x) |
|
||||
| 插件代码 | `plugin/Jellyfin.Plugin.JFVR/`(C#,net10.0,对 `Jellyfin.Controller 12.1.0`) |
|
||||
| 打包 / 发布 | `python3 pack.py` / `python3 pack.py --bump --publish` |
|
||||
| 脚本端点 | `/JFVR/jfvr.js`(bundle 内嵌在 DLL 里,URL 带内容哈希做缓存键) |
|
||||
| 状态查询 | `/JFVR/status` |
|
||||
| 设置页 | Dashboard → 插件 → Jellyfin Web VR(开关注入 / 覆盖脚本 URL) |
|
||||
|
||||
**安装**:Dashboard → 插件 → 目录 → ⚙️ → ➕ → 粘贴上面的仓库地址 → 保存 →
|
||||
在 Catalog 里找到 **Jellyfin Web VR** → 安装 → **重启 Jellyfin**。
|
||||
|
||||
**工作方式**:`ScriptInjectionStartupFilter` 在**请求时**把
|
||||
`<script plugin="JFVR" src="../JFVR/jfvr.js?v=<hash>" defer></script>`
|
||||
插到 `index.html` 的 `</body>` 之前。磁盘上的 `/jellyfin/jellyfin-web/` 一个字节都不动,
|
||||
所以升级 Jellyfin 不会丢。如果检测到老 `deploy.py` 留下的 `<script plugin="JellyfinVR" ...>`,
|
||||
会**自动清掉**,不会重复加载 bundle。
|
||||
|
||||
**改完 web 代码后的流程**:
|
||||
|
||||
```bash
|
||||
python3 pack.py --bump --publish # 构建 → 打包 → 建 Release → 推 manifest
|
||||
# 然后在 Jellyfin 里:插件页点更新(或重装),重启,刷新浏览器
|
||||
```
|
||||
|
||||
> 老路子仍然可用,作为插件的兜底:`JF_PW=... python3 deploy.py`。
|
||||
> 但**两者不要同时开** —— 装了插件就别再跑 `deploy.py`(跑完插件也会把那个标签清掉)。
|
||||
|
||||
---
|
||||
|
||||
@@ -255,6 +289,16 @@ WebXR 规范原文:
|
||||
|
||||
## 8. 修改 / 部署 / 回滚
|
||||
|
||||
### 8.1 插件(推荐)
|
||||
|
||||
```bash
|
||||
python3 pack.py --bump --publish # 构建 + 打包 + 建 Release + 推 manifest.json
|
||||
```
|
||||
|
||||
然后在 Jellyfin 里更新插件并重启,刷新浏览器。
|
||||
|
||||
### 8.2 老路子:直接注入容器内文件(兜底)
|
||||
|
||||
```bash
|
||||
# 改 jfvr-mvp.js 后重新部署
|
||||
JF_PW='<ssh密码>' python3 deploy.py
|
||||
@@ -264,6 +308,7 @@ JF_PW='<ssh密码>' python3 deploy.py rollback
|
||||
```
|
||||
|
||||
`deploy.py` 用文件 md5 前 6 位作为版本号写进 script 标签的 query,自动破缓存。
|
||||
插件走的是同一套破缓存思路,只是 hash 由 DLL 内嵌 bundle 的 md5 算出来。
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user