diff options
Diffstat (limited to 'prog/ž/app.html')
-rw-r--r-- | prog/ž/app.html | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/prog/ž/app.html b/prog/ž/app.html index 544db56..6502e5f 100644 --- a/prog/ž/app.html +++ b/prog/ž/app.html @@ -242,10 +242,10 @@ async function paynow () { let sender = await sec1_from_pubkey(await pubkey_from_string("me")); let rcpt = await sec1_from_pubkey(window.recipient); let amount32 = new Uint8Array(4); - amount32[3] = amount.value % 256; - amount32[2] = (amount.value >> 8) % 256; - amount32[1] = (amount.value >> 16) % 256; - amount32[0] = (amount.value >> 24) % 256; + amount32[3] = eval(amount.value) % 256; + amount32[2] = (eval(amount.value) >> 8) % 256; + amount32[1] = (eval(amount.value) >> 16) % 256; + amount32[0] = (eval(amount.value) >> 24) % 256; amount.value = ""; let comm = new TextEncoder().encode(comment.value); let comm256 = new Uint8Array(256); @@ -309,12 +309,12 @@ async function pubkey_from_string (s) { return false; } async function paypossible () { - if (amount.value == "") { - console.log("paypossible: empty amount field"); + if (!eval(amount.value)) { + console.log("paypossible: invalid amount field"); pay.disabled = true; return; } - if (!(Number(amount.value) <= 4294967296 && Number(amount.value) >= 0)) { + if (!(Number(eval(amount.value)) <= 4294967296 && Number(eval(amount.value)) >= 0)) { console.log("paypossible: amount invalid"); pay.disabled = true; return; @@ -324,6 +324,11 @@ async function paypossible () { pay.disabled = true; return; } + if (sec1.value.length < 1) { + console.log("paypossible: bad sec1 pubkey -- too short"); + pay.disabled = true; + return; + } window.recipient = await pubkey_from_string(sec1.value); if (recipient == false) { console.log("paypossible: recipient pubkey bad"); |