bank: strip :443 from taler://withdraw URIs for wallet apps.

libeufin includes default HTTPS port; demo/auto-account APIs, refresh
scripts, and landing JS now normalize hosts without :443. ensure-taler-apps
also starts merchant ui-unlock after reboot.
This commit is contained in:
Hernâni Marques 2026-07-17 01:07:22 +02:00
parent 360fb363de
commit 196ba7aba9
5 changed files with 56 additions and 11 deletions

View file

@ -42,6 +42,27 @@ def public_webui_url() -> str:
return f"{BANK_PUBLIC}/webui/"
def normalize_taler_withdraw_uri(uri: str) -> str:
"""Strip default :443/:80 from taler://withdraw host (wallet base-URL fix).
libeufin builds authority from https BASE_URL and includes port 443; Android /
iOS wallets then fail host parsing or TLS. Path and id stay unchanged.
"""
if not uri:
return uri
# taler://withdraw/bank.example:443/taler-integration/UUID
uri = re.sub(
r"(taler://withdraw/)([^/?#]+):443(?=/|$)",
r"\1\2",
uri,
)
uri = re.sub(
r"(taler://withdraw/)([^/?#]+):80(?=/|$)",
r"\1\2",
uri,
)
return uri
def load_pass() -> str:
p = os.environ.get("BANK_PASS", "").strip()
if p:
@ -104,9 +125,9 @@ def mint_withdraw() -> dict:
raise RuntimeError(f"no taler_withdraw_uri: {wd}")
if not wid:
wid = uri.rstrip("/").split("/")[-1]
# Keep host:port from libeufin (e.g. bank.hacktivism.ch:443). Stripping :443
# breaks taler-integration withdraw links / main landing QR on HTTPS banks.
uri = str(uri).strip()
# libeufin emits taler://withdraw/host:443/... from https BASE_URL; mobile
# wallets and many desktop builds reject/mis-parse default port :443.
uri = normalize_taler_withdraw_uri(str(uri).strip())
LANDING.mkdir(parents=True, exist_ok=True)
(LANDING / "withdraw.uri").write_text(uri + "\n")
(LANDING / "withdraw.amount").write_text(AMOUNT + "\n")