feat: republish endpoints + polling + multi-ticket via N-rows model #16
2 changed files with 50 additions and 0 deletions
feat(ui): "Republish all" button on the admin Settings card
Surfaces the POST /republish-all endpoint added in the previous commit. Lives in the existing admin-gated Settings card on the events extension landing page, so the LNbits operator can trigger the migration without curl + access tokens. Confirm dialog before firing (the endpoint emits one Nostr event per approved row, fine to retry but worth a click of friction). Notification shows the republished/total count on success. Self-closing tags expanded per the LNbits UMD rule (webapp CLAUDE.md > LNbits + Quasar UMD gotchas) — q-separator and q-btn would silently nest wrong otherwise. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
commit
fa2a6e40f0
|
|
@ -9,6 +9,7 @@ window.PageEvents = {
|
||||||
pendingEvents: [],
|
pendingEvents: [],
|
||||||
allUserEvents: [],
|
allUserEvents: [],
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
|
republishing: false,
|
||||||
settings: {
|
settings: {
|
||||||
auto_approve: false
|
auto_approve: false
|
||||||
},
|
},
|
||||||
|
|
@ -275,6 +276,33 @@ window.PageEvents = {
|
||||||
.catch(LNbits.utils.notifyApiError)
|
.catch(LNbits.utils.notifyApiError)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
republishAllEvents() {
|
||||||
|
LNbits.utils
|
||||||
|
.confirmDialog(
|
||||||
|
'Re-emit every approved event to Nostr relays? This is safe ' +
|
||||||
|
'to run multiple times but generates one event per approved row.'
|
||||||
|
)
|
||||||
|
.onOk(() => {
|
||||||
|
this.republishing = true
|
||||||
|
LNbits.api
|
||||||
|
.request('POST', '/events/api/v1/events/republish-all')
|
||||||
|
.then(response => {
|
||||||
|
Quasar.Notify.create({
|
||||||
|
type: 'positive',
|
||||||
|
message:
|
||||||
|
'Republished ' +
|
||||||
|
response.data.republished +
|
||||||
|
' of ' +
|
||||||
|
response.data.total +
|
||||||
|
' events'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(LNbits.utils.notifyApiError)
|
||||||
|
.finally(() => {
|
||||||
|
this.republishing = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
foldDateTime(day, time) {
|
foldDateTime(day, time) {
|
||||||
// Combine separate date/time inputs into the wire format
|
// Combine separate date/time inputs into the wire format
|
||||||
// expected by the events extension: "YYYY-MM-DD" or
|
// expected by the events extension: "YYYY-MM-DD" or
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,28 @@
|
||||||
></q-toggle>
|
></q-toggle>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<q-separator class="q-my-md"></q-separator>
|
||||||
|
<div class="row items-center justify-between">
|
||||||
|
<div class="col">
|
||||||
|
<span class="text-subtitle2">Republish to Nostr</span>
|
||||||
|
<div class="text-caption text-grey-7" style="color: #aaa">
|
||||||
|
Re-emit every approved event so connected clients pick
|
||||||
|
up the latest tag set. Useful after the extension
|
||||||
|
publisher changes (e.g. new tickets_* tags) so existing
|
||||||
|
events don't need a per-event edit.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<q-btn
|
||||||
|
outline
|
||||||
|
color="primary"
|
||||||
|
icon="cloud_upload"
|
||||||
|
label="Republish all"
|
||||||
|
:loading="republishing"
|
||||||
|
@click="republishAllEvents"
|
||||||
|
></q-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue