Skip to content

Commit f627d4b

Browse files
KSemenenkoclaude
andcommitted
Serve the redesigned admin console assets from the static whitelist
The light console split into brand/layout/views stylesheets, a logo and focused modules; whitelist exactly those embedded files and drop the obsolete styles.css. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 2fc0d1a commit f627d4b

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

‎src/KeyLoad.Server/Features/AdminDashboard/AdminStaticAssets.cs‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ internal static class AdminStaticAssets
1111
private const string Html = "text/html; charset=utf-8";
1212
private const string Css = "text/css; charset=utf-8";
1313
private const string JavaScript = "text/javascript; charset=utf-8";
14+
private const string Svg = "image/svg+xml";
15+
private const string Logo = "logo.svg";
1416
private const string Index = "index.html";
1517
private const string NoStore = "no-store";
1618
private const string NoSniff = "nosniff";
@@ -20,19 +22,27 @@ internal static class AdminStaticAssets
2022
private const string CspHeader = "Content-Security-Policy";
2123
private const string ReferrerHeader = "Referrer-Policy";
2224
private static readonly string[] Methods = [HttpMethods.Get, HttpMethods.Head];
23-
private static readonly FrozenDictionary<string, (string File, string Type)> Assets =
24-
new Dictionary<string, (string, string)>(StringComparer.Ordinal)
25+
private static readonly string[] Stylesheets = ["brand.css", "layout.css", "views.css"];
26+
private static readonly string[] Scripts = ["constants.js", "text.js", "format.js", "dom.js", "tooltip.js", "charts.js",
27+
"metrics.js", "navigation.js", "browsing.js", "catalog.js", "errors.js", "overview.js", "performance.js",
28+
"nodes.js", "storage.js", "app.js"];
29+
private static readonly FrozenDictionary<string, (string File, string Type)> Assets = Catalog()
30+
.ToFrozenDictionary(StringComparer.Ordinal);
31+
32+
private static Dictionary<string, (string, string)> Catalog()
33+
{
34+
var assets = new Dictionary<string, (string, string)>(StringComparer.Ordinal)
2535
{
2636
[RootPath] = (Index, Html),
2737
[RootPath + Index] = (Index, Html),
28-
[RootPath + "styles.css"] = ("styles.css", Css),
29-
[RootPath + "constants.js"] = ("constants.js", JavaScript),
30-
[RootPath + "dom.js"] = ("dom.js", JavaScript),
31-
[RootPath + "metrics.js"] = ("metrics.js", JavaScript),
32-
[RootPath + "rendering.js"] = ("rendering.js", JavaScript),
33-
[RootPath + "browsing.js"] = ("browsing.js", JavaScript),
34-
[RootPath + "app.js"] = ("app.js", JavaScript)
35-
}.ToFrozenDictionary(StringComparer.Ordinal);
38+
[RootPath + Logo] = (Logo, Svg)
39+
};
40+
foreach (var file in Stylesheets)
41+
{ assets[RootPath + file] = (file, Css); }
42+
foreach (var file in Scripts)
43+
{ assets[RootPath + file] = (file, JavaScript); }
44+
return assets;
45+
}
3646

3747
internal static bool IsPublicRequest(HttpRequest request) =>
3848
(HttpMethods.IsGet(request.Method) || HttpMethods.IsHead(request.Method))

‎src/KeyLoad.Server/Features/AdminDashboard/Assets/styles.css‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)