1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-12 19:55:59 +01:00

Rename mungeHeader to cspHeader.

This commit is contained in:
Juliusz Chroboczek 2021-11-06 00:07:18 +01:00
parent 1d89177ae9
commit 5c2e27b21d

View file

@ -86,7 +86,7 @@ func Serve(address string, dataDir string) error {
return err return err
} }
func mungeHeader(w http.ResponseWriter) { func cspHeader(w http.ResponseWriter) {
w.Header().Add("Content-Security-Policy", w.Header().Add("Content-Security-Policy",
"connect-src ws: wss: 'self'; img-src data: 'self'; media-src blob: 'self'; default-src 'self'") "connect-src ws: wss: 'self'; img-src data: 'self'; media-src blob: 'self'; default-src 'self'")
} }
@ -174,7 +174,7 @@ func (fh *fileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
} }
mungeHeader(w) cspHeader(w)
p := r.URL.Path p := r.URL.Path
// this ensures any leading .. are removed by path.Clean below // this ensures any leading .. are removed by path.Clean below
if !strings.HasPrefix(p, "/") { if !strings.HasPrefix(p, "/") {
@ -316,7 +316,7 @@ func groupHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
mungeHeader(w) cspHeader(w)
serveFile(w, r, filepath.Join(StaticRoot, "galene.html")) serveFile(w, r, filepath.Join(StaticRoot, "galene.html"))
} }