Merge branch 'lnbits:main' into main
This commit is contained in:
commit
0701ff60b7
10 changed files with 54 additions and 51 deletions
|
|
@ -452,6 +452,15 @@ async def delete_payment(checking_id: str, conn: Optional[Connection] = None) ->
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def delete_wallet_payment(
|
||||||
|
checking_id: str, wallet_id: str, conn: Optional[Connection] = None
|
||||||
|
) -> None:
|
||||||
|
await (conn or db).execute(
|
||||||
|
"DELETE FROM apipayments WHERE checking_id = ? AND wallet = ?",
|
||||||
|
(checking_id, wallet_id),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def check_internal(
|
async def check_internal(
|
||||||
payment_hash: str, conn: Optional[Connection] = None
|
payment_hash: str, conn: Optional[Connection] = None
|
||||||
) -> Optional[str]:
|
) -> Optional[str]:
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class Payment(BaseModel):
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Deleting outgoing failed payment {self.checking_id}: {status}"
|
f"Deleting outgoing failed payment {self.checking_id}: {status}"
|
||||||
)
|
)
|
||||||
await self.delete()
|
await self.delete(conn)
|
||||||
elif not status.pending:
|
elif not status.pending:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Marking '{'in' if self.is_in else 'out'}' {self.checking_id} as not pending anymore: {status}"
|
f"Marking '{'in' if self.is_in else 'out'}' {self.checking_id} as not pending anymore: {status}"
|
||||||
|
|
@ -182,10 +182,10 @@ class Payment(BaseModel):
|
||||||
await self.update_status(status, conn=conn)
|
await self.update_status(status, conn=conn)
|
||||||
return status
|
return status
|
||||||
|
|
||||||
async def delete(self) -> None:
|
async def delete(self, conn: Optional[Connection] = None) -> None:
|
||||||
from .crud import delete_payment
|
from .crud import delete_payment
|
||||||
|
|
||||||
await delete_payment(self.checking_id)
|
await delete_payment(self.checking_id, conn=conn)
|
||||||
|
|
||||||
|
|
||||||
class BalanceCheck(BaseModel):
|
class BalanceCheck(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ from . import db
|
||||||
from .crud import (
|
from .crud import (
|
||||||
check_internal,
|
check_internal,
|
||||||
create_payment,
|
create_payment,
|
||||||
delete_payment,
|
delete_wallet_payment,
|
||||||
get_wallet,
|
get_wallet,
|
||||||
get_wallet_payment,
|
get_wallet_payment,
|
||||||
update_payment_details,
|
update_payment_details,
|
||||||
|
|
@ -221,7 +221,7 @@ async def pay_invoice(
|
||||||
logger.warning(f"backend sent payment failure")
|
logger.warning(f"backend sent payment failure")
|
||||||
async with db.connect() as conn:
|
async with db.connect() as conn:
|
||||||
logger.debug(f"deleting temporary payment {temp_id}")
|
logger.debug(f"deleting temporary payment {temp_id}")
|
||||||
await delete_payment(temp_id, conn=conn)
|
await delete_wallet_payment(temp_id, wallet_id, conn=conn)
|
||||||
raise PaymentFailure(
|
raise PaymentFailure(
|
||||||
f"payment failed: {payment.error_message}"
|
f"payment failed: {payment.error_message}"
|
||||||
or "payment failed, but backend didn't give us an error message"
|
or "payment failed, but backend didn't give us an error message"
|
||||||
|
|
|
||||||
|
|
@ -369,9 +369,9 @@ new Vue({
|
||||||
decodeRequest: function () {
|
decodeRequest: function () {
|
||||||
this.parse.show = true
|
this.parse.show = true
|
||||||
let req = this.parse.data.request.toLowerCase()
|
let req = this.parse.data.request.toLowerCase()
|
||||||
if (this.parse.data.request.startsWith('lightning:')) {
|
if (this.parse.data.request.toLowerCase().startsWith('lightning:')) {
|
||||||
this.parse.data.request = this.parse.data.request.slice(10)
|
this.parse.data.request = this.parse.data.request.slice(10)
|
||||||
} else if (this.parse.data.request.startsWith('lnurl:')) {
|
} else if (this.parse.data.request.toLowerCase().startsWith('lnurl:')) {
|
||||||
this.parse.data.request = this.parse.data.request.slice(6)
|
this.parse.data.request = this.parse.data.request.slice(6)
|
||||||
} else if (req.indexOf('lightning=lnurl1') !== -1) {
|
} else if (req.indexOf('lightning=lnurl1') !== -1) {
|
||||||
this.parse.data.request = this.parse.data.request
|
this.parse.data.request = this.parse.data.request
|
||||||
|
|
|
||||||
|
|
@ -711,7 +711,7 @@
|
||||||
<q-card class="q-pa-lg">
|
<q-card class="q-pa-lg">
|
||||||
<h6 class="q-my-md text-primary">Warning</h6>
|
<h6 class="q-my-md text-primary">Warning</h6>
|
||||||
<p>
|
<p>
|
||||||
Login functionality to be released in v0.2, for now,
|
Login functionality to be released in a future update, for now,
|
||||||
<strong
|
<strong
|
||||||
>make sure you bookmark this page for future access to your
|
>make sure you bookmark this page for future access to your
|
||||||
wallet</strong
|
wallet</strong
|
||||||
|
|
|
||||||
|
|
@ -19,26 +19,9 @@ async def create_ticket(
|
||||||
(payment_hash, wallet, event, name, email, False, True),
|
(payment_hash, wallet, event, name, email, False, True),
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket = await get_ticket(payment_hash)
|
# UPDATE EVENT DATA ON SOLD TICKET
|
||||||
assert ticket, "Newly created ticket couldn't be retrieved"
|
eventdata = await get_event(event)
|
||||||
return ticket
|
|
||||||
|
|
||||||
|
|
||||||
async def set_ticket_paid(payment_hash: str) -> Tickets:
|
|
||||||
row = await db.fetchone("SELECT * FROM events.ticket WHERE id = ?", (payment_hash,))
|
|
||||||
if row[6] != True:
|
|
||||||
await db.execute(
|
|
||||||
"""
|
|
||||||
UPDATE events.ticket
|
|
||||||
SET paid = true
|
|
||||||
WHERE id = ?
|
|
||||||
""",
|
|
||||||
(payment_hash,),
|
|
||||||
)
|
|
||||||
|
|
||||||
eventdata = await get_event(row[2])
|
|
||||||
assert eventdata, "Couldn't get event from ticket being paid"
|
assert eventdata, "Couldn't get event from ticket being paid"
|
||||||
|
|
||||||
sold = eventdata.sold + 1
|
sold = eventdata.sold + 1
|
||||||
amount_tickets = eventdata.amount_tickets - 1
|
amount_tickets = eventdata.amount_tickets - 1
|
||||||
await db.execute(
|
await db.execute(
|
||||||
|
|
@ -47,11 +30,11 @@ async def set_ticket_paid(payment_hash: str) -> Tickets:
|
||||||
SET sold = ?, amount_tickets = ?
|
SET sold = ?, amount_tickets = ?
|
||||||
WHERE id = ?
|
WHERE id = ?
|
||||||
""",
|
""",
|
||||||
(sold, amount_tickets, row[2]),
|
(sold, amount_tickets, event),
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket = await get_ticket(payment_hash)
|
ticket = await get_ticket(payment_hash)
|
||||||
assert ticket, "Newly updated ticket couldn't be retrieved"
|
assert ticket, "Newly created ticket couldn't be retrieved"
|
||||||
return ticket
|
return ticket
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ from .crud import (
|
||||||
get_ticket,
|
get_ticket,
|
||||||
get_tickets,
|
get_tickets,
|
||||||
reg_ticket,
|
reg_ticket,
|
||||||
set_ticket_paid,
|
|
||||||
update_event,
|
update_event,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,8 +138,9 @@
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
new-value-mode="add-unique"
|
new-value-mode="add-unique"
|
||||||
label="Tip % Options"
|
label="Tip % Options (hit enter to add values)"
|
||||||
></q-select>
|
><q-tooltip>Hit enter to add values</q-tooltip></q-select
|
||||||
|
>
|
||||||
<div class="row q-mt-lg">
|
<div class="row q-mt-lg">
|
||||||
<q-btn
|
<q-btn
|
||||||
unelevated
|
unelevated
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@
|
||||||
name="check"
|
name="check"
|
||||||
transition-show="fade"
|
transition-show="fade"
|
||||||
class="text-light-green"
|
class="text-light-green"
|
||||||
style="font-size: 40em"
|
style="font-size: min(90vw, 40em)"
|
||||||
></q-icon>
|
></q-icon>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</q-page>
|
</q-page>
|
||||||
|
|
@ -294,6 +294,7 @@
|
||||||
exchangeRate: null,
|
exchangeRate: null,
|
||||||
stack: [],
|
stack: [],
|
||||||
tipAmount: 0.0,
|
tipAmount: 0.0,
|
||||||
|
hasNFC: false,
|
||||||
nfcTagReading: false,
|
nfcTagReading: false,
|
||||||
invoiceDialog: {
|
invoiceDialog: {
|
||||||
show: false,
|
show: false,
|
||||||
|
|
@ -370,7 +371,7 @@
|
||||||
this.showInvoice()
|
this.showInvoice()
|
||||||
},
|
},
|
||||||
submitForm: function () {
|
submitForm: function () {
|
||||||
if (this.tip_options.length) {
|
if (this.tip_options && this.tip_options.length) {
|
||||||
this.showTipModal()
|
this.showTipModal()
|
||||||
} else {
|
} else {
|
||||||
this.showInvoice()
|
this.showInvoice()
|
||||||
|
|
@ -413,9 +414,6 @@
|
||||||
dialog.show = false
|
dialog.show = false
|
||||||
|
|
||||||
self.complete.show = true
|
self.complete.show = true
|
||||||
setTimeout(function () {
|
|
||||||
self.complete.show = false
|
|
||||||
}, 5000)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 3000)
|
}, 3000)
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,36 @@
|
||||||
<p>
|
<p>
|
||||||
Onchain Wallet (watch-only) extension uses mempool.space<br />
|
Onchain Wallet (watch-only) extension uses mempool.space<br />
|
||||||
For use with "account Extended Public Key"
|
For use with "account Extended Public Key"
|
||||||
<a href="https://iancoleman.io/bip39/">https://iancoleman.io/bip39/</a>
|
<a
|
||||||
|
href="https://iancoleman.io/bip39/"
|
||||||
|
target="_blank"
|
||||||
|
style="color: unset"
|
||||||
|
>https://iancoleman.io/bip39/</a
|
||||||
|
>
|
||||||
|
<br />
|
||||||
|
Flash binaries
|
||||||
|
<a
|
||||||
|
href="https://lnbits.github.io/hardware-wallet"
|
||||||
|
target="_blank"
|
||||||
|
style="color: unset"
|
||||||
|
>directly from browser</a
|
||||||
|
>
|
||||||
<small>
|
<small>
|
||||||
<br />Created by,
|
<br />Created by,
|
||||||
<a target="_blank" class="text-white" href="https://github.com/arcbtc"
|
<a target="_blank" style="color: unset" href="https://github.com/arcbtc"
|
||||||
>Ben Arc</a
|
>Ben Arc</a
|
||||||
>
|
>
|
||||||
(using,
|
(using,
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="text-white"
|
style="color: unset"
|
||||||
href="https://github.com/diybitcoinhardware/embit"
|
href="https://github.com/diybitcoinhardware/embit"
|
||||||
>Embit</a
|
>Embit</a
|
||||||
></small
|
></small
|
||||||
>)
|
>)
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<a target="_blank" href="/docs#/watchonly" class="text-white"
|
<a target="_blank" href="/docs#/watchonly" style="color: unset"
|
||||||
>Swagger REST API Documentation</a
|
>Swagger REST API Documentation</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue