Restore commented out header and fix lint errors

This commit is contained in:
Kloon ImKloon 2023-08-18 19:11:23 +02:00
parent 8c60137fe4
commit 269bcb6c07
No known key found for this signature in database
GPG Key ID: CCF1C86A995C5B6A
4 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ func (d *data) Check(path string) bool {
func handle(fn handleFunc, prefix string, store *storage.Storage, server *settings.Server) http.Handler {
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
for k, v := range global_headers {
for k, v := range globalHeaders {
w.Header().Set(k, v)
}

View File

@ -4,6 +4,6 @@
package http
// global headers to append to every response
var global_headers = map[string]string{
var globalHeaders = map[string]string{
"Cache-Control": "no-cache, no-store, must-revalidate",
}

View File

@ -6,7 +6,7 @@ package http
// global headers to append to every response
// cross-origin headers are necessary to be able to
// access them from a different URL during development
var global_headers = map[string]string{
var globalHeaders = map[string]string{
"Cache-Control": "no-cache, no-store, must-revalidate",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "*",

View File

@ -27,7 +27,7 @@ func NewHandler(
r := mux.NewRouter()
r.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// w.Header().Set("Content-Security-Policy", `default-src 'self'; style-src 'unsafe-inline';`)
w.Header().Set("Content-Security-Policy", `default-src 'self'; style-src 'unsafe-inline';`)
next.ServeHTTP(w, r)
})
})