Add cache-busting to health check UI assets

Introduced a `CacheId` field in `HealthCheckHtmlGenerator` to append unique query strings to CSS and JS file references. This ensures updated assets are fetched by bypassing browser cache after application restarts. Removed static asset references in favor of dynamic ones.
This commit is contained in:
2026-07-13 14:21:07 +02:00
parent 5f251c1209
commit 98f8dc8710

View File

@@ -9,6 +9,8 @@ namespace ECMJobRunner.WebCron.HealthCheck;
/// </summary>
public static class HealthCheckHtmlGenerator
{
private static readonly string CacheId = Guid.NewGuid().ToString();
/// <summary>
/// Generates a complete HTML page for displaying health check results.
/// </summary>
@@ -34,7 +36,7 @@ public static class HealthCheckHtmlGenerator
{
var sb = new StringBuilder();
sb.AppendLine(@"
sb.AppendLine(@$"
<!DOCTYPE html>
<html>
<head>
@@ -42,8 +44,8 @@ public static class HealthCheckHtmlGenerator
<meta name=""viewport"" content=""width=device-width, initial-scale=1.0"">
<title>Health Check - ECMJobRunner</title>
<link rel=""stylesheet"" href=""https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"" />
<link rel=""stylesheet"" href=""/css/health-ui.css"" />
<script src=""/js/health-ui.js""></script>
<link rel=""stylesheet"" href=""/css/health-ui.css?{CacheId}"" />
<script src=""/js/health-ui.js?{CacheId}""></script>
</head>
<body>");