plugin: fix zip reproducibility and legacy-tag log spam

Two issues found while verifying the live install:

1. pack.py produced a different zip MD5 for identical content, because zip
   records file mtimes. Re-running pack.py would have rewritten the manifest
   checksum while the already-published asset stayed the same, and Jellyfin
   would then refuse the install with "The checksum of the received data
   doesn't match." The zip entry now carries a fixed 1980-01-01 timestamp, and
   --publish downloads the published asset back and compares its MD5 with the
   manifest checksum before reporting success.

2. The legacy deploy.py tag lives in the on-disk index.html, so it was stripped
   from every single response and logged at INFO each time (6 lines and counting
   per boot on the live server). The message is now emitted once, and says what
   it actually means: the tag is still on disk, run deploy.py rollback to clean
   it up.

Verified: 21/21 rewrite checks pass, including a regression case built from the
tag actually present on the server.
This commit is contained in:
2026-10-17 23:33:06 +08:00
parent ac85de2cb8
commit 5279f3929a
2 changed files with 50 additions and 4 deletions
@@ -38,6 +38,7 @@ public sealed class ScriptInjectionStartupFilter : IStartupFilter
private readonly BundleProvider _bundle;
private readonly ILogger<ScriptInjectionStartupFilter> _logger;
private int _loggedOnce;
private int _legacyLoggedOnce;
/// <summary>
/// Initializes a new instance of the <see cref="ScriptInjectionStartupFilter"/> class.
@@ -158,9 +159,15 @@ public sealed class ScriptInjectionStartupFilter : IStartupFilter
var rewritten = IndexHtmlRewriter.Rewrite(html, scriptUrl, out var removedLegacy);
if (removedLegacy)
if (removedLegacy && Interlocked.Exchange(ref _legacyLoggedOnce, 1) == 0)
{
_logger.LogInformation("JFVR: removed the legacy deploy.py <script> tag from index.html.");
// Logged once, not per request: the legacy tag lives in the on-disk
// index.html, so it is stripped from every single response until the
// file itself is cleaned up (deploy.py rollback) or deploy.py is run
// again. Per-request logging would just fill the log with the same line.
_logger.LogInformation(
"JFVR: stripping the legacy deploy.py <script> tag from index.html. "
+ "It is still present on disk; run 'python3 deploy.py rollback' to clean it up.");
}
if (IndexHtmlRewriter.IsInjected(html) || rewritten == html)