Stamp the stylesheet and script with their mtime
A pull changes the files but not their URLs, so a browser kept serving the old stylesheet to new markup — which is how the Monitor AI row lost its layout.
This commit is contained in:
@@ -138,9 +138,24 @@ if ($_vv_ai) $validTabs[] = 'ai';
|
||||
|
||||
if (!in_array($tab, $validTabs)) $tab = 'monitor';
|
||||
$tabLabels = ['monitor' => 'Monitor', 'scheduler' => 'Scheduler', 'docker' => 'Docker', 'watchdog' => 'Watchdog', 'partnership' => 'Partnership', 'fallback' => 'FallBack', 'arrs' => 'Arrs', 'rsync' => 'Rsync', 'auth' => 'Auth Stack', 'settings' => 'Settings', 'ai' => 'AI'];
|
||||
|
||||
// Cache stamp for the stylesheet and script below. Both are served straight off the plugin
|
||||
// directory at a path that never changes, so a browser holding an old copy keeps using it after
|
||||
// a git pull. This page's own markup is generated fresh every request, so the two fall out of
|
||||
// step: markup from the new commit rendering against a stylesheet from the old one. That is not
|
||||
// a theoretical failure — it broke the Monitor AI row on 2026-08-09, when placement moved from
|
||||
// inline spans into the stylesheet and only half of that arrived in the browser.
|
||||
//
|
||||
// mtime rather than a hand-bumped version: it changes on exactly the event that matters, a pull
|
||||
// rewriting the file, and cannot be forgotten. Falling back to time() when the stat fails errs
|
||||
// toward re-fetching rather than toward the stale copy that caused the problem.
|
||||
$_vv_asset_rev = [];
|
||||
foreach (['css/varaverk.css', 'js/varaverk.js'] as $_vv_a) {
|
||||
$_vv_asset_rev[$_vv_a] = @filemtime(__DIR__ . '/' . $_vv_a) ?: time();
|
||||
}
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" href="/plugins/<?=$plugin?>/css/varaverk.css">
|
||||
<link rel="stylesheet" href="/plugins/<?=$plugin?>/css/varaverk.css?v=<?=$_vv_asset_rev['css/varaverk.css']?>">
|
||||
|
||||
<div id="varaverk-wrap" class="unapi">
|
||||
|
||||
@@ -173,4 +188,4 @@ $tabLabels = ['monitor' => 'Monitor', 'scheduler' => 'Scheduler', 'docker' => 'D
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/plugins/<?=$plugin?>/js/varaverk.js"></script>
|
||||
<script src="/plugins/<?=$plugin?>/js/varaverk.js?v=<?=$_vv_asset_rev['js/varaverk.js']?>"></script>
|
||||
|
||||
Reference in New Issue
Block a user