# After the gate opened: a STRANGER retries each app's own first-admin / sign-up call (no cookies). Refused = the # app itself closes it; 2xx = open sign-up (decision 47 needs a block). import sys, secrets sys.path.insert(0, '.') import ro from ro import w, host from browser import Browser T = { "actualbudget": ("POST", "/account/bootstrap", {"password": "x" + secrets.token_hex(6)}, None), "komga": ("POST", "/api/v1/claim", None, {"X-Komga-Email": "s@x.hu", "X-Komga-Password": "x" + secrets.token_hex(6)}), "jellyfin": ("POST", "/Startup/User", {"Name": "stranger", "Password": "x" + secrets.token_hex(6)}, None), "emby": ("POST", "/emby/Startup/User", {"Name": "stranger", "Password": "x" + secrets.token_hex(6)}, None), "navidrome": ("POST", "/auth/createAdmin", {"username": "stranger", "password": "x" + secrets.token_hex(6)}, None), "ghost": ("POST", "/ghost/api/admin/authentication/setup/", {"setup": [{"name": "S", "email": "s@x.hu", "password": "Xx" + secrets.token_hex(8), "blogTitle": "S"}]}, {"Origin": "https://r-ghost.enkisfelhom.hu"}), "home-assistant": ("POST", "/api/onboarding/users", {"client_id": "https://r-home-assistant.enkisfelhom.hu/", "name": "S", "username": "stranger", "password": "x" + secrets.token_hex(6), "language": "en"}, None), "romm": ("POST", "/api/users", {"username": "stranger", "password": "x" + secrets.token_hex(6), "email": "s@x.hu", "role": "viewer"}, None), } w.login() for app in sys.argv[1:]: m, p, body, hd = T[app] s = Browser("stranger") if app == "romm": s.req(f"https://{host(app)}/api/heartbeat", accept="application/json") hd = {"X-CSRFToken": s.jar.get(host(app), {}).get("romm_csrftoken", "")} st, text, _ = s.req(f"https://{host(app)}{p}", m, body=body, accept="application/json", headers=hd) w.say(app, f"STRANGER retries {m} {p} after the setup -> {st} {text[:70]!r}")