From 083eac3feef3f59e5b6944d5472d2df302487d48 Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Tue, 31 Jan 2023 23:07:35 +0300 Subject: [PATCH] perf(web): use thumbnails instead of full sized images --- web/server/web-server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/server/web-server.go b/web/server/web-server.go index cd9a5a8..67b26d5 100644 --- a/web/server/web-server.go +++ b/web/server/web-server.go @@ -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...")