mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-27 23:41:35 +00:00
make parsing lightning qr codes more robust
This commit is contained in:
parent
31a18f83f1
commit
3076eb75ea
2 changed files with 12 additions and 9 deletions
|
@ -253,7 +253,7 @@ class SendScreen(CScreen):
|
|||
self.payment_request = None
|
||||
|
||||
def do_paste(self):
|
||||
data = self.app._clipboard.paste()
|
||||
data = self.app._clipboard.paste().strip()
|
||||
if not data:
|
||||
self.app.show_info(_("Clipboard is empty"))
|
||||
return
|
||||
|
@ -267,9 +267,12 @@ class SendScreen(CScreen):
|
|||
if tx:
|
||||
self.app.tx_dialog(tx)
|
||||
return
|
||||
lower = data.lower()
|
||||
if lower.startswith('lightning:ln'):
|
||||
lower = lower[10:]
|
||||
# try to decode as URI/address
|
||||
if data.startswith('ln'):
|
||||
self.set_ln_invoice(data.rstrip())
|
||||
if lower.startswith('ln'):
|
||||
self.set_ln_invoice(lower)
|
||||
else:
|
||||
self.set_URI(data)
|
||||
# save automatically
|
||||
|
|
|
@ -131,12 +131,12 @@ class PayToEdit(CompletionTextEdit, ScanQRTextEdit, Logger):
|
|||
if data.startswith("bitcoin:"):
|
||||
self.win.pay_to_URI(data)
|
||||
return
|
||||
l = data.lower()
|
||||
if l.startswith("lightning:"):
|
||||
data = l[10:]
|
||||
if data.startswith("ln"):
|
||||
self.win.parse_lightning_invoice(data)
|
||||
self.lightning_invoice = data
|
||||
lower = data.lower()
|
||||
if lower.startswith("lightning:ln"):
|
||||
lower = lower[10:]
|
||||
if lower.startswith("ln"):
|
||||
self.win.parse_lightning_invoice(lower)
|
||||
self.lightning_invoice = lower
|
||||
return
|
||||
try:
|
||||
self.payto_address = self.parse_output(data)
|
||||
|
|
Loading…
Add table
Reference in a new issue