From 7a27e64d0f84656775c008ff23028c4f20aa5e5f Mon Sep 17 00:00:00 2001 From: Jannis Mattheis Date: Tue, 2 Jul 2024 21:23:34 +0200 Subject: [PATCH] fix(ui): serving /index.html --- ui/serve.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ui/serve.go b/ui/serve.go index a8c4a4728..0fe7524e6 100644 --- a/ui/serve.go +++ b/ui/serve.go @@ -26,11 +26,14 @@ func Register(r *gin.Engine, version model.VersionInfo, register bool) { if err != nil { panic(err) } - ui := r.Group("/", gzip.Gzip(gzip.DefaultCompression)) - ui.GET("/", serveFile("index.html", "text/html", func(content string) string { + + replaceConfig := func(content string) string { return strings.Replace(content, "%CONFIG%", string(uiConfigBytes), 1) - })) - ui.GET("/index.html", serveFile("index.html", "text/html", noop)) + } + + ui := r.Group("/", gzip.Gzip(gzip.DefaultCompression)) + ui.GET("/", serveFile("index.html", "text/html", replaceConfig)) + ui.GET("/index.html", serveFile("index.html", "text/html", replaceConfig)) ui.GET("/manifest.json", serveFile("manifest.json", "application/json", noop)) ui.GET("/asset-manifest.json", serveFile("asset-manifest.json", "application/json", noop))