feat: Add debug endpoint to expire all logins.

This commit is contained in:
William Floyd 2025-02-07 01:17:14 +05:30
parent cf2e64354b
commit 6fa35aeb47
Signed by untrusted user who does not match committer: william
GPG key ID: B3EEEDD81893CAF9

View file

@ -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{}