From 6fa35aeb47a1a2d39b07f599f6e80f262a72e787 Mon Sep 17 00:00:00 2001 From: William Floyd Date: Fri, 7 Feb 2025 01:17:14 +0530 Subject: [PATCH] feat: Add debug endpoint to expire all logins. --- handlers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/handlers.go b/handlers.go index 2222445..ed91639 100644 --- a/handlers.go +++ b/handlers.go @@ -11,6 +11,7 @@ import ( "strconv" "strings" "sync" + "time" "github.com/Jeffail/gabs/v2" "github.com/W-Floyd/qbittorrent-multiplexer/qbittorrent" @@ -137,6 +138,11 @@ func (c *Config) HandleAll(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/debug/leastbusy" { body := strings.NewReader(qbittorrent.LeastBusy().URL.Host) c.MakeResponse(nil, &http.Response{Body: io.NopCloser(body)}, w) + } else if r.URL.Path == "/debug/expirelogins" { + for _, instance := range qbittorrent.Instances { + instance.Auth.Cookie.Expires = time.Now() + } + c.MakeResponse(nil, &http.Response{Body: io.NopCloser(strings.NewReader("Marked all cookies to expire"))}, w) } else if r.URL.Path == "/debug/torrents/perinstance" { body := []string{}