add manual activate button

This commit is contained in:
Lee Salminen 2022-12-24 05:40:34 -06:00
parent 4f39dce206
commit fe2be38ebb
2 changed files with 41 additions and 1 deletions

View File

@ -5,7 +5,7 @@ from lnbits.core.models import Payment
from lnbits.helpers import urlsafe_short_hash
from lnbits.tasks import internal_invoice_queue, register_invoice_listener
from .crud import activate_address, get_domain
from .crud import activate_address
async def wait_for_paid_invoices():
@ -25,6 +25,10 @@ async def on_invoice_paid(payment: Payment) -> None:
domain_id = payment.extra.get("domain_id")
address_id = payment.extra.get("address_id")
print("Activating NOSTR NIP-05")
print(domain_id)
print(address_id)
active = await activate_address(domain_id, address_id)
return

View File

@ -128,6 +128,15 @@
target="_blank"
:href="'rotate/' + props.row.domain_id + '/' + props.row.id"
></q-btn>
<q-btn
unelevated
dense
size="xs"
icon="check"
:color="($q.dark.isActive) ? 'grey-7' : 'grey-5'"
:disable="props.row.active == true"
@click="activateAddress(props.row.domain_id, props.row.id)"
></q-btn>
<q-btn
unelevated
dense
@ -639,6 +648,33 @@
})
})
},
activateAddress: function (domain_id, address_id) {
var self = this
var address = _.findWhere(this.addresses, {id: address_id})
var domain = _.findWhere(this.domains, {id: address.domain_id})
LNbits.utils
.confirmDialog(
'Are you sure you want to manually activate this address?'
)
.onOk(function () {
return LNbits.api
.request(
'POST',
'/nostrnip5/api/v1/domain/' +
domain_id +
'/address/' +
address_id +
'/activate',
_.findWhere(self.g.user.wallets, {id: domain.wallet}).adminkey
)
.then(function (response) {
self.getAddresses()
})
.catch(function (error) {
LNbits.utils.notifyApiError(error)
})
})
},
exportCSV: function () {
LNbits.utils.exportCSV(this.domainsTable.columns, this.domains)
},