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
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:
parent
c3791ed6c8
commit
4e36b98534
4 changed files with 39 additions and 9 deletions
|
|
@ -839,12 +839,21 @@ window.app = Vue.createApp({
|
|||
// -----------------------------------------------------------------
|
||||
// Pair / revoke spire (S0 / #9, #12)
|
||||
// -----------------------------------------------------------------
|
||||
openPairDialog(machine) {
|
||||
async openPairDialog(machine) {
|
||||
this.pairDialog.machine = machine
|
||||
this.pairDialog.relays = ''
|
||||
this.pairDialog.durationHours = null
|
||||
this.pairDialog.result = null
|
||||
this.pairDialog.show = true
|
||||
// Pre-fill with this lnbits' default relay (the nostrclient proxy
|
||||
// endpoint derived from lnbits_baseurl). The operator can override or
|
||||
// clear it; if left blank the backend fills in the same default.
|
||||
try {
|
||||
const {data} = await LNbits.api.request('GET', `${API}/default-relay`)
|
||||
if (data && data.relay) this.pairDialog.relays = data.relay
|
||||
} catch (e) {
|
||||
// Non-fatal: leave blank; the backend still defaults on submit.
|
||||
}
|
||||
},
|
||||
|
||||
async submitPair() {
|
||||
|
|
@ -852,14 +861,12 @@ window.app = Vue.createApp({
|
|||
.split(/[\s,]+/)
|
||||
.map(s => s.trim())
|
||||
.filter(Boolean)
|
||||
if (!relays.length) {
|
||||
Quasar.Notify.create({
|
||||
type: 'negative',
|
||||
message: 'At least one relay is required'
|
||||
})
|
||||
return
|
||||
// relays is optional — blank falls back to the nostrclient endpoint
|
||||
// server-side (the pre-filled default), so no client-side requirement.
|
||||
const body = {}
|
||||
if (relays.length) {
|
||||
body.relays = relays
|
||||
}
|
||||
const body = {relays}
|
||||
if (this.pairDialog.durationHours) {
|
||||
body.duration_hours = Number(this.pairDialog.durationHours)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue