diff --git a/README.md b/README.md index 2de6324..b4d59b8 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,9 @@ It is truly an open source Crypto Currency ATM, you can see the server end at ht You can find more out about this at https://catm.io - +# Instructions +1. Download node-webkit +2. Navigate to this folder on your pc/mac +3. Run it + - Mac : /Applications/nwjs.app/Contents/MacOS/nwjs . + - Windows: Just darg the folder on the executable diff --git a/index.html b/index.html index 0acbf32..5db96c3 100644 --- a/index.html +++ b/index.html @@ -1,430 +1,486 @@ - - - - - - + + + + - Coin ATM - - - - -
The Transaction is complete!
-
-
Balance
- -


-
-

Select A Currency To Purchase


-
-
-
-
- - -
-
-
Settings
-
IP Address
-
-
-
-
-
- -
-
-

-
You Have Selected Current Price is:
-
At the current trading price you could buy bitcoin
-

-
-
+ + function getCoinPriceBTC(firstload) { + $.get( "https://blockchain.info/ticker", function( data ) { + usd = data.USD.last; + recent = data.USD.last; + orig_usd = usd; + usd = (usd * .01); + amount_per = Math.round((data.USD.last * .01)*100/100) + data.USD.last; + //amount_per = orig_usd - usd; + total = currentBalance/amount_per; + total = total - 0.00001000; + if (total < 0) { + total = 0; + } + + curAmount = total; + $("#amount_per").text(accounting.formatMoney(total,"$",8)); + $("#currentPrice").text(accounting.formatMoney(amount_per)); + + if (!firstload) { + $( "#loading" ).hide(); + + if (currentBalance <=0) { + $( "#buynow" ).hide(); + } + $( "#coinInfo" ).show(); + } + }); + } + + function getCoinPriceLTC(firstload) { + $.getJSON( "https://api.gdax.com/products/LTC-USD/book/", function( data ) { + var json = data; + usd = json.bids[0][0]; + recent = json.bids[0][0]; + orig_usd = usd; + //usd = (usd * .01); + amount_per = usd; + total = currentBalance/amount_per; + total = total - 0.00001000; + + if (total < 0) { + total = 0; + } + + curAmount = total; + $("#amount_per").text(accounting.formatMoney(total,"LTC ",8)); + $("#currentPrice").text(accounting.formatMoney(amount_per)); + + if (!firstload) { + $( "#loading" ).hide(); + + if (currentBalance <=0) { + $( "#buynow" ).hide(); + } + $( "#coinInfo" ).show(); + } + }); + } + + function balanceUP() { + + if (currentBalance > 0) { + $("#right").hide(); + } else { + $("#right").show(); + } + + //console.log(recent); + usd = markup; + orig_usd = markup; + usd = (usd * .10); + amount_per = orig_usd - usd; + total = currentBalance/amount_per; + total = total - 0.00001000; + + if (total < 0) { + total = 0; + } + curAmount = total; + $("#amount_per").text(accounting.formatMoney(total,"$",8)); + + if (currentBalance >0) { + $( "#buynow" ).show(); + } + } + + function capital(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + } + + function buyNow() { + $("#coinInfo").hide(); + clearInterval(ticker); + //let some cleanup happen + //sleep(1000); + //hide shit. + $("#coinInfo").hide(); + $("#getQR").show(); + console.log("Buying " + selCoin); + readNow(); + } + + function stopReading() { + console.log("Stop"); + $('#reader').html5_qrcode_stop(); + clearInterval(stopper); + } + + function settings() { + var os = require('os'); + var ifaces = os.networkInterfaces(); + var addresses = ""; + + Object.keys(ifaces).forEach(function (ifname) { + var alias = 0; + ifaces[ifname].forEach(function (iface) { + if ('IPv4' !== iface.family || iface.internal !== false) { + return; + } + if (alias >= 1) { + addresses += ifname + ':' + alias + iface.address + "
"; + } else { + addresses += ifname + ' ' + iface.address + "
"; + } + ++alias; + }); + }); + + $("#ipaddress").html(addresses); + clearInterval(ticker); + $( "#selectCoin" ).hide(); + $( "#allsettings" ).show(); + + } + + function readNow() { + reading = 1; + $('#reader').html5_qrcode(function(qrdata) { + console.log("Starting Read: " + qrdata); + qr = qrdata; + $("#getQR").hide(); + + var res = qr.split(":"); + console.log("Res[0]: " + res[0] +" Res[1]:" +res[1] + " QR:" + qr); + $("#tqrcode").text(res[1]); + tqrcode=res[1]; + $("#gotQR").show(); + $("#reallybuynow").show(); + + + stopper = setInterval(function(){stopReading()}, 100); + }, + function(error){ + console.log("Err: " + error); + }, + function(videoError){ + console.log("vErr: " + videoError); + }); + } + + function hideCompleted() { + $("#completed").hide(); + //$("#container").show(); + clearInterval(com); + //reset(); + location.reload(); + } + + function showCompleted() { + //let's hide the containter too + $("#container").hide(); + $("#completed").show(); + com = setInterval(function(){hideCompleted()}, 5000); + } + + /* @TODO: review api server... + * + */ + function completePurchase() { + //qrcode="2NAqo6t124UY3Kg5acGPzDDnJGSmsULtg14"; + if (selCoin == "bitcoin") { + url="https://"+bitcoinpayurl+"/api.php?key="+paykey+"&command=sendFrom&qr="+tqrcode+"&amount="+curAmount+"&type="+selCoin; + } else { + url="https://"+altcoinpayurl+"/api.php?key="+paykey+"&command=sendFrom&qr="+tqrcode+"&amount="+curAmount+"&type="+selCoin; + } + + $.get( url, function( data ) { + $("#gotQR").hide(); + showCompleted(); + }); + + console.log("https://"+bitcoinpayurl+"/api.php?key="+paykey+"&command=sendFrom&qr="+tqrcode+"&amount="+curAmount+"&type="+selCoin); + //$("#gotQR").hide(); + //showCompleted(); + } + + function sleep(milliseconds) { + var start = new Date().getTime(); + for (var i = 0; i < 1e7; i++) { + if ((new Date().getTime() - start) > milliseconds){ + break; + } + } + } + + + Coin ATM + + + + + + + + +
The Transaction is complete!
+ +
+
Balance
+ +


+ +
+

Select A Currency To Purchase


+
+
+ +
+
+
+ +
+
Settings
+
IP Address
+
+
+
-
-
-
-
-
Please Scan Your QR Code
-
-
-
-
-
Your QR Code is:
+
+ +
+ +
+ +
+

+
You Have Selected Current Price is:
+
At the current trading price you could buy bitcoin
+

+ +
+
+
+
+ +
+ +
+
Please Scan Your QR Code
+
+
+
+
+
+ +
+
Your QR Code is:
+
+


-
+
- + diff --git a/package.json b/package.json index 98b5de7..d8ad891 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,11 @@ "main": "index.html", "chromium-args": "--ignore-certificate-errors", "window": { - "toolbar": false, - "frame": false, - "fullscreen": true + "toolbar": true, + "frame": false, + "fullscreen": true + }, + "dependencies": { + } }