Compare commits

...
8 changed files with 43 additions and 15 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+5
View File
@@ -98,6 +98,10 @@ window.localisation.en = {
view_swagger_docs: 'View LNbits Swagger API docs', view_swagger_docs: 'View LNbits Swagger API docs',
api_docs: 'API docs', api_docs: 'API docs',
api_keys_api_docs: 'Node URL, API keys and API docs', api_keys_api_docs: 'Node URL, API keys and API docs',
api_keys_warning:
'These keys should be kept safe, sharing them could risk losing funds.',
admin_key_warning:
'Your admin key grants full access to your wallet, including the ability to send payments. Never share it unless you fully trust the recipient.',
lnbits_version: 'LNbits version', lnbits_version: 'LNbits version',
runs_on: 'Runs on', runs_on: 'Runs on',
paste: 'Paste', paste: 'Paste',
@@ -116,6 +120,7 @@ window.localisation.en = {
read: 'Read', read: 'Read',
write: 'Write', write: 'Write',
pay: 'Pay', pay: 'Pay',
sending: 'Sending',
memo: 'Memo', memo: 'Memo',
date: 'Date', date: 'Date',
path: 'Path', path: 'Path',
@@ -1,6 +1,11 @@
window.app.component('lnbits-wallet-api-docs', { window.app.component('lnbits-wallet-api-docs', {
template: '#lnbits-wallet-api-docs', template: '#lnbits-wallet-api-docs',
methods: { methods: {
copyAdminKey() {
LNbits.utils
.confirmDialog(this.$t('admin_key_warning'))
.onOk(() => LNbits.utils.copyText(this.g.wallet.adminkey))
},
resetKeys() { resetKeys() {
LNbits.utils LNbits.utils
.confirmDialog('Are you sure you want to reset your API keys?') .confirmDialog('Are you sure you want to reset your API keys?')
+15 -2
View File
@@ -7,6 +7,7 @@ window.PageWallet = {
invoice: null, invoice: null,
lnurlpay: null, lnurlpay: null,
lnurlauth: null, lnurlauth: null,
sending: false,
data: { data: {
request: '', request: '',
amount: 0, amount: 0,
@@ -131,6 +132,7 @@ window.PageWallet = {
this.parse.data.request = '' this.parse.data.request = ''
this.parse.data.comment = '' this.parse.data.comment = ''
this.parse.data.internalMemo = null this.parse.data.internalMemo = null
this.parse.sending = false
this.parse.data.paymentChecker = null this.parse.data.paymentChecker = null
this.parse.camera.show = false this.parse.camera.show = false
}, },
@@ -362,6 +364,9 @@ window.PageWallet = {
this.parse.invoice = Object.freeze(cleanInvoice) this.parse.invoice = Object.freeze(cleanInvoice)
}, },
payInvoice() { payInvoice() {
if (this.parse.sending) return
this.parse.sending = true
const dismissPaymentMsg = Quasar.Notify.create({ const dismissPaymentMsg = Quasar.Notify.create({
timeout: 0, timeout: 0,
message: this.$t('payment_processing') message: this.$t('payment_processing')
@@ -374,6 +379,7 @@ window.PageWallet = {
this.parse.data.internalMemo this.parse.data.internalMemo
) )
.then(response => { .then(response => {
this.parse.sending = false
dismissPaymentMsg() dismissPaymentMsg()
this.g.updatePayments = !this.g.updatePayments this.g.updatePayments = !this.g.updatePayments
this.parse.show = false this.parse.show = false
@@ -391,13 +397,16 @@ window.PageWallet = {
} }
}) })
.catch(err => { .catch(err => {
this.parse.sending = false
dismissPaymentMsg() dismissPaymentMsg()
LNbits.utils.notifyApiError(err) LNbits.utils.notifyApiError(err)
this.g.updatePayments = !this.g.updatePayments this.g.updatePayments = !this.g.updatePayments
this.parse.show = false
}) })
}, },
payLnurl() { payLnurl() {
if (this.parse.sending) return
this.parse.sending = true
LNbits.api LNbits.api
.request('post', '/api/v1/payments/lnurl', this.g.wallet.adminkey, { .request('post', '/api/v1/payments/lnurl', this.g.wallet.adminkey, {
res: this.parse.lnurlpay, res: this.parse.lnurlpay,
@@ -408,6 +417,7 @@ window.PageWallet = {
internalMemo: this.parse.data.internalMemo internalMemo: this.parse.data.internalMemo
}) })
.then(response => { .then(response => {
this.parse.sending = false
this.parse.show = false this.parse.show = false
if (response.data.extra.success_action) { if (response.data.extra.success_action) {
const action = JSON.parse(response.data.extra.success_action) const action = JSON.parse(response.data.extra.success_action)
@@ -464,7 +474,10 @@ window.PageWallet = {
} }
} }
}) })
.catch(LNbits.utils.notifyApiError) .catch(err => {
this.parse.sending = false
LNbits.utils.notifyApiError(err)
})
}, },
authLnurl() { authLnurl() {
const dismissAuthMsg = Quasar.Notify.create({ const dismissAuthMsg = Quasar.Notify.create({
@@ -6,9 +6,12 @@
:content-inset-level="0.5" :content-inset-level="0.5"
> >
<q-card-section> <q-card-section>
<q-banner dense rounded class="bg-warning text-black q-mb-md"> <q-banner
These keys should be kept safe, sharing them could risk losing funds. dense
</q-banner> rounded
class="bg-warning text-black q-mb-md"
v-text="$t('api_keys_warning')"
></q-banner>
<q-list> <q-list>
<q-item dense class="q-pa-none"> <q-item dense class="q-pa-none">
<q-item-section> <q-item-section>
@@ -69,7 +72,7 @@
<q-icon <q-icon
name="content_copy" name="content_copy"
class="cursor-pointer q-ml-sm" class="cursor-pointer q-ml-sm"
@click="utils.copyText(g.wallet.adminkey)" @click="copyAdminKey()"
></q-icon> ></q-icon>
<q-icon name="qr_code" class="cursor-pointer q-ml-sm"> <q-icon name="qr_code" class="cursor-pointer q-ml-sm">
<q-popup-proxy> <q-popup-proxy>
+9 -2
View File
@@ -664,7 +664,8 @@
unelevated unelevated
color="primary" color="primary"
@click="payInvoice" @click="payInvoice"
:label="$t('pay')" :disable="parse.sending"
:label="parse.sending ? $t('sending') + '...' : $t('pay')"
></q-btn> ></q-btn>
<q-btn <q-btn
v-close-popup v-close-popup
@@ -836,7 +837,13 @@
</div> </div>
</div> </div>
<div class="row q-mt-lg"> <div class="row q-mt-lg">
<q-btn unelevated color="primary" type="submit">Send</q-btn> <q-btn
unelevated
color="primary"
type="submit"
:disable="parse.sending"
:label="parse.sending ? $t('sending') + '...' : $t('send')"
></q-btn>
<q-btn <q-btn
:label="$t('cancel')" :label="$t('cancel')"
v-close-popup v-close-popup
-5
View File
@@ -1,5 +1,3 @@
from collections.abc import AsyncGenerator
from loguru import logger from loguru import logger
from .base import ( from .base import (
@@ -40,6 +38,3 @@ class VoidWallet(Wallet):
async def get_payment_status(self, *_, **__) -> PaymentStatus: async def get_payment_status(self, *_, **__) -> PaymentStatus:
return PaymentPendingStatus() return PaymentPendingStatus()
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
yield ""