From 28df100d9a86d15cfae0e45971c95557c018c90e Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Fri, 30 Aug 2024 12:48:24 +0100 Subject: [PATCH] Fix lnurl fallback (#2656) * Fix lnurl fallback Wrong string case search Closes #1599 * optimize the code * one more clean up --- lnbits/static/js/wallet.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lnbits/static/js/wallet.js b/lnbits/static/js/wallet.js index 0978392a4..5c6272eac 100644 --- a/lnbits/static/js/wallet.js +++ b/lnbits/static/js/wallet.js @@ -219,20 +219,16 @@ new Vue({ decodeRequest: function () { this.parse.show = true let req = this.parse.data.request.toLowerCase() - if (this.parse.data.request.toLowerCase().startsWith('lightning:')) { - this.parse.data.request = this.parse.data.request.slice(10) - } else if (this.parse.data.request.toLowerCase().startsWith('lnurl:')) { - this.parse.data.request = this.parse.data.request.slice(6) - } else if (req.indexOf('lightning=lnurl1') !== -1) { - this.parse.data.request = this.parse.data.request - .split('lightning=')[1] - .split('&')[0] + + if (req.startsWith('lightning:')) { + this.parse.data.request = req.slice(10) + } else if (req.startsWith('lnurl:')) { + this.parse.data.request = req.slice(6) + } else if (req.includes('lightning=lnurl1')) { + this.parse.data.request = req.split('lightning=')[1].split('&')[0] } - if ( - this.parse.data.request.toLowerCase().startsWith('lnurl1') || - this.parse.data.request.match(/[\w.+-~_]+@[\w.+-~_]/) - ) { + if (req.startsWith('lnurl1') || req.match(/[\w.+-~_]+@[\w.+-~_]/)) { LNbits.api .request( 'GET',