R-1292: qBittorrent's 50 % rule owns the NORMAL limit only (up_limit through app/preferences), never the current speed mode's slot. Test with the alternative mode on, red-proved. Commit only.
gates / gates (push) Successful in 1m32s
gates / gates (push) Successful in 1m32s
This commit is contained in:
@@ -3,6 +3,7 @@ package upwatch
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -54,6 +55,20 @@ func fakeQBServer(t *testing.T, pw string, logins *int, expireNext *bool, limit
|
||||
fmt.Sscan(r.Form.Get("limit"), &v)
|
||||
*limit = v / 1024 * 1024
|
||||
w.WriteHeader(200)
|
||||
// R-1292: the 50 % rule reads and writes the NORMAL slot through app/preferences (normal mode here: the same value).
|
||||
case "/api/v2/app/preferences":
|
||||
fmt.Fprintf(w, `{"up_limit":%d,"alt_up_limit":0}`, *limit)
|
||||
case "/api/v2/app/setPreferences":
|
||||
r.ParseForm()
|
||||
var m map[string]int64
|
||||
if err := json.Unmarshal([]byte(r.Form.Get("json")), &m); err != nil {
|
||||
w.WriteHeader(400)
|
||||
return
|
||||
}
|
||||
if v, ok := m["up_limit"]; ok {
|
||||
*limit = v / 1024 * 1024
|
||||
}
|
||||
w.WriteHeader(200)
|
||||
default:
|
||||
w.WriteHeader(404)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user