Update app.js
This commit is contained in:
parent
bd7b6c8616
commit
17fa1c624c
1 changed files with 19 additions and 8 deletions
|
|
@ -258,18 +258,29 @@ function scanQRsend() {
|
||||||
outputMessage.hidden = true
|
outputMessage.hidden = true
|
||||||
outputData.parentElement.hidden = false
|
outputData.parentElement.hidden = false
|
||||||
outputData.innerText = JSON.stringify(code.data)
|
outputData.innerText = JSON.stringify(code.data)
|
||||||
theinvoice = decode(code.data)
|
outstr = ""
|
||||||
|
outmemo = ""
|
||||||
|
if (code.data.split(":")[0] == "lightning") {
|
||||||
|
theinvoice = decode(code.data.split(":")[1])
|
||||||
outmemo = theinvoice.data.tags[1].value
|
outmemo = theinvoice.data.tags[1].value
|
||||||
if (outmemo.split(":")[0] == "lightning") {
|
outstr = JSON.stringify(code.data.split(":")[1])
|
||||||
outmemo = outmemo.split(":")[1];
|
|
||||||
}
|
}
|
||||||
if (outmemo.substring(0, 4).toUpperCase() == "LNBC"){
|
|
||||||
|
if (code.data.substring(0, 4).toUpperCase() != "LNBC"){
|
||||||
document.getElementById('sendfunds2').innerHTML =
|
document.getElementById('sendfunds2').innerHTML =
|
||||||
"<div class='row'><div class='col-md-6'>" +
|
"<div class='row'><div class='col-md-6'>" +
|
||||||
"<h3><b style='color:red;'>Not a lightning invoice</b></h3>" +
|
"<h3><b style='color:red;'>Not a lightning invoice</b></h3>" +
|
||||||
"<button style='margin-left:20px;' type='submit' class='btn btn-primary' onclick='cancelsend()'>Continue</button>" +
|
"<button style='margin-left:20px;' type='submit' class='btn btn-primary' onclick='cancelsend()'>Continue</button>" +
|
||||||
'</br/></br/></div></div>'
|
'</br/></br/></div></div>'
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
theinvoice = decode(code.data)
|
||||||
|
outmemo = theinvoice.data.tags[1].value
|
||||||
|
outstr = JSON.stringify(code.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
outamount = Number(theinvoice.human_readable_part.amount) / 1000
|
outamount = Number(theinvoice.human_readable_part.amount) / 1000
|
||||||
if (outamount > Number(wallet.balance)) {
|
if (outamount > Number(wallet.balance)) {
|
||||||
document.getElementById('sendfunds2').innerHTML =
|
document.getElementById('sendfunds2').innerHTML =
|
||||||
|
|
@ -286,10 +297,10 @@ function scanQRsend() {
|
||||||
outmemo +
|
outmemo +
|
||||||
'</h3>' +
|
'</h3>' +
|
||||||
"<div class='input-group input-group-sm'><input type='text' id='invoiceinput' class='form-control' value='" +
|
"<div class='input-group input-group-sm'><input type='text' id='invoiceinput' class='form-control' value='" +
|
||||||
JSON.stringify(code.data) +
|
outstr +
|
||||||
"'><span class='input-group-btn'><button class='btn btn-info btn-flat' type='button' onclick='copyfunc()'>Copy</button></span></div></br/>" +
|
"'><span class='input-group-btn'><button class='btn btn-info btn-flat' type='button' onclick='copyfunc()'>Copy</button></span></div></br/>" +
|
||||||
"<button type='submit' class='btn btn-primary' onclick='sendfunds(" +
|
"<button type='submit' class='btn btn-primary' onclick='sendfunds(" +
|
||||||
JSON.stringify(code.data) +
|
outstr +
|
||||||
")'>Send funds</button>" +
|
")'>Send funds</button>" +
|
||||||
"<button style='margin-left:20px;' type='submit' class='btn btn-primary' onclick='cancelsend()'>Cancel payment</button>" +
|
"<button style='margin-left:20px;' type='submit' class='btn btn-primary' onclick='cancelsend()'>Cancel payment</button>" +
|
||||||
'</br/></br/></div></div>'
|
'</br/></br/></div></div>'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue