qBittorrent and Transmission: the two download clients, each with its complete record
gates / gates (push) Successful in 3s
gates / gates (push) Successful in 3s
Two new apps, published in one commit with their onboarding records, bench-proven on LXC 9401 and box-proven on scratch guest 9202 through the product. - qbittorrent 5.2.4-1 (the project's own image), 192M/1024M, torrent.<domain> - transmission version-4.1.3-r0 (lscr.io/linuxserver — the project publishes no image at all; the operator was asked and chose it before the build), 64M/512M, transmission.<domain> - first admin class 1 in both, measured; no UPnP (the box opens no port at home), both peer ports unpublished, a 276 MB torrent completed on outgoing connections alone - six defects found by measuring and fixed before publication (CHANGELOG has each measurement) - ladders written by upgrade-test.py --write-ladder, both venues proven - README (tree + both tables), FIRST-ADMIN (two rows), fixtures for both venues Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117kRTSgs3rJWUFGxyoWN6Y
This commit is contained in:
1 parent
3a6e9308c6
commit
9081a47e11
13 files changed
+1132
-18
No files matched your search
@@ -949,6 +949,31 @@
|
||||
"deploy_fields[SUBDOMAIN].label": "Aldomain",
|
||||
"description": "Titkosított jegyzet és szöveg megosztás"
|
||||
},
|
||||
"qbittorrent": {
|
||||
"app_info.default_creds": "admin / (telepítéskor generált jelszó)",
|
||||
"app_info.first_steps[0]": "Nyisd meg a torrent.DOMAIN címet, és lépj be az admin névvel és a telepítéskor kapott jelszóval",
|
||||
"app_info.first_steps[1]": "A Beállítások, Webes felhasználói felület oldalon állíts be saját jelszót",
|
||||
"app_info.first_steps[2]": "A letöltések a meghajtódra kerülnek, a media/torrents mappába",
|
||||
"app_info.first_steps[3]": "Csak olyan tartalmat tölts le, amihez jogod van. A letöltés a háztartásod internetcíméről történik, és a torrent természetéből adódóan a többi résztvevő látja a címedet.",
|
||||
"app_info.prerequisites[0]": "A letöltés a háztartásod internetkapcsolatát használja, és a feltöltés is onnan megy",
|
||||
"app_info.prerequisites[1]": "Befelé irányuló kapcsolatot nem fogad, mert a doboz otthon egyetlen portot sem nyit. A letöltés ettől működik: mérve 34 forrás és 4 MB/s egy jól ellátott torrenten. Csak a kevés forrású torrentek lassabbak, és keveset tudsz visszatölteni. Ha szeretnéd, az alkalmazás saját beállításaiban te magad bekapcsolhatod a port-nyitást",
|
||||
"app_info.tagline": "Torrent letöltés a saját gépedre, böngészőből vezérelve",
|
||||
"app_info.use_cases[0]": "Torrentek letöltése a saját meghajtódra, a böngészőből vezérelve",
|
||||
"app_info.use_cases[1]": "A letöltött fájlokat a fájlböngészőben és a médialejátszódban is látod",
|
||||
"app_info.use_cases[2]": "Sorban állás, sebességkorlát és ütemezés: éjjel tölthet, nappal nem zavarja a netedet",
|
||||
"app_info.use_cases[3]": "A Radarr és a Sonarr ehhez adja át a letöltéseket - enélkül azok nem töltenek le semmit",
|
||||
"data_paths[media/torrents].label": "Letöltések (qBittorrent)",
|
||||
"deploy_fields[DOMAIN].description": "A szerver domain neve",
|
||||
"deploy_fields[DOMAIN].label": "Domain",
|
||||
"deploy_fields[HDD_PATH].description": "A meghajtó, amelyre a letöltések kerülnek",
|
||||
"deploy_fields[HDD_PATH].label": "Letöltések meghajtója",
|
||||
"deploy_fields[HDD_PATH].placeholder": "/mnt/felhom-drives/hdd_1",
|
||||
"deploy_fields[QBT_ADMIN_PASSWORD].description": "A webes felület jelszava (felhasználónév: admin). A telepítéskor készül, utána a felületen változtathatod meg.",
|
||||
"deploy_fields[QBT_ADMIN_PASSWORD].label": "Belépési jelszó",
|
||||
"deploy_fields[SUBDOMAIN].description": "Az alkalmazás aldomainje",
|
||||
"deploy_fields[SUBDOMAIN].label": "Aldomain",
|
||||
"description": "Torrent letöltő webes felülettel, a saját gépeden"
|
||||
},
|
||||
"radarr": {
|
||||
"app_info.first_steps[0]": "Nyisd meg a radarr.DOMAIN címet a böngészőben",
|
||||
"app_info.first_steps[1]": "Állíts be egy letöltő klienst (pl. qBittorrent)",
|
||||
@@ -1178,6 +1203,30 @@
|
||||
"deploy_fields[SUBDOMAIN].label": "Aldomain",
|
||||
"description": "Webes SSH és szerver menedzser"
|
||||
},
|
||||
"transmission": {
|
||||
"app_info.default_creds": "admin / (telepítéskor generált jelszó)",
|
||||
"app_info.first_steps[0]": "Nyisd meg a transmission.DOMAIN címet, és lépj be az admin névvel és a telepítéskor kapott jelszóval",
|
||||
"app_info.first_steps[1]": "A kész letöltések a meghajtódon, a media/transmission/complete mappába kerülnek",
|
||||
"app_info.first_steps[2]": "Csak olyan tartalmat tölts le, amihez jogod van. A letöltés a háztartásod internetcíméről történik, és a torrent természetéből adódóan a többi résztvevő látja a címedet.",
|
||||
"app_info.prerequisites[0]": "A letöltés a háztartásod internetkapcsolatát használja, és a feltöltés is onnan megy",
|
||||
"app_info.prerequisites[1]": "Befelé irányuló kapcsolatot nem fogad, mert a doboz otthon egyetlen portot sem nyit. A letöltés ettől működik: mérve 34 forrás és 4 MB/s egy jól ellátott torrenten. Csak a kevés forrású torrentek lassabbak, és keveset tudsz visszatölteni. Ha szeretnéd, az alkalmazás saját beállításaiban te magad bekapcsolhatod a port-nyitást",
|
||||
"app_info.tagline": "Torrent letöltés egyszerűen, alig észrevehető erőforrásból",
|
||||
"app_info.use_cases[0]": "Torrentek letöltése a saját meghajtódra, egyszerű felületről",
|
||||
"app_info.use_cases[1]": "A kész fájlokat a fájlböngészőben és a médialejátszódban is látod",
|
||||
"app_info.use_cases[2]": "Nagyon keveset fogyaszt: kisebb gépen is elfér a többi alkalmazás mellett",
|
||||
"app_info.use_cases[3]": "Ha a teljes vezérlést szeretnéd (sorok, ütemezés, részletes szabályok), a qBittorrent az erősebb választás",
|
||||
"data_paths[media/transmission].label": "Letöltések (Transmission)",
|
||||
"deploy_fields[DOMAIN].description": "A szerver domain neve",
|
||||
"deploy_fields[DOMAIN].label": "Domain",
|
||||
"deploy_fields[HDD_PATH].description": "A meghajtó, amelyre a letöltések kerülnek",
|
||||
"deploy_fields[HDD_PATH].label": "Letöltések meghajtója",
|
||||
"deploy_fields[HDD_PATH].placeholder": "/mnt/felhom-drives/hdd_1",
|
||||
"deploy_fields[SUBDOMAIN].description": "Az alkalmazás aldomainje",
|
||||
"deploy_fields[SUBDOMAIN].label": "Aldomain",
|
||||
"deploy_fields[TR_ADMIN_PASSWORD].description": "A webes felület jelszava (felhasználónév: admin). A telepítéskor készül, utána a felületen változtathatod meg.",
|
||||
"deploy_fields[TR_ADMIN_PASSWORD].label": "Belépési jelszó",
|
||||
"description": "Egyszerű torrent letöltő, kevés erőforrásból"
|
||||
},
|
||||
"uptime-kuma": {
|
||||
"app_info.first_steps[0]": "Nyisd meg a status.DOMAIN címet a böngészőben",
|
||||
"app_info.first_steps[1]": "Hozd létre az admin fiókot az első megnyitáskor",
|
||||
@@ -1333,6 +1382,8 @@
|
||||
"mealie": "R-747 (2026-10-06, 09 §3 decision 144): one new first step, deliberate Hungarian addition — five wrong logins lock the account for 1-2 hours, wait; te-form, no kerjuk",
|
||||
"metube": "new app 2026-10-02 (family gate); Hungarian reviewed: informal te, no kerjuk (ASCII scan with a positive control)",
|
||||
"papra": "R-593 (2026-10-05): deliberate Hungarian rewrite, not a translation — AUTH_SECRET carried SUBDOMAIN's sentence 'Az alkalmazás aldomainje' (copy-paste one field too low); the sentence moved to SUBDOMAIN and AUTH_SECRET got its own: 'A bejelentkezéseket aláíró titkos kulcs (automatikusan generált)'",
|
||||
"radicale": "new app 2026-10-01 through NEW-APP-CHECKLIST.md: te-form, no kérjük; reviewed by CC against the operator rules"
|
||||
"qbittorrent": "New app 2026-10-12 (operator ruling: the catalog needs a download client - radarr/sonarr/seerr had none). Hungarian written with the voice the website switched to the same day; English twin complete at 23/23.",
|
||||
"radicale": "new app 2026-10-01 through NEW-APP-CHECKLIST.md: te-form, no kérjük; reviewed by CC against the operator rules",
|
||||
"transmission": "New app 2026-10-12 (operator ruling: a light torrent client beside qBittorrent). Hungarian written in the first-person voice the site switched to the same day; English twin complete."
|
||||
}
|
||||
}
|
||||
@@ -559,6 +559,138 @@ class Romm:
|
||||
return ok
|
||||
|
||||
|
||||
|
||||
class QBittorrent:
|
||||
"""qBittorrent's own WebAPI makes a category and adds a torrent; the same API proves both
|
||||
survived. The admin password is read from the container's OWN environment - it is the value the
|
||||
deploy handed the app, not a planted one, and it never leaves the container.
|
||||
|
||||
Why a category AND a torrent: the category lives in the config store, the torrent in the resume
|
||||
data (BT_backup/*.fastresume). An upgrade that loses either loses something a household notices.
|
||||
No bytes need to move: a magnet is in the list the moment it is accepted."""
|
||||
port = 8080
|
||||
container = "qbittorrent"
|
||||
# Big Buck Bunny (Blender Foundation, CC BY) - a hash that exists, so nothing here is made up
|
||||
MAGNET = ("magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny")
|
||||
|
||||
def _in(self, args, timeout=60):
|
||||
return _sh(["docker", "exec", self.container, "sh", "-c", args], timeout=timeout)
|
||||
|
||||
def _api(self, path, *curl_extra, body=None):
|
||||
"""One call to the app's own API from inside its container, with its own credentials."""
|
||||
q = " ".join(curl_extra)
|
||||
data = f"--data-binary '{body}'" if body else ""
|
||||
cmd = (
|
||||
'curl -s -c /tmp/fxck -o /dev/null -X POST '
|
||||
'-d "username=admin&password=$QBT_ADMIN_PASSWORD" '
|
||||
'-H "Referer: http://127.0.0.1:8080" http://127.0.0.1:8080/api/v2/auth/login; '
|
||||
f'curl -s -b /tmp/fxck -w "\n%{{http_code}}" -H "Referer: http://127.0.0.1:8080" '
|
||||
f'{q} {data} http://127.0.0.1:8080{path}'
|
||||
)
|
||||
r = self._in(cmd)
|
||||
out = r.stdout or ""
|
||||
body_, _, code = out.rpartition("\n")
|
||||
return r.returncode, code.strip(), body_
|
||||
|
||||
def seed(self, ipfn, say):
|
||||
cat = "felhom" + secrets.token_hex(4)
|
||||
rc, code, out = self._api("/api/v2/torrents/createCategory",
|
||||
f'-d "category={cat}"')
|
||||
say(f" qbittorrent: createCategory {cat} http={code}")
|
||||
if rc != 0 or code != "200":
|
||||
say(f" qbittorrent: the app refused the category ({out[:160]})")
|
||||
return None
|
||||
rc, code, out = self._api("/api/v2/torrents/add",
|
||||
f'-F "urls={self.MAGNET}" -F "category={cat}"')
|
||||
say(f" qbittorrent: torrents/add http={code}")
|
||||
if rc != 0 or code != "200":
|
||||
say(f" qbittorrent: the app refused the torrent ({out[:160]})")
|
||||
return None
|
||||
return {"category": cat, "hash": "dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c"}
|
||||
|
||||
def verify(self, ipfn, seeded, say):
|
||||
rc, code, out = self._api("/api/v2/torrents/categories", "-X GET")
|
||||
if rc != 0 or code != "200":
|
||||
say(f" qbittorrent: the app would not list categories (http={code})")
|
||||
return False
|
||||
# negative control first: a name that was never created must be absent
|
||||
ghost = "felhom" + secrets.token_hex(4)
|
||||
if ghost in out:
|
||||
say(" qbittorrent: READBACK IS UNUSABLE - a category nobody created is present")
|
||||
return False
|
||||
if seeded["category"] not in out:
|
||||
say(f" qbittorrent: the seeded category {seeded['category']} is GONE")
|
||||
return False
|
||||
rc, code, out = self._api("/api/v2/torrents/info", "-X GET")
|
||||
ok = rc == 0 and code == "200" and seeded["hash"] in out
|
||||
say(f" qbittorrent: category kept, torrent present={ok}")
|
||||
return ok
|
||||
|
||||
|
||||
class Transmission:
|
||||
"""Transmission's own RPC sets a distinctive speed limit and adds a torrent; the same RPC proves
|
||||
both survived. The password comes from the container's own PASS variable. The CSRF token
|
||||
(X-Transmission-Session-Id) is taken the way every client takes it: from the 409 the first call
|
||||
answers."""
|
||||
port = 9091
|
||||
container = "transmission"
|
||||
MAGNET = ("magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny")
|
||||
|
||||
def _rpc(self, payload, timeout=60):
|
||||
"""One RPC call, with the payload on STDIN and the session id taken by an anchored sed.
|
||||
|
||||
Measured on the bench 2026-10-12: an `awk "/Session-Id/ {print $2}"` over the headers picks
|
||||
up the header NAME from a later line too, so the id goes out as two values joined and
|
||||
Transmission answers 400 to every call - which reads exactly like "the app has no API"."""
|
||||
script = (
|
||||
'SID=$(curl -s -u "admin:$PASS" -D - -o /dev/null '
|
||||
'http://127.0.0.1:9091/transmission/rpc | tr -d "\\r" '
|
||||
"| sed -n 's/^[Xx]-[Tt]ransmission-[Ss]ession-[Ii]d: //p')\n"
|
||||
'curl -s -u "admin:$PASS" -H "X-Transmission-Session-Id: $SID" '
|
||||
"-w '\\n%{http_code}' -d @- http://127.0.0.1:9091/transmission/rpc <<'FELHOMJSON'\n"
|
||||
+ payload + "\nFELHOMJSON\n"
|
||||
)
|
||||
r = _sh(["docker", "exec", "-i", self.container, "sh", "-s"], timeout=timeout, inp=script)
|
||||
out = r.stdout or ""
|
||||
body, _, code = out.rpartition("\n")
|
||||
return r.returncode, code.strip(), body
|
||||
|
||||
def seed(self, ipfn, say):
|
||||
limit = 300 + secrets.randbelow(600) # a number nothing else would choose
|
||||
rc, code, out = self._rpc('{"method":"session-set","arguments":'
|
||||
'{"speed-limit-down":%d,"speed-limit-down-enabled":true}}' % limit)
|
||||
say(f" transmission: session-set speed-limit-down={limit} http={code}")
|
||||
if rc != 0 or code != "200" or '"success"' not in out:
|
||||
say(f" transmission: the app refused the setting ({out[:160]})")
|
||||
return None
|
||||
rc, code, out = self._rpc('{"method":"torrent-add","arguments":{"filename":"%s"}}' % self.MAGNET)
|
||||
ok = rc == 0 and code == "200" and '"success"' in out
|
||||
say(f" transmission: torrent-add http={code} ok={ok}")
|
||||
if not ok:
|
||||
say(f" transmission: {out[:160]}")
|
||||
return None
|
||||
return {"limit": limit, "hash": "dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c"}
|
||||
|
||||
def verify(self, ipfn, seeded, say):
|
||||
rc, code, out = self._rpc('{"method":"session-get","arguments":'
|
||||
'{"fields":["speed-limit-down","speed-limit-down-enabled"]}}')
|
||||
if rc != 0 or code != "200":
|
||||
say(f" transmission: the app would not answer session-get (http={code})")
|
||||
return False
|
||||
want = '"speed-limit-down":%d' % seeded["limit"]
|
||||
ghost = '"speed-limit-down":%d' % (seeded["limit"] + 1)
|
||||
if ghost in out:
|
||||
say(" transmission: READBACK IS UNUSABLE - the app reports a limit nobody set")
|
||||
return False
|
||||
if want not in out:
|
||||
say(f" transmission: the seeded limit {seeded['limit']} is GONE ({out[:160]})")
|
||||
return False
|
||||
rc, code, out = self._rpc('{"method":"torrent-get","arguments":{"fields":["hashString"]}}')
|
||||
ok = rc == 0 and code == "200" and seeded["hash"] in out
|
||||
say(f" transmission: limit kept, torrent present={ok}")
|
||||
return ok
|
||||
|
||||
|
||||
FIXTURES = {
|
||||
"privatebin": PrivateBin(),
|
||||
"docmost": Docmost(),
|
||||
@@ -568,4 +700,6 @@ FIXTURES = {
|
||||
"audiobookshelf": AudiobookShelf(),
|
||||
"vikunja": Vikunja(),
|
||||
"romm": Romm(),
|
||||
"qbittorrent": QBittorrent(),
|
||||
"transmission": Transmission(),
|
||||
}
|
||||
@@ -29,6 +29,162 @@ def _gx(w, container, *cmd, timeout=240):
|
||||
return w.guest(f"docker exec {container} {line} 2>&1", timeout=timeout)
|
||||
|
||||
|
||||
|
||||
class QBittorrentBox:
|
||||
"""qBittorrent through traefik: a category and a torrent go in with the household's own
|
||||
generated password, and the same API is asked for them back after the update. The negative
|
||||
control is a category name nobody created - if the readback has broken into always saying
|
||||
"found", that is what catches it."""
|
||||
sub = "torrent"
|
||||
|
||||
def _pw(self, w):
|
||||
return (w.GENERATED.get("qbittorrent") or {}).get("QBT_ADMIN_PASSWORD", "")
|
||||
|
||||
def _sid(self, w, sub, say):
|
||||
pw = self._pw(w)
|
||||
if not pw:
|
||||
say(" qbittorrent: this run holds no generated password for the app")
|
||||
return ""
|
||||
hdr = "/tmp/qbt-box-hdr.txt"
|
||||
w.sh(["curl", "-sSk", "--max-time", "25", "-H", f"Host: {sub}.{w.DOMAIN}",
|
||||
"-H", f"Referer: https://{sub}.{w.DOMAIN}", "-D", hdr, "-o", "/dev/null",
|
||||
"--data-urlencode", "username=admin", "--data-urlencode", f"password={pw}",
|
||||
f"{w.BASE}/api/v2/auth/login"])
|
||||
h = (w.sh(["cat", hdr]).stdout or "")
|
||||
# qBittorrent 5.x names the session cookie QBT_SID_<webui port>, not SID (measured on
|
||||
# 9202, 2026-10-12: "set-cookie: QBT_SID_8080=..."). Match either, and carry the whole
|
||||
# name=value pair back - the name is part of the cookie.
|
||||
m = re.search(r"((?:QBT_SID_[0-9]+|SID)=[A-Za-z0-9+/=._%-]+)", h)
|
||||
if not m:
|
||||
# say WHAT came back: a readback that fails silently is the thing this harness exists
|
||||
# to avoid, and a missing cookie has several possible causes
|
||||
first = " | ".join(l.strip() for l in h.splitlines()[:6] if l.strip())
|
||||
say(" qbittorrent: no session cookie in the response (%s)" % (first[:300] or "no headers at all"))
|
||||
return m.group(1) if m else ""
|
||||
|
||||
def _api(self, w, sub, sid, path, *extra, method=None):
|
||||
args = ["curl", "-sSk", "--max-time", "40", "-H", f"Host: {sub}.{w.DOMAIN}",
|
||||
"-H", f"Referer: https://{sub}.{w.DOMAIN}", "-H", f"Cookie: {sid}",
|
||||
"-w", "\n%{http_code}"]
|
||||
if method:
|
||||
args += ["-X", method]
|
||||
args += list(extra) + [f"{w.BASE}{path}"]
|
||||
r = w.sh(args)
|
||||
body, _, code = (r.stdout or "").rpartition("\n")
|
||||
return code.strip(), body
|
||||
|
||||
def seed(self, w, sub, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "401", "403")):
|
||||
return None
|
||||
sid = self._sid(w, sub, say)
|
||||
if not sid:
|
||||
return None
|
||||
cat = "felhom" + secrets.token_hex(4)
|
||||
code, out = self._api(w, sub, sid, "/api/v2/torrents/createCategory",
|
||||
"--data-urlencode", f"category={cat}", method="POST")
|
||||
say(f" qbittorrent: createCategory {cat} http={code}")
|
||||
if code != "200":
|
||||
say(f" qbittorrent: refused {out[:160]}")
|
||||
return None
|
||||
magnet = ("magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c"
|
||||
"&dn=Big+Buck+Bunny")
|
||||
code, out = self._api(w, sub, sid, "/api/v2/torrents/add",
|
||||
"-F", f"urls={magnet}", "-F", f"category={cat}", method="POST")
|
||||
say(f" qbittorrent: torrents/add http={code}")
|
||||
if code != "200":
|
||||
return None
|
||||
return {"category": cat, "hash": "dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c"}
|
||||
|
||||
def verify(self, w, sub, t, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "401", "403"), tries=36):
|
||||
return False
|
||||
sid = self._sid(w, sub, say)
|
||||
if not sid:
|
||||
return False
|
||||
code, out = self._api(w, sub, sid, "/api/v2/torrents/categories")
|
||||
if code != "200":
|
||||
say(f" qbittorrent: categories http={code}")
|
||||
return False
|
||||
ghost = "felhom" + secrets.token_hex(4)
|
||||
if ghost in out:
|
||||
say(" qbittorrent: READBACK UNUSABLE - a category nobody created is present")
|
||||
return False
|
||||
if t["category"] not in out:
|
||||
say(f" qbittorrent: the seeded category {t['category']} is GONE")
|
||||
return False
|
||||
code, out = self._api(w, sub, sid, "/api/v2/torrents/info")
|
||||
ok = code == "200" and t["hash"] in out
|
||||
say(f" qbittorrent: category kept, torrent present={ok}")
|
||||
return ok
|
||||
|
||||
|
||||
class TransmissionBox:
|
||||
"""Transmission through traefik: a distinctive speed limit and a torrent go in over its RPC with
|
||||
the household's own generated password, and the same RPC is asked for them back. The session id
|
||||
comes from the 409 the first call answers, taken with an anchored sed - an awk over the headers
|
||||
picks the header NAME up too and the app then answers 400 to everything (measured on the bench,
|
||||
2026-10-12)."""
|
||||
sub = "transmission"
|
||||
|
||||
def _pw(self, w):
|
||||
return (w.GENERATED.get("transmission") or {}).get("TR_ADMIN_PASSWORD", "")
|
||||
|
||||
def _rpc(self, w, sub, payload, say):
|
||||
pw = self._pw(w)
|
||||
if not pw:
|
||||
say(" transmission: this run holds no generated password for the app")
|
||||
return "", ""
|
||||
hdr = "/tmp/tr-box-hdr.txt"
|
||||
w.sh(["curl", "-sSk", "--max-time", "25", "-H", f"Host: {sub}.{w.DOMAIN}",
|
||||
"-u", f"admin:{pw}", "-D", hdr, "-o", "/dev/null",
|
||||
f"{w.BASE}/transmission/rpc"])
|
||||
h = (w.sh(["cat", hdr]).stdout or "")
|
||||
m = re.search(r"(?im)^X-Transmission-Session-Id:\s*(\S+)", h)
|
||||
sid = m.group(1) if m else ""
|
||||
r = w.sh(["curl", "-sSk", "--max-time", "40", "-H", f"Host: {sub}.{w.DOMAIN}",
|
||||
"-u", f"admin:{pw}", "-H", f"X-Transmission-Session-Id: {sid}",
|
||||
"-w", "\n%{http_code}", "--data-binary", payload,
|
||||
f"{w.BASE}/transmission/rpc"])
|
||||
body, _, code = (r.stdout or "").rpartition("\n")
|
||||
return code.strip(), body
|
||||
|
||||
def seed(self, w, sub, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "401", "409")):
|
||||
return None
|
||||
limit = 300 + secrets.randbelow(600)
|
||||
code, out = self._rpc(w, sub, '{"method":"session-set","arguments":'
|
||||
'{"speed-limit-down":%d,"speed-limit-down-enabled":true}}' % limit, say)
|
||||
say(f" transmission: session-set speed-limit-down={limit} http={code}")
|
||||
if code != "200" or '"success"' not in out:
|
||||
say(f" transmission: refused {out[:160]}")
|
||||
return None
|
||||
magnet = ("magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c"
|
||||
"&dn=Big+Buck+Bunny")
|
||||
code, out = self._rpc(w, sub, '{"method":"torrent-add","arguments":{"filename":"%s"}}' % magnet, say)
|
||||
ok = code == "200" and '"success"' in out
|
||||
say(f" transmission: torrent-add http={code} ok={ok}")
|
||||
return {"limit": limit, "hash": "dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c"} if ok else None
|
||||
|
||||
def verify(self, w, sub, t, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "401", "409"), tries=36):
|
||||
return False
|
||||
code, out = self._rpc(w, sub, '{"method":"session-get","arguments":'
|
||||
'{"fields":["speed-limit-down","speed-limit-down-enabled"]}}', say)
|
||||
if code != "200":
|
||||
say(f" transmission: session-get http={code}")
|
||||
return False
|
||||
if ('"speed-limit-down":%d' % (t["limit"] + 1)) in out:
|
||||
say(" transmission: READBACK UNUSABLE - the app reports a limit nobody set")
|
||||
return False
|
||||
if ('"speed-limit-down":%d' % t["limit"]) not in out:
|
||||
say(f" transmission: the seeded limit {t['limit']} is GONE")
|
||||
return False
|
||||
code, out = self._rpc(w, sub, '{"method":"torrent-get","arguments":{"fields":["hashString"]}}', say)
|
||||
ok = code == "200" and t["hash"] in out
|
||||
say(f" transmission: limit kept, torrent present={ok}")
|
||||
return ok
|
||||
|
||||
|
||||
# =============================================================================================
|
||||
class PrivateBin:
|
||||
"""PrivateBin's own JSON API. A paste is a POST and reading it back is a GET — an
|
||||
@@ -2703,4 +2859,6 @@ FIXTURES = {
|
||||
"grimmory": Grimmory(),
|
||||
"grocy": Grocy(),
|
||||
"lubelogger": LubeLogger(),
|
||||
"qbittorrent": QBittorrentBox(),
|
||||
"transmission": TransmissionBox(),
|
||||
}
|
||||
Reference in new issue
Block a user