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