From b840e01c5c0bcbd4a9f56b6461c0daa6fe931b9c Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Wed, 29 Jan 2020 19:17:01 +0000 Subject: [PATCH] Fixed chrome issues --- lnbits/templates/withdraw.html | 100 +++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 23 deletions(-) diff --git a/lnbits/templates/withdraw.html b/lnbits/templates/withdraw.html index f9bc71404..1949c1cc7 100644 --- a/lnbits/templates/withdraw.html +++ b/lnbits/templates/withdraw.html @@ -104,7 +104,7 @@
- +
@@ -143,7 +143,7 @@
@@ -164,15 +164,15 @@
- + {% for w in user_fau %} - + {% endfor %}
-


+


@@ -265,13 +265,15 @@ if (user_fau.length) { //draws withdraw QR code -function drawwithdraw(data) { +function drawwithdraw() { + + + walname = document.getElementById("fauselect").value - walname = document.getElementById(data).value thewithdraw = walname.split("-"); console.log(window.location.hostname + "-" + thewithdraw[1]) - getAjax('/v1/lnurlencode/'+ window.location.hostname + "/" + thewithdraw[1], "filla", function(datab) { + getAjax('/v1/lnurlencode/'+ window.location.hostname + "/" + thewithdraw[1], "filla", function(datab) { if (JSON.parse(datab).STATUS == 'TRUE') { console.log(JSON.parse(datab).STATUS) lnurlfau = (JSON.parse(datab).LNURL) @@ -285,12 +287,21 @@ function drawwithdraw(data) { colorLight: '#ffffff', correctLevel: QRCode.CorrectLevel.M }) + + if (thewithdraw[2] > 0){ document.getElementById('qrcodetxt').innerHTML = lnurlfau + "

Shareable link

" + "

Print all withdraws

" document.getElementById("qrcode").style.backgroundColor = "white"; document.getElementById("qrcode").style.padding = "20px"; + } + else{ + document.getElementById('qrcode').innerHTML = "" + document.getElementById('qrcodetxt').innerHTML = "

No more uses left in link!



" + + + } } else { @@ -298,6 +309,7 @@ function drawwithdraw(data) { thewithdraw[1] = "Failed to build LNURL" } }) + } @@ -312,13 +324,34 @@ function postfau(){ uniq = document.getElementById('uniq').checked - console.log(wal) - console.log(tit) - console.log(amt) - console.log(maxamt) - console.log(minamt) - console.log(wal) - console.log(tme) + if (tit == "") { + document.getElementById("error").innerHTML = "Only use letters in title" + return amt + } + if (wal == "") { + document.getElementById("error").innerHTML = "No wallet selected" + return amt + } + + if (isNaN(maxamt) || maxamt < 10 || maxamt > 1000000) { + document.getElementById("error").innerHTML = "Max 15 - 1000000 and must be higher than min" + return amt + } + if (isNaN(minamt) || minamt < 1 || minamt > 1000000 || minamt > maxamt) { + document.getElementById("error").innerHTML = "Min 1 - 1000000 and must be lower than max" + return amt + } + + if (isNaN(amt) || amt < 1 || amt > 1000) { + document.getElementById("error").innerHTML = "Amount of uses must be between 1 - 1000" + return amt + } + + if (isNaN(tme) || tme < 1 || tme > 86400) { + document.getElementById("error").innerHTML = "Max waiting time 1 day (86400 secs)" + return amt + } + postAjax( '/withdrawmaker', @@ -414,7 +447,7 @@ document.getElementById('editlink').innerHTML = "
"+ "
"+ "
"+ " " @@ -432,13 +465,34 @@ function editlinkcont(){ uniq = document.getElementById('edituniq').checked - console.log(wal) - console.log(tit) - console.log(amt) - console.log(maxamt) - console.log(minamt) - console.log(tme) + + if (tit == "") { + document.getElementById("error2").innerHTML = "Only use letters in title" + return amt + } + if (wal == "") { + document.getElementById("error2").innerHTML = "No wallet selected" + return amt + } + if (isNaN(maxamt) || maxamt < 10 || maxamt > 1000000) { + document.getElementById("error2").innerHTML = "Max 10 - 1000000 and must be higher than min" + return amt + } + if (isNaN(minamt) || minamt < 1 || minamt > 1000000 || minamt > maxamt) { + document.getElementById("error2").innerHTML = "Min 1 - 1000000 and must be lower than max" + return amt + } + + if (isNaN(amt) || amt < 1 || amt > 1000) { + document.getElementById("error2").innerHTML = "Amount of uses must be between 1 - 1000" + return amt + } + + if (isNaN(tme) || tme < 1 || tme > 86400) { + document.getElementById("error2").innerHTML = "Max waiting time 1 day (86400 secs)" + return amt + } postAjax(