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
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ func main() { ...@@ -32,7 +32,7 @@ func main() {
http.Handle("/a/", http.StripPrefix("/a/", pageAlbumDetail(pageContext))) http.Handle("/a/", http.StripPrefix("/a/", pageAlbumDetail(pageContext)))
http.Handle("/me/images/", pageImageList(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.Handle("/", pageIndex(pageContext))
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
......
...@@ -18,6 +18,18 @@ func pageIndex(ctx PageContext) http.Handler { ...@@ -18,6 +18,18 @@ func pageIndex(ctx PageContext) http.Handler {
}); err != nil { }); err != nil {
panic(err) 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 { } else {
w.Header().Set("Vary", "Accept-Encoding") w.Header().Set("Vary", "Accept-Encoding")
w.Header().Set("Cache-Control", "public, max-age=31536000") w.Header().Set("Cache-Control", "public, max-age=31536000")
......
{{define "navigation"}} {{define "navigation"}}
<nav> <nav>
<ul> <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" }} {{if .HasRole "imghost:user" }}
<li><a href="/upload">Upload</a></li> <li><a href="/upload">Upload</a></li>
{{end}} {{end}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment