fix parsing of lightning: prefix
This commit is contained in:
@@ -1631,13 +1631,14 @@ page_container %}
|
|||||||
// get request from pay invoice dialog
|
// get request from pay invoice dialog
|
||||||
req = this.payInvoiceData.data.request
|
req = this.payInvoiceData.data.request
|
||||||
}
|
}
|
||||||
|
// strip off lightning: prefix
|
||||||
|
if (req.toLowerCase().startsWith('lightning:')) {
|
||||||
|
req = req.slice(10)
|
||||||
|
}
|
||||||
|
// determine request type
|
||||||
if (req.toLowerCase().startsWith('lnbc')) {
|
if (req.toLowerCase().startsWith('lnbc')) {
|
||||||
this.payInvoiceData.data.request = req
|
this.payInvoiceData.data.request = req
|
||||||
reqtype = 'bolt11'
|
reqtype = 'bolt11'
|
||||||
} else if (req.toLowerCase().startsWith('lightning:')) {
|
|
||||||
this.payInvoiceData.data.request = req.slice(10)
|
|
||||||
reqtype = 'bolt11'
|
|
||||||
} else if (req.toLowerCase().startsWith('lnurl:')) {
|
} else if (req.toLowerCase().startsWith('lnurl:')) {
|
||||||
this.payInvoiceData.data.request = req.slice(6)
|
this.payInvoiceData.data.request = req.slice(6)
|
||||||
reqtype = 'lnurl'
|
reqtype = 'lnurl'
|
||||||
@@ -1652,8 +1653,12 @@ page_container %}
|
|||||||
) {
|
) {
|
||||||
this.payInvoiceData.data.request = req
|
this.payInvoiceData.data.request = req
|
||||||
reqtype = 'lnurl'
|
reqtype = 'lnurl'
|
||||||
} else if (req.indexOf('eyJwcm')) {
|
} else if (
|
||||||
// very dirty way of parsing cashu tokens from either a pasted token or a URL like https://host.com?token=eyJwcm
|
req.toLowerCase().startsWith('cashu:') ||
|
||||||
|
req.indexOf('eyJwcm') != -1
|
||||||
|
) {
|
||||||
|
// very dirty way of parsing cashu tokens from either a pasted token or a URL like https://host.com?token=eyJwcm...
|
||||||
|
// or cashu:eyJwcm...
|
||||||
this.receiveData.tokensBase64 = req.slice(req.indexOf('eyJwcm'))
|
this.receiveData.tokensBase64 = req.slice(req.indexOf('eyJwcm'))
|
||||||
reqtype = 'cashu'
|
reqtype = 'cashu'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user