Merge commit from fork
* fix: don't show unsafe html in lnurlp notifications * fix: lnurlp success aes decryption * regenerate bundle --------- Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
co-authored by
Vlad Stan
parent
fd9009f760
commit
aac04efd0e
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -414,12 +414,19 @@ window.PageWallet = {
|
||||
switch (action.tag) {
|
||||
case 'url':
|
||||
Quasar.Notify.create({
|
||||
message: `<a target="_blank" style="color: inherit" href="${action.url}">${action.url}</a>`,
|
||||
message: action.url,
|
||||
caption: action.description,
|
||||
html: true,
|
||||
html: false,
|
||||
type: 'positive',
|
||||
timeout: 0,
|
||||
closeBtn: true
|
||||
closeBtn: true,
|
||||
actions: [
|
||||
{
|
||||
label: 'Open link',
|
||||
color: 'white',
|
||||
handler: () => this.utils.openUrlInNewTab(action.url)
|
||||
}
|
||||
]
|
||||
})
|
||||
break
|
||||
case 'message':
|
||||
@@ -431,15 +438,29 @@ window.PageWallet = {
|
||||
})
|
||||
break
|
||||
case 'aes':
|
||||
this.utils.decryptLnurlPayAES(action, response.data.preimage)
|
||||
Quasar.Notify.create({
|
||||
message: value,
|
||||
caption: extra.success_action.description,
|
||||
html: true,
|
||||
type: 'positive',
|
||||
timeout: 0,
|
||||
closeBtn: true
|
||||
})
|
||||
this.utils
|
||||
.decryptLnurlPayAES(action, response.data.preimage)
|
||||
.then(value => {
|
||||
Quasar.Notify.create({
|
||||
message: value,
|
||||
caption: action.description,
|
||||
html: false,
|
||||
type: 'positive',
|
||||
timeout: 0,
|
||||
closeBtn: true
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
Quasar.Notify.create({
|
||||
message: action.description || 'Payment successful.',
|
||||
caption: 'Could not decrypt success action.',
|
||||
html: false,
|
||||
type: 'warning',
|
||||
timeout: 0,
|
||||
closeBtn: true
|
||||
})
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -365,5 +365,27 @@ window._lnbitsUtils = {
|
||||
let decoder = new TextDecoder('utf-8')
|
||||
return decoder.decode(valueb)
|
||||
})
|
||||
},
|
||||
validateBrowsableUrl(urlString, allowLoopback = false) {
|
||||
const url = new URL(urlString)
|
||||
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
||||
throw new Error('Invalid protocol')
|
||||
}
|
||||
if (!allowLoopback) {
|
||||
const host = url.hostname
|
||||
if (
|
||||
host === 'localhost' ||
|
||||
host === '[::1]' ||
|
||||
host === '::1' ||
|
||||
host.startsWith('127.') ||
|
||||
host.startsWith('::ffff:127.')
|
||||
) {
|
||||
throw new Error('Loopback addresses are not allowed')
|
||||
}
|
||||
}
|
||||
},
|
||||
openUrlInNewTab(urlString, allowLoopback = false) {
|
||||
this.validateBrowsableUrl(urlString, allowLoopback)
|
||||
window.open(urlString, '_blank', 'noopener,noreferrer')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user