aboutsummaryrefslogtreecommitdiffstats
path: root/web/web.go
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-12 21:35:46 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-12 21:35:46 -0800
commitde96851d8eb0a0b45d7bf0cee67339fea54349f0 (patch)
treed9ca55835743e2254732ea68a674e7007f3554eb /web/web.go
parent8a8f516ebd1115eed6256cd1b60be6393fd42c26 (diff)
downloadneko-de96851d8eb0a0b45d7bf0cee67339fea54349f0.tar.gz
neko-de96851d8eb0a0b45d7bf0cee67339fea54349f0.tar.bz2
neko-de96851d8eb0a0b45d7bf0cee67339fea54349f0.zip
wip: tui updates (buggy)
Diffstat (limited to 'web/web.go')
-rw-r--r--web/web.go12
1 files changed, 11 insertions, 1 deletions
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) {