added preloads page

This commit is contained in:
ston1th 2022-03-23 01:09:12 +01:00
commit 333d5cb149
6 changed files with 235 additions and 75 deletions

View file

@ -95,6 +95,15 @@ func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fs.h.ServeHTTP(w, r)
return
}
if option == "preloads" {
h.Set(csp, indexCSP)
err = preloads.Execute(w, getPreloads(p, fs.fs))
if err != nil {
fs.log.Error(err, "error rendering preloads")
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}
i := &responseInterceptor{w: w}
r.Header.Del("If-Modified-Since")