bank: account QR encodes payto (was wrong webui homepage)

Was broken: after Create my bank account the QR encoded only
https://bank.hacktivism.ch/webui/, not the new account. Also payto
wrongly forced :443 while libeufin issues host without port.

Now: prefer bank internal_payto_uri; QR + blue link = payto:// of
the account; webui stays a separate login button.
This commit is contained in:
Hernâni Marques 2026-07-10 23:12:00 +02:00
parent 2fb060f79a
commit d391b42c52
No known key found for this signature in database
3 changed files with 62 additions and 40 deletions

View file

@ -189,29 +189,31 @@ except Exception as e:
if not d.get("ok"):
print("ok!=true")
sys.exit(1)
payto = d.get("payto_uri") or ""
payto = d.get("payto_uri") or d.get("qr_payload") or ""
webui = d.get("webui") or d.get("account_url") or ""
# payto://x-taler-bank/host:port/account?...
# payto://x-taler-bank/HOST[/port]/account?receiver-name=…
# Match libeufin: host without :443 is correct for x-taler-bank payto
m = re.match(r"^payto://x-taler-bank/([^/?#]+)/([^/?#]+)(\?.*)?$", payto)
if not m:
print("payto shape invalid:", payto[:120])
sys.exit(1)
auth, acct = m.group(1), m.group(2)
if ":" not in auth:
print("payto missing port (need host:port):", auth)
if not auth or not acct:
print("payto host/account empty")
sys.exit(1)
host, port_s = auth.rsplit(":", 1)
if not host or not port_s.isdigit():
print("payto host:port invalid:", auth)
if "receiver-name=" not in (m.group(3) or ""):
print("payto missing receiver-name")
sys.exit(1)
if not acct:
print("payto account empty")
# QR must encode payto (not only webui homepage)
qr = d.get("qr_payload") or payto
if not qr.startswith("payto://"):
print("qr_payload must be payto:// account URI:", (qr or "")[:80])
sys.exit(1)
u = urlparse(webui)
if u.scheme not in ("http", "https") or not u.netloc or "webui" not in (u.path or ""):
print("webui not absolute https …/webui/:", webui[:120])
sys.exit(1)
print(f"user={d.get('username','')} payto={auth}/{acct} webui={webui}")
print(f"user={d.get('username','')} payto={auth}/{acct} qr=payto webui={webui}")
sys.exit(0)
PY
then