From de96851d8eb0a0b45d7bf0cee67339fea54349f0 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Thu, 12 Feb 2026 21:35:46 -0800 Subject: wip: tui updates (buggy) --- web/web.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'web/web.go') diff --git a/web/web.go b/web/web.go index 22e84f5..551354a 100644 --- a/web/web.go +++ b/web/web.go @@ -7,6 +7,7 @@ import ( "log" "net/http" "strconv" + "strings" "time" "adammathes.com/neko/api" @@ -20,8 +21,17 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { } func imageProxyHandler(w http.ResponseWriter, r *http.Request) { - imgURL := r.URL.String() + imgURL := strings.TrimPrefix(r.URL.Path, "/") + if imgURL == "" { + http.Error(w, "no image url provided", http.StatusNotFound) + return + } + decodedURL, err := base64.URLEncoding.DecodeString(imgURL) + if err != nil { + http.Error(w, "invalid image url", http.StatusNotFound) + return + } // pseudo-caching if r.Header.Get("If-None-Match") == string(decodedURL) { -- cgit v1.2.3