diff --git a/main.go b/main.go index 7a7d133aec70de7b5634cb22285d80d77b931efa..4976acf4437f0c3e76cee835b6b9d9208fb2a0b5 100644 --- a/main.go +++ b/main.go @@ -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) { diff --git a/page_index.go b/page_index.go index 8ec8040a810692dc73f59f53bf906cfb864a8c2f..a2dced31813c44f3155f18b61b47d54231021c85 100644 --- a/page_index.go +++ b/page_index.go @@ -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") diff --git a/templates/_navigation.html b/templates/_navigation.html index ca8b030e04cf0490d4e9c27dd1f86ca899a330e2..bca2fc8079fe271bea5ec416b956e05ee73352e4 100644 --- a/templates/_navigation.html +++ b/templates/_navigation.html @@ -1,7 +1,7 @@ {{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}}