attempt to use http2 server push

This commit is contained in:
Harvey Tindall 2021-01-14 14:18:12 +00:00
parent 4679c6f355
commit 965c449f1c
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
1 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,14 @@ func (app *appContext) AdminPage(gc *gin.Context) {
emailEnabled, _ := app.config.Section("invite_emails").Key("enabled").Bool()
notificationsEnabled, _ := app.config.Section("notifications").Key("enabled").Bool()
ombiEnabled := app.config.Section("ombi").Key("enabled").MustBool(false)
if pusher := gc.Writer.Pusher(); pusher != nil {
toPush := []string{"/js/admin.js", "/js/theme.js", "/js/lang.js", "/js/modal.js", "/js/tabs.js", "/js/invites.js", "/js/accounts.js", "/js/settings.js", "/js/profiles.js", "/js/common.js"}
for _, f := range toPush {
if err := pusher.Push(f, nil); err != nil {
app.debug.Printf("Failed HTTP2 ServerPush of \"%s\": %+v", f, err)
}
}
}
gcHTML(gc, http.StatusOK, "admin.html", gin.H{
"urlBase": app.URLBase,
"cssClass": app.cssClass,