Front-end auth improvements

Former-commit-id: 068e447a6332149f7c621da924100bacc5a02752 [formerly 80b5e008e56b9c48ccc0450effabc7f33dfd20b4] [formerly 0f8b405cb136355711970a9d9f3f1210272101ca [formerly 85e01a67c3f9e33ad0ac7fef5eeab612f747c08b]]
Former-commit-id: 03a1448741f695e2d5c681a11d9dcdca750ff61d [formerly 218dd8e95058a02cafee341dc2330c0a700972df]
Former-commit-id: 0d7ebe389f3e640f6a0102e8a4b5a28e395842c0
This commit is contained in:
Henrique Dias
2017-07-03 10:40:24 +01:00
parent f247a5560f
commit 54461e3cd6
11 changed files with 570 additions and 304 deletions

26
http.go
View File

@@ -56,23 +56,17 @@ func serveHTTP(c *requestContext, w http.ResponseWriter, r *http.Request) (int,
return serveAPI(c, w, r)
}
// Checks if this request is made to the base path /files. If so,
// shows the index.html page.
if matchURL(r.URL.Path, "/files") {
w.Header().Set("x-frame-options", "SAMEORIGIN")
w.Header().Set("x-content-type", "nosniff")
w.Header().Set("x-xss-protection", "1; mode=block")
// Any other request should show the index.html file.
w.Header().Set("x-frame-options", "SAMEORIGIN")
w.Header().Set("x-content-type", "nosniff")
w.Header().Set("x-xss-protection", "1; mode=block")
return renderFile(
w,
c.fm.assets.MustString("index.html"),
"text/html",
c.fm.RootURL(),
)
}
http.Redirect(w, r, c.fm.RootURL()+"/files"+r.URL.Path, http.StatusTemporaryRedirect)
return 0, nil
return renderFile(
w,
c.fm.assets.MustString("index.html"),
"text/html",
c.fm.RootURL(),
)
}
// staticHandler handles the static assets path.