Commit 3079673d authored by Janne Koschinski's avatar Janne Koschinski

Added icon handling

Signed-off-by: Janne Koschinski's avatarJanne Koschinski <janne@kuschku.de>
parent 475478dc
......@@ -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}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment