feat(pairing-ui): pre-fill the pair dialog relay with the default endpoint
Some checks failed
ci.yml / feat(pairing-ui): pre-fill the pair dialog relay with the default endpoint (pull_request) Failing after 0s

The backend now defaults an omitted relay to the nostrclient proxy endpoint,
but the pair dialog still showed an empty, client-side-required field — so the
operator saw "no default". Wire it through:

- GET /api/v1/dca/default-relay returns default_relay_endpoint() (the derived
  ws(s)://<host>/nostrclient/api/v1/relay).
- openPairDialog pre-fills the relay textarea with it; the operator can override
  or clear it (blank → same server-side default). Drops the client-side
  "at least one relay is required" guard.
- Hint updated to explain the default.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-07-02 00:16:46 +02:00
commit 4e36b98534
4 changed files with 39 additions and 9 deletions

View file

@ -175,3 +175,15 @@ def test_revoke_failure_maps_to_bad_gateway(monkeypatch):
_call_revoke()
assert ei.value.status_code == 502
assert state["unpaired"] is None # not persisted on failure
def test_default_relay_endpoint_returns_nostrclient_url():
from lnbits.settings import settings
prev = settings.lnbits_baseurl
try:
settings.lnbits_baseurl = "https://lnbits.example.com/"
result = asyncio.run(views_api.api_default_relay(SimpleNamespace(id="op1")))
assert result == {"relay": "wss://lnbits.example.com/nostrclient/api/v1/relay"}
finally:
settings.lnbits_baseurl = prev