Skip to content
Snippets Groups Projects
Verified Commit 3079673d authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Added icon handling

parent 475478dc
Branches
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ func main() {
http.Handle("/a/", http.StripPrefix("/a/", pageAlbumDetail(pageContext)))
http.Handle("/me/images/", pageImageList(pageContext))
http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets"))))
http.Handle("/assets/", http.StripPrefix("/assets/", pageContext.AssetServer))
http.Handle("/", pageIndex(pageContext))
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
......
......@@ -18,6 +18,18 @@ func pageIndex(ctx PageContext) http.Handler {
}); err != nil {
panic(err)
}
} else if r.URL.Path == "/favicon.ico" {
w.Header().Set("Vary", "Accept-Encoding")
w.Header().Set("Cache-Control", "public, max-age=31536000")
ctx.AssetServer.ServeHTTP(w, r)
} else if r.URL.Path == "/favicon.png" {
w.Header().Set("Vary", "Accept-Encoding")
w.Header().Set("Cache-Control", "public, max-age=31536000")
ctx.AssetServer.ServeHTTP(w, r)
} else if r.URL.Path == "/favicon.svg" {
w.Header().Set("Vary", "Accept-Encoding")
w.Header().Set("Cache-Control", "public, max-age=31536000")
ctx.AssetServer.ServeHTTP(w, r)
} else {
w.Header().Set("Vary", "Accept-Encoding")
w.Header().Set("Cache-Control", "public, max-age=31536000")
......
{{define "navigation"}}
<nav>
<ul>
<li class="title"><a href="/">ik8r</a></li>
<li class="title"><a href="/"><img src="/assets/images/logo.svg"></a></li>
{{if .HasRole "imghost:user" }}
<li><a href="/upload">Upload</a></li>
{{end}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment