Skip to content

Commit

Permalink
Merge pull request gotify#665 from gotify/fix-ui-config
Browse files Browse the repository at this point in the history
fix(ui): serving /index.html
  • Loading branch information
jmattheis authored Jul 2, 2024
2 parents 69c939e + 7a27e64 commit a8a4fef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ui/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit a8a4fef

Please sign in to comment.