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.
130 lines
5.0 KiB
HTML
130 lines
5.0 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<title>Jellyfin Web VR</title>
|
||
</head>
|
||
<body>
|
||
<div id="JfvrConfigPage" data-role="page" class="page type-interior pluginConfigurationPage">
|
||
<div data-role="content">
|
||
<div class="content-primary">
|
||
<form id="JfvrConfigForm">
|
||
<div class="verticalSection">
|
||
<div class="sectionTitleContainer flex align-items-center">
|
||
<h2 class="sectionTitle">Jellyfin Web VR</h2>
|
||
<a is="emby-linkbutton" class="raised raised-mini emby-button" style="margin-left:2em"
|
||
target="_blank" rel="noopener"
|
||
href="https://git.cat-shark.xyz/cat-shark/jellyfin_vr_web_plugin">
|
||
<i class="md-icon button-icon button-icon-left secondaryText"></i>
|
||
<span>Help</span>
|
||
</a>
|
||
</div>
|
||
<p class="fieldDescription">
|
||
在 jellyfin-web 的 <code>index.html</code> 里注入 VR 播放脚本,让 Quest 3
|
||
浏览器直接进入 VR180 / VR360 沉浸播放。改写发生在请求时,磁盘上的文件不会被改动,
|
||
所以 Jellyfin 升级不会丢掉注入。
|
||
</p>
|
||
<p class="fieldDescription">
|
||
<strong>改完设置后需要刷新浏览器</strong>(<code>index.html</code> 本身没有强缓存,
|
||
普通刷新即可)。
|
||
</p>
|
||
</div>
|
||
|
||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||
<label>
|
||
<input is="emby-checkbox" type="checkbox" id="chkEnabled" />
|
||
<span>启用注入</span>
|
||
</label>
|
||
<div class="fieldDescription checkboxFieldDescription">
|
||
关闭后 <code>index.html</code> 原样返回,不再注入;脚本端点仍然可以访问。
|
||
</div>
|
||
</div>
|
||
|
||
<div class="inputContainer">
|
||
<input is="emby-input" type="text" id="txtScriptUrl" label="脚本 URL 覆盖(可选)" />
|
||
<div class="fieldDescription">
|
||
留空则使用插件内置的 bundle:<code id="builtinUrl">/JFVR/jfvr.js</code>。
|
||
填了就注入这个 URL(例如自建 CDN 上的副本),内置 bundle 不再使用。
|
||
</div>
|
||
</div>
|
||
|
||
<div>
|
||
<button is="emby-button" type="submit" class="raised button-submit block">
|
||
<span>保存</span>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="verticalSection" style="margin-top:1.5em">
|
||
<h3 class="sectionTitle" style="font-size:1.1em">状态</h3>
|
||
<div id="statusBox" class="fieldDescription">读取中…</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
(function () {
|
||
'use strict';
|
||
|
||
var PLUGIN_ID = '7d33ef59-f9b0-412b-93bd-5cd5353018de';
|
||
|
||
function statusLine(label, value) {
|
||
return '<div><strong>' + label + ':</strong> ' + value + '</div>';
|
||
}
|
||
|
||
function renderStatus() {
|
||
var box = document.querySelector('#statusBox');
|
||
var url;
|
||
try {
|
||
url = ApiClient.getUrl('JFVR/status');
|
||
} catch (err) {
|
||
url = '/JFVR/status';
|
||
}
|
||
|
||
ApiClient.ajax({ type: 'GET', url: url, dataType: 'json' }).then(function (s) {
|
||
box.innerHTML =
|
||
statusLine('插件版本', s.version) +
|
||
statusLine('bundle 版本', s.bundleHash + '(' + s.bundleBytes + ' bytes)') +
|
||
statusLine('注入', s.enabled ? '已启用' : '已关闭') +
|
||
statusLine('注入的 URL', '<code>' + s.injectedTag + '</code>');
|
||
}).catch(function () {
|
||
box.textContent = '无法读取 /JFVR/status(插件可能尚未加载完成)。';
|
||
});
|
||
}
|
||
|
||
function loadConfiguration() {
|
||
Dashboard.showLoadingMsg();
|
||
ApiClient.getPluginConfiguration(PLUGIN_ID).then(function (config) {
|
||
document.querySelector('#chkEnabled').checked = config.Enabled !== false;
|
||
document.querySelector('#txtScriptUrl').value = config.ScriptUrlOverride || '';
|
||
Dashboard.hideLoadingMsg();
|
||
renderStatus();
|
||
});
|
||
}
|
||
|
||
function saveConfiguration(e) {
|
||
e.preventDefault();
|
||
Dashboard.showLoadingMsg();
|
||
ApiClient.getPluginConfiguration(PLUGIN_ID).then(function (config) {
|
||
config.Enabled = document.querySelector('#chkEnabled').checked;
|
||
config.ScriptUrlOverride = document.querySelector('#txtScriptUrl').value || '';
|
||
ApiClient.updatePluginConfiguration(PLUGIN_ID, config).then(function (result) {
|
||
Dashboard.processPluginConfigurationUpdateResult(result);
|
||
renderStatus();
|
||
});
|
||
});
|
||
return false;
|
||
}
|
||
|
||
document.querySelector('#JfvrConfigForm').addEventListener('submit', saveConfiguration);
|
||
|
||
document.addEventListener('pageshow', function (e) {
|
||
if (e.target.id === 'JfvrConfigPage') {
|
||
loadConfiguration();
|
||
}
|
||
});
|
||
})();
|
||
</script>
|
||
</body>
|
||
</html>
|