Merge pull request #665 from gotify/fix-ui-config

fix(ui): serving /index.html
This commit is contained in:
Jannis Mattheis 2024-07-02 22:30:09 +02:00 committed by GitHub
commit a8a4fefd86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -26,11 +26,14 @@ func Register(r *gin.Engine, version model.VersionInfo, register bool) {
if err != nil { if err != nil {
panic(err) 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) 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("/manifest.json", serveFile("manifest.json", "application/json", noop))
ui.GET("/asset-manifest.json", serveFile("asset-manifest.json", "application/json", noop)) ui.GET("/asset-manifest.json", serveFile("asset-manifest.json", "application/json", noop))