SABnzbd and NZBGet: the Usenet pair, each with its complete record (R-988)
gates / gates (push) Successful in 4s
gates / gates (push) Successful in 4s
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. - sabnzbd version-5.1.3 (lscr.io/linuxserver — the project publishes no image; the second third-party publisher here after transmission), 96M/1024M, usenet.<domain> - nzbget v26.3 (the project's own image), 64M/512M, nzbget.<domain> - a PAID Usenet provider is the household's own: both app pages say so before the install, and neither record claims the download chain was measured, because without a provider it cannot be - first admin class 1 in both; SABnzbd ships with NO login at all and its inet_exposure asks nobody to log in until local_ranges stops the proxy's address counting as local - nine defects found by measuring and fixed before publication (CHANGELOG has each one) - ladders written by upgrade-test.py --write-ladder, both venues proven, C3 failed first - 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
cb4ececf1f
commit
8ee687e544
13 files changed
+1287
-39
No files matched your search
@@ -768,6 +768,32 @@
|
||||
"deploy_fields[SUBDOMAIN].label": "Aldomain",
|
||||
"description": "Saját felhő tárhely - Google Drive/Dropbox alternatíva"
|
||||
},
|
||||
"nzbget": {
|
||||
"app_info.default_creds": "admin / (telepítéskor generált jelszó)",
|
||||
"app_info.first_steps[0]": "Nyisd meg az nzbget.DOMAIN címet, és lépj be az admin névvel és a telepítéskor kapott jelszóval",
|
||||
"app_info.first_steps[1]": "Add meg a Usenet szolgáltatód adatait a Settings / News-Servers oldalon (szerver, port, felhasználónév, jelszó). Enélkül a letöltés nem indul el",
|
||||
"app_info.first_steps[2]": "A kész letöltések a meghajtódon, a media/nzbget/completed mappába kerülnek",
|
||||
"app_info.first_steps[3]": "Csak olyan tartalmat tölts le, amihez jogod van",
|
||||
"app_info.prerequisites[0]": "FIZETŐS USENET SZOLGÁLTATÁS KELL hozzá, amit neked kell hoznod: a tartalom a szolgáltató szerverein van, és az elérése előfizetés. Enélkül az alkalmazás elindul és bejelentkezni is tudsz, de letölteni nem",
|
||||
"app_info.prerequisites[1]": "NZB fájlokat vagy indexelő szolgáltatást is te adsz hozzá - ezeket sem tartalmazza az alkalmazás",
|
||||
"app_info.prerequisites[2]": "Befelé irányuló portot nem igényel: a Usenet letöltés kizárólag kimenő kapcsolatokat használ, így a doboz zárt portjai itt semmit nem vesznek el",
|
||||
"app_info.tagline": "Usenet letöltés egyszerűen, alig észrevehető erőforrásból",
|
||||
"app_info.use_cases[0]": "NZB fájlok letöltése a saját meghajtódra, a letöltés utáni kicsomagolással és javítással együtt",
|
||||
"app_info.use_cases[1]": "A Radarr, a Sonarr és a Jellyseerr ide adhatja le a munkát: ez a Usenet oldali letöltő",
|
||||
"app_info.use_cases[2]": "A kész fájlokat a fájlböngészőben és a médialejátszódban is látod",
|
||||
"app_info.use_cases[3]": "Nagyon keveset fogyaszt: kisebb gépen is elfér a többi alkalmazás mellett. Ha a teljes felületet szeretnéd, a SABnzbd az erősebb választás",
|
||||
"data_paths[media/nzbget].label": "Letöltések (NZBGet)",
|
||||
"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[NZB_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[NZB_ADMIN_PASSWORD].label": "Belépési jelszó",
|
||||
"deploy_fields[SUBDOMAIN].description": "Az alkalmazás aldomainje",
|
||||
"deploy_fields[SUBDOMAIN].label": "Aldomain",
|
||||
"description": "Usenet letöltő, nagyon kevés erőforrásból"
|
||||
},
|
||||
"onlyoffice": {
|
||||
"app_info.first_steps[0]": "Nyisd meg az office.DOMAIN címet a böngészőben",
|
||||
"app_info.first_steps[1]": "Várj amíg az inicializálás befejeződik (1-2 perc)",
|
||||
@@ -1102,6 +1128,34 @@
|
||||
"optional_config[Metaadat-szolgáltatók].fields[STEAMGRIDDB_API_KEY].label": "SteamGridDB API Key",
|
||||
"optional_config[Metaadat-szolgáltatók].group": "Metaadat-szolgáltatók"
|
||||
},
|
||||
"sabnzbd": {
|
||||
"app_info.default_creds": "admin / (telepítéskor generált jelszó)",
|
||||
"app_info.first_steps[0]": "Nyisd meg az usenet.DOMAIN címet, és lépj be az admin névvel és a telepítéskor kapott jelszóval",
|
||||
"app_info.first_steps[1]": "Add meg a Usenet szolgáltatód adatait a Beállítások / Szerverek oldalon (szerver, port, felhasználónév, jelszó). Enélkül a letöltés nem indul el",
|
||||
"app_info.first_steps[2]": "A kész letöltések a meghajtódon, a media/usenet/complete mappába kerülnek",
|
||||
"app_info.first_steps[3]": "Csak olyan tartalmat tölts le, amihez jogod van",
|
||||
"app_info.prerequisites[0]": "FIZETŐS USENET SZOLGÁLTATÁS KELL hozzá, amit neked kell hoznod: a tartalom a szolgáltató szerverein van, és az elérése előfizetés. Enélkül az alkalmazás elindul és bejelentkezni is tudsz, de letölteni nem",
|
||||
"app_info.prerequisites[1]": "NZB fájlokat vagy indexelő szolgáltatást is te adsz hozzá - ezeket sem tartalmazza az alkalmazás",
|
||||
"app_info.prerequisites[2]": "Befelé irányuló portot nem igényel: a Usenet letöltés kizárólag kimenő kapcsolatokat használ, így a doboz zárt portjai itt semmit nem vesznek el",
|
||||
"app_info.tagline": "Usenet letöltés teljes felülettel: sorok, kategóriák, automatikus kicsomagolás",
|
||||
"app_info.use_cases[0]": "NZB fájlok letöltése a saját meghajtódra, a letöltés utáni kicsomagolással és javítással együtt",
|
||||
"app_info.use_cases[1]": "A Radarr, a Sonarr és a Jellyseerr ide adhatja le a munkát: ez a Usenet oldali letöltő",
|
||||
"app_info.use_cases[2]": "A kész fájlokat a fájlböngészőben és a médialejátszódban is látod",
|
||||
"app_info.use_cases[3]": "Ha egyszerűbb felületet és még kisebb fogyasztást szeretnél, az NZBGet a másik választás",
|
||||
"data_paths[media/usenet].label": "Letöltések (SABnzbd)",
|
||||
"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[SAB_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[SAB_ADMIN_PASSWORD].label": "Belépési jelszó",
|
||||
"deploy_fields[SAB_API_KEY].description": "Ezzel a kulccsal kapcsolódnak hozzá a letöltést kérő alkalmazások (Radarr, Sonarr, Jellyseerr). A telepítéskor készül; az alkalmazás beállításaiban megtalálod.",
|
||||
"deploy_fields[SAB_API_KEY].label": "API kulcs",
|
||||
"deploy_fields[SUBDOMAIN].description": "Az alkalmazás aldomainje",
|
||||
"deploy_fields[SUBDOMAIN].label": "Aldomain",
|
||||
"description": "Usenet letöltő teljes felülettel"
|
||||
},
|
||||
"seerr": {
|
||||
"app_info.first_steps[0]": "Nyisd meg a requests.DOMAIN címet a böngészőben",
|
||||
"app_info.first_steps[1]": "Kövesd a beállítás varázslót",
|
||||
@@ -1381,9 +1435,11 @@
|
||||
"lubelogger": "New app 2026-10-10 (NEW-APP-CHECKLIST.md): the Hungarian was written for this template and reviewed with the onboarding record; add_people was corrected to the route measured on 9202; every string has its English twin.",
|
||||
"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)",
|
||||
"nzbget": "Usenet downloader, the light client of the pair (R-988); Hungarian written 2026-10-12 and reviewed in this session",
|
||||
"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)'",
|
||||
"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",
|
||||
"sabnzbd": "Usenet downloader, the full client of the pair the operator asked for (R-988); Hungarian written 2026-10-12 and reviewed in this session",
|
||||
"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."
|
||||
}
|
||||
}
|
||||
@@ -691,6 +691,167 @@ class Transmission:
|
||||
return ok
|
||||
|
||||
|
||||
# The NZB both Usenet fixtures seed with. It names articles that do not exist, which is exactly
|
||||
# right: without a paid provider nothing can be fetched anyway, and what the fixture is measuring is
|
||||
# the QUEUE - the store an upgrade must not lose. Nothing here downloads a byte.
|
||||
FELHOM_NZB = (
|
||||
'<?xml version="1.0" encoding="iso-8859-1" ?>\n'
|
||||
'<nzb xmlns="http://www.newzbin.com/DTD/2003/nzb">\n'
|
||||
'<head><meta type="title">%(name)s</meta></head>\n'
|
||||
'<file poster="felhom@example.invalid" date="1760000000" '
|
||||
'subject="%(name)s [1/1] - "%(name)s.bin" yEnc (1/1)">\n'
|
||||
'<groups><group>alt.binaries.test</group></groups>\n'
|
||||
'<segments><segment bytes="1024" number="1">%(name)s-1@example.invalid</segment></segments>\n'
|
||||
'</file>\n</nzb>\n'
|
||||
)
|
||||
|
||||
|
||||
class SABnzbd:
|
||||
"""SABnzbd's own API queues an NZB and creates a category; the same API proves both survived.
|
||||
|
||||
Two stores, because they are different files: the queue index lives in /config/admin
|
||||
(queue10.sab, history1.db) and the category in sabnzbd.ini. An upgrade that loses either loses
|
||||
something the household set. The API key is read from the container's OWN environment - it is
|
||||
the value the deploy handed the app.
|
||||
|
||||
No Usenet provider is configured and none is needed: the job sits in the queue unfetchable,
|
||||
which is what is being measured. What CANNOT be measured this way, and is not claimed anywhere,
|
||||
is the download chain itself (connect, par2 repair, unpack)."""
|
||||
port = 8080
|
||||
container = "sabnzbd"
|
||||
|
||||
def _api(self, query, timeout=60, extra=""):
|
||||
"""One call to the app's own API from inside its container, with its own key."""
|
||||
cmd = ('curl -s -w "\\n%{http_code}" ' + extra +
|
||||
' "http://127.0.0.1:8080/api?output=json&apikey=$SAB_API_KEY&' + query + '"')
|
||||
r = _sh(["docker", "exec", self.container, "sh", "-c", cmd], timeout=timeout)
|
||||
out = r.stdout or ""
|
||||
body_, _, code = out.rpartition("\n")
|
||||
return r.returncode, code.strip(), body_
|
||||
|
||||
def seed(self, ipfn, say):
|
||||
name = "felhom" + secrets.token_hex(4)
|
||||
# the NZB goes in through the app's own upload endpoint, written inside the container
|
||||
script = ("cat > /tmp/%s.nzb <<'FELHOMNZB'\n%s\nFELHOMNZB\n"
|
||||
% (name, FELHOM_NZB % {"name": name}))
|
||||
script += ('curl -s -w "\\n%{http_code}" -F "name=@/tmp/' + name + '.nzb" '
|
||||
'-F "nzbname=' + name + '" '
|
||||
'"http://127.0.0.1:8080/api?mode=addfile&output=json&apikey=$SAB_API_KEY"' + "\n")
|
||||
r = _sh(["docker", "exec", "-i", self.container, "sh", "-s"], timeout=90, inp=script)
|
||||
out = (r.stdout or "")
|
||||
body_, _, code = out.rpartition("\n")
|
||||
ok = r.returncode == 0 and code.strip() == "200" and '"status": true' in body_.replace('"status":true', '"status": true')
|
||||
say(f" sabnzbd: addfile {name} http={code.strip()} ok={ok}")
|
||||
if not ok:
|
||||
say(f" sabnzbd: the app refused the NZB ({body_[:160]})")
|
||||
return None
|
||||
rc, code, out = self._api("mode=set_config§ion=categories&keyword=%s&name=%s&dir=%s"
|
||||
% (name, name, name))
|
||||
if rc != 0 or code != "200":
|
||||
say(f" sabnzbd: the app refused the category (http={code}, {out[:160]})")
|
||||
return None
|
||||
say(f" sabnzbd: category {name} created")
|
||||
return {"name": name}
|
||||
|
||||
def verify(self, ipfn, seeded, say):
|
||||
name = seeded["name"]
|
||||
rc, code, out = self._api("mode=queue")
|
||||
if rc != 0 or code != "200":
|
||||
say(f" sabnzbd: the app would not answer mode=queue (http={code})")
|
||||
return False
|
||||
ghost = "felhom" + secrets.token_hex(4)
|
||||
if ghost in out:
|
||||
say(" sabnzbd: READBACK IS UNUSABLE - a job nobody queued is present")
|
||||
return False
|
||||
if name not in out:
|
||||
say(f" sabnzbd: the queued job {name} is GONE ({out[:200]})")
|
||||
return False
|
||||
rc, code, out = self._api("mode=get_config§ion=categories")
|
||||
ok = rc == 0 and code == "200" and name in out
|
||||
say(f" sabnzbd: job kept, category present={ok}")
|
||||
return ok
|
||||
|
||||
|
||||
class NZBGet:
|
||||
"""NZBGet's own JSON-RPC queues an NZB (paused) and the same RPC proves it survived.
|
||||
|
||||
The queue lives in the config volume because this template moves MainDir there - the app ships
|
||||
with MainDir=/downloads, which would put the queue on the household's drive, the one place the
|
||||
backup classification calls "optional, fetchable again" (measured on the bench 2026-10-12).
|
||||
|
||||
THE CALLS COME FROM THE HARNESS HOST, at the container's own IP. This image carries no curl -
|
||||
only busybox wget, python3 and openssl - so a call from inside produced nothing and the harness
|
||||
read that as "no seed route", twice, before this was measured. The password is still the app's
|
||||
own: read out of the container's environment with printenv, which busybox does have.
|
||||
|
||||
No Usenet provider is configured and none is needed; the download chain itself is therefore NOT
|
||||
measured, and no record claims it is."""
|
||||
port = 6789
|
||||
container = "nzbget"
|
||||
|
||||
def _pw(self):
|
||||
r = _sh(["docker", "exec", self.container, "printenv", "NZBGET_PASS"], timeout=30)
|
||||
return (r.stdout or "").strip()
|
||||
|
||||
def _base(self, ipfn):
|
||||
ip = ipfn(self.container)
|
||||
return f"http://{ip}:{self.port}" if ip else ""
|
||||
|
||||
def _rpc(self, base, pw, payload=None, path="", timeout=60):
|
||||
url = f"{base}/jsonrpc" + (f"/{path}" if path else "")
|
||||
extra = ["-u", f"admin:{pw}"]
|
||||
if payload is not None:
|
||||
extra += ["-H", "Content-Type: application/json"]
|
||||
return _curl(url, *extra, data=payload, timeout=timeout)
|
||||
|
||||
def seed(self, ipfn, say):
|
||||
base, pw = self._base(ipfn), self._pw()
|
||||
if not base or not pw:
|
||||
say(f" nzbget: no container IP ({bool(base)}) or no password in its environment ({bool(pw)})")
|
||||
return None
|
||||
if not _wait_http(base + "/", {"200", "401"}, say=say):
|
||||
return None
|
||||
name = "felhom" + secrets.token_hex(4)
|
||||
nzb = FELHOM_NZB % {"name": name}
|
||||
payload = json.dumps({"method": "append",
|
||||
"params": [name + ".nzb", base64.b64encode(nzb.encode()).decode(), "",
|
||||
0, False, True, "", 0, "SCORE", []],
|
||||
"id": 1})
|
||||
rc, code, out = self._rpc(base, pw, payload=payload)
|
||||
# the app answers the new NZBID on success and -1 on failure
|
||||
ok = rc == 0 and code == "200" and '"result" : -1' not in out and '"result":-1' not in out
|
||||
say(f" nzbget: append {name} http={code} ok={ok}")
|
||||
if not ok:
|
||||
say(f" nzbget: the app refused the NZB ({out[:200]})")
|
||||
return None
|
||||
return {"name": name}
|
||||
|
||||
def verify(self, ipfn, seeded, say):
|
||||
base, pw = self._base(ipfn), self._pw()
|
||||
if not base or not pw:
|
||||
say(" nzbget: the app's IP or password is not readable after the step")
|
||||
return False
|
||||
if not _wait_http(base + "/", {"200", "401"}, say=say):
|
||||
return False
|
||||
name = seeded["name"]
|
||||
rc, code, out = self._rpc(base, pw, path="listgroups")
|
||||
if rc != 0 or code != "200":
|
||||
say(f" nzbget: the app would not answer listgroups (http={code})")
|
||||
return False
|
||||
ghost = "felhom" + secrets.token_hex(4)
|
||||
if ghost in out:
|
||||
say(" nzbget: READBACK IS UNUSABLE - a job nobody queued is present")
|
||||
return False
|
||||
if name not in out:
|
||||
say(f" nzbget: the queued job {name} is GONE ({out[:200]})")
|
||||
return False
|
||||
# and the nzb file the app saved for it, in the config volume this template moved it to
|
||||
r = _sh(["docker", "exec", self.container, "sh", "-c", "ls /config/data/nzb"], timeout=30)
|
||||
kept = name in (r.stdout or "")
|
||||
say(f" nzbget: the queued job is present, its saved nzb file present={kept}")
|
||||
return True
|
||||
|
||||
|
||||
FIXTURES = {
|
||||
"privatebin": PrivateBin(),
|
||||
"docmost": Docmost(),
|
||||
@@ -702,4 +863,6 @@ FIXTURES = {
|
||||
"romm": Romm(),
|
||||
"qbittorrent": QBittorrent(),
|
||||
"transmission": Transmission(),
|
||||
"sabnzbd": SABnzbd(),
|
||||
"nzbget": NZBGet(),
|
||||
}
|
||||
@@ -2816,6 +2816,166 @@ class MeTube:
|
||||
return code == "200" and in_hist
|
||||
|
||||
|
||||
# The NZB both Usenet box fixtures seed with: article names that do not exist, because without a
|
||||
# paid provider nothing can be fetched anyway and what is being measured is the QUEUE.
|
||||
BOX_NZB = (
|
||||
'<?xml version="1.0" encoding="iso-8859-1" ?>\n'
|
||||
'<nzb xmlns="http://www.newzbin.com/DTD/2003/nzb">\n'
|
||||
'<head><meta type="title">%(name)s</meta></head>\n'
|
||||
'<file poster="felhom@example.invalid" date="1760000000" '
|
||||
'subject="%(name)s [1/1] - "%(name)s.bin" yEnc (1/1)">\n'
|
||||
'<groups><group>alt.binaries.test</group></groups>\n'
|
||||
'<segments><segment bytes="1024" number="1">%(name)s-1@example.invalid</segment></segments>\n'
|
||||
'</file>\n</nzb>\n'
|
||||
)
|
||||
|
||||
|
||||
class SABnzbdBox:
|
||||
"""SABnzbd through traefik, with the household's own generated API key.
|
||||
|
||||
The web UI is session-based and requires a login for every proxied visitor (this template sets
|
||||
local_ranges so that nothing a proxy presents counts as local), but the API authenticates with
|
||||
the key - which is the route Radarr and Sonarr use, so it is the route the fixture uses too.
|
||||
Both stores are seeded: a queued job (the queue index, /config/admin/queue10.sab) and a category
|
||||
(sabnzbd.ini)."""
|
||||
sub = "usenet"
|
||||
|
||||
def _key(self, w):
|
||||
"""The key the household was given. `walk.GENERATED` does not hold it - deploy_values skips
|
||||
an OPTIONAL `type: secret` field, because the controller generates those itself - so the box
|
||||
is asked for the value out of the app's own app.yaml, which is where the household reads it
|
||||
too (measured on 9202, 2026-10-12: the first run had no key and could not seed)."""
|
||||
k = (w.GENERATED.get("sabnzbd") or {}).get("SAB_API_KEY", "")
|
||||
if k:
|
||||
return k
|
||||
# app.yaml stores a deploy secret ENCRYPTED (`SAB_API_KEY: ENC:...`), so app_env returns
|
||||
# ciphertext and the app answers "API Key Incorrect" (measured on 9202, 2026-10-12). The
|
||||
# value the APP holds is in its own environment - the same place the bench fixture reads it.
|
||||
return w.guest("docker exec sabnzbd printenv SAB_API_KEY").strip()
|
||||
|
||||
def _pw(self, w):
|
||||
p = (w.GENERATED.get("sabnzbd") or {}).get("SAB_ADMIN_PASSWORD", "")
|
||||
return p or w.guest("docker exec sabnzbd printenv SAB_ADMIN_PASSWORD").strip()
|
||||
|
||||
def _api(self, w, sub, query, say, extra=None):
|
||||
key = self._key(w)
|
||||
if not key:
|
||||
say(" sabnzbd: this run holds no generated API key for the app")
|
||||
return "", ""
|
||||
args = ["curl", "-sSk", "--max-time", "40", "-H", f"Host: {sub}.{w.DOMAIN}",
|
||||
"-w", "\n%{http_code}"]
|
||||
if extra:
|
||||
args += extra
|
||||
args.append(f"{w.BASE}/api?output=json&apikey={key}&{query}")
|
||||
r = w.sh(args)
|
||||
out, _, code = (r.stdout or "").rpartition("\n")
|
||||
return code.strip(), out
|
||||
|
||||
def seed(self, w, sub, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "303", "401", "403")):
|
||||
return None
|
||||
name = "felhom" + secrets.token_hex(4)
|
||||
# the NZB is written on the harness host and posted through the front door
|
||||
path = os.path.join(w.SC, name + ".nzb")
|
||||
with open(path, "w") as f:
|
||||
f.write(BOX_NZB % {"name": name})
|
||||
code, out = self._api(w, sub, "mode=addfile", say,
|
||||
extra=["-F", f"name=@{path}", "-F", f"nzbname={name}"])
|
||||
ok = code == "200" and '"status"' in out and "true" in out
|
||||
say(f" sabnzbd: addfile {name} http={code} ok={ok}")
|
||||
if not ok:
|
||||
say(f" sabnzbd: refused {out[:200]}")
|
||||
return None
|
||||
code, out = self._api(w, sub,
|
||||
f"mode=set_config§ion=categories&keyword={name}&name={name}&dir={name}", say)
|
||||
if code != "200":
|
||||
say(f" sabnzbd: the category was refused (http={code}) {out[:160]}")
|
||||
return None
|
||||
say(f" sabnzbd: category {name} created")
|
||||
return {"name": name}
|
||||
|
||||
def verify(self, w, sub, t, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "303", "401", "403"), tries=36):
|
||||
return False
|
||||
code, out = self._api(w, sub, "mode=queue", say)
|
||||
if code != "200":
|
||||
say(f" sabnzbd: mode=queue http={code}")
|
||||
return False
|
||||
ghost = "felhom" + secrets.token_hex(4)
|
||||
if ghost in out:
|
||||
say(" sabnzbd: READBACK UNUSABLE - a job nobody queued is present")
|
||||
return False
|
||||
if t["name"] not in out:
|
||||
say(f" sabnzbd: the queued job {t['name']} is GONE")
|
||||
return False
|
||||
code, out = self._api(w, sub, "mode=get_config§ion=categories", say)
|
||||
ok = code == "200" and t["name"] in out
|
||||
say(f" sabnzbd: job kept, category present={ok}")
|
||||
return ok
|
||||
|
||||
|
||||
class NZBGetBox:
|
||||
"""NZBGet through traefik, with the household's own generated password over Basic auth.
|
||||
|
||||
One store, and it is the one that matters: the queue, which this template keeps in the config
|
||||
volume (the app ships it on the drive, which the backup classification calls optional)."""
|
||||
sub = "nzbget"
|
||||
|
||||
def _pw(self, w):
|
||||
p = (w.GENERATED.get("nzbget") or {}).get("NZB_ADMIN_PASSWORD", "")
|
||||
# app.yaml keeps deploy secrets encrypted, so the app's own environment is the source
|
||||
return p or w.guest("docker exec nzbget printenv NZBGET_PASS").strip()
|
||||
|
||||
def _rpc(self, w, sub, say, payload_file=None, path=""):
|
||||
pw = self._pw(w)
|
||||
if not pw:
|
||||
say(" nzbget: this run holds no generated password for the app")
|
||||
return "", ""
|
||||
args = ["curl", "-sSk", "--max-time", "40", "-H", f"Host: {sub}.{w.DOMAIN}",
|
||||
"-u", f"admin:{pw}", "-w", "\n%{http_code}"]
|
||||
if payload_file:
|
||||
args += ["-H", "Content-Type: application/json", "--data", "@" + payload_file]
|
||||
args.append(f"{w.BASE}/jsonrpc/{path}")
|
||||
r = w.sh(args)
|
||||
out, _, code = (r.stdout or "").rpartition("\n")
|
||||
return code.strip(), out
|
||||
|
||||
def seed(self, w, sub, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "401")):
|
||||
return None
|
||||
name = "felhom" + secrets.token_hex(4)
|
||||
nzb = (BOX_NZB % {"name": name}).encode()
|
||||
payload = json.dumps({"method": "append",
|
||||
"params": [name + ".nzb", base64.b64encode(nzb).decode(), "",
|
||||
0, False, True, "", 0, "SCORE", []],
|
||||
"id": 1})
|
||||
pf = os.path.join(w.SC, name + ".json")
|
||||
with open(pf, "w") as f:
|
||||
f.write(payload)
|
||||
code, out = self._rpc(w, sub, say, payload_file=pf)
|
||||
ok = code == "200" and '"result" : -1' not in out and '"result":-1' not in out
|
||||
say(f" nzbget: append {name} http={code} ok={ok}")
|
||||
if not ok:
|
||||
say(f" nzbget: refused {out[:200]}")
|
||||
return None
|
||||
return {"name": name}
|
||||
|
||||
def verify(self, w, sub, t, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "401"), tries=36):
|
||||
return False
|
||||
code, out = self._rpc(w, sub, say, path="listgroups")
|
||||
if code != "200":
|
||||
say(f" nzbget: listgroups http={code}")
|
||||
return False
|
||||
ghost = "felhom" + secrets.token_hex(4)
|
||||
if ghost in out:
|
||||
say(" nzbget: READBACK UNUSABLE - a job nobody queued is present")
|
||||
return False
|
||||
ok = t["name"] in out
|
||||
say(f" nzbget: the queued job is present={ok}")
|
||||
return ok
|
||||
|
||||
|
||||
FIXTURES = {
|
||||
"uptime-kuma": UptimeKuma(),
|
||||
"crafty-controller": Crafty(),
|
||||
@@ -2861,4 +3021,6 @@ FIXTURES = {
|
||||
"lubelogger": LubeLogger(),
|
||||
"qbittorrent": QBittorrentBox(),
|
||||
"transmission": TransmissionBox(),
|
||||
"sabnzbd": SABnzbdBox(),
|
||||
"nzbget": NZBGetBox(),
|
||||
}
|
||||
Reference in new issue
Block a user