perf(web): use thumbnails instead of full sized images

This commit is contained in:
Masahiko AMANO 2023-01-31 23:07:35 +03:00
parent eaa7c2f2ce
commit 083eac3fee

View File

@ -218,6 +218,9 @@ func main() {
http.StripPrefix("/files", tfm_fs).ServeHTTP(w, r)
}))
http.Handle("/thumbs/", Auth(func(w http.ResponseWriter, r *http.Request) {
thumb_path := strings.Split(r.URL.Path, "/")
thumb_path[len(thumb_path)-1] = ".thumb-" + thumb_path[len(thumb_path)-1]
r.URL.Path = strings.Join(thumb_path, "/")
http.StripPrefix("/thumbs", tfm_fs).ServeHTTP(w, r)
}))
log.Println("Running...")