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) {
|
switch (action.tag) {
|
||||||
case 'url':
|
case 'url':
|
||||||
Quasar.Notify.create({
|
Quasar.Notify.create({
|
||||||
message: `<a target="_blank" style="color: inherit" href="${action.url}">${action.url}</a>`,
|
message: action.url,
|
||||||
caption: action.description,
|
caption: action.description,
|
||||||
html: true,
|
html: false,
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
timeout: 0,
|
timeout: 0,
|
||||||
closeBtn: true
|
closeBtn: true,
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: 'Open link',
|
||||||
|
color: 'white',
|
||||||
|
handler: () => this.utils.openUrlInNewTab(action.url)
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 'message':
|
case 'message':
|
||||||
@@ -431,15 +438,29 @@ window.PageWallet = {
|
|||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 'aes':
|
case 'aes':
|
||||||
this.utils.decryptLnurlPayAES(action, response.data.preimage)
|
this.utils
|
||||||
Quasar.Notify.create({
|
.decryptLnurlPayAES(action, response.data.preimage)
|
||||||
message: value,
|
.then(value => {
|
||||||
caption: extra.success_action.description,
|
Quasar.Notify.create({
|
||||||
html: true,
|
message: value,
|
||||||
type: 'positive',
|
caption: action.description,
|
||||||
timeout: 0,
|
html: false,
|
||||||
closeBtn: true
|
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')
|
let decoder = new TextDecoder('utf-8')
|
||||||
return decoder.decode(valueb)
|
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