From 3a3092e8f0f210f3b0b0df3e023a86c58c958cb6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 16 Oct 2015 01:45:53 -0400 Subject: Set max width of logo image --- public/css/calculator.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/css/calculator.less b/public/css/calculator.less index 72e98976..279503be 100644 --- a/public/css/calculator.less +++ b/public/css/calculator.less @@ -40,7 +40,7 @@ div#calculator { p#address { padding-top: 10px; } #title { display: none; } #title a { color: #000; text-decoration: none; } - #logo { display: none; padding: 10px 0; margin-bottom: 10px; max-height: 250px; } + #logo { display: none; padding: 10px 0; margin-bottom: 10px; max-height: 250px; max-width: 440px; } #error { margin-top: 10px; } } -- cgit v1.2.3 From 7ebdc70771e98b1355f20535573c7a90a37d5601 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 16 Oct 2015 01:46:25 -0400 Subject: Ignore passenger files and tmp folder --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 21623d60..2391f700 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ npm-debug.log public/js/rates.json src/config.coffee config.js +passenger* +tmp -- cgit v1.2.3 From 8c510e7cb4ae2e69eed09d2ce9eb4b1ff1efbc7d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 16 Oct 2015 01:50:13 -0400 Subject: Floathouse logo --- public/assets/img/floathouse.png | Bin 0 -> 33851 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 public/assets/img/floathouse.png diff --git a/public/assets/img/floathouse.png b/public/assets/img/floathouse.png new file mode 100644 index 00000000..4da664e3 Binary files /dev/null and b/public/assets/img/floathouse.png differ -- cgit v1.2.3 From f76160f6dffaffbd189776eb39e67e4e96ba2f0b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 14 Sep 2015 22:06:15 -0700 Subject: Set logo width to 100% --- public/css/calculator.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/css/calculator.less b/public/css/calculator.less index 279503be..bf2de93e 100644 --- a/public/css/calculator.less +++ b/public/css/calculator.less @@ -40,7 +40,7 @@ div#calculator { p#address { padding-top: 10px; } #title { display: none; } #title a { color: #000; text-decoration: none; } - #logo { display: none; padding: 10px 0; margin-bottom: 10px; max-height: 250px; max-width: 440px; } + #logo { display: none; padding: 10px 0; margin-bottom: 10px; max-height: 250px; width: 100%; } #error { margin-top: 10px; } } -- cgit v1.2.3 From 5e6ec1f0ff132af2a539fc9a84551326dab162ee Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 16 Sep 2015 20:46:36 -0700 Subject: Don't detect static asset changes --- app.js | 3 ++- src/app.coffee | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 8fd499d2..c82f895e 100644 --- a/app.js +++ b/app.js @@ -146,7 +146,8 @@ app.get('/:user', cache, users.show); app.use(require('connect-assets')({ - src: 'public' + src: 'public', + detectChanges: false })); app.use(function(err, req, res, next) { diff --git a/src/app.coffee b/src/app.coffee index 1ea1d2cf..3208ae49 100644 --- a/src/app.coffee +++ b/src/app.coffee @@ -89,7 +89,7 @@ app.get('/:user/report', authorize, transactions.index) app.get('/:user.json', users.json) app.get('/:user', cache, users.show) -app.use(require('connect-assets')(src: 'public')) +app.use(require('connect-assets')(src: 'public', detectChanges: false)) app.use((err, req, res, next) -> res.status(500) -- cgit v1.2.3 From ae10d9f202fb1feb4715614f7be435f0e3997eb3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 15 Oct 2015 22:44:40 -0700 Subject: Make QR code smaller --- public/js/calculator.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee index d173403c..cc2dcece 100644 --- a/public/js/calculator.coffee +++ b/public/js/calculator.coffee @@ -105,7 +105,7 @@ updateTotal = -> $('#total').html(total.toString()) $('#qr').html('') - new QRCode('qr', text: "bitcoin:#{g.user.address}?amount=#{g.amount_requested.toString()}", width: 320, height: 320) + new QRCode('qr', text: "bitcoin:#{g.user.address}?amount=#{g.amount_requested.toString()}", width: 280, height: 280) listen = -> setTimeout(listen, 10000) -- cgit v1.2.3 From 59528d7c0a301c805b03bf77492e489c0e723e79 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Nov 2015 12:56:12 -0800 Subject: Bitcoin tips page --- app.js | 17 +++++++++++++++-- src/app.coffee | 10 ++++++++++ views/tips.html | 11 +++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 views/tips.html diff --git a/app.js b/app.js index c82f895e..dab0d431 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,5 @@ (function() { - var RedisStore, app, authorize, bodyParser, cache, calculator, config, cookieParser, express, fetchRates, fs, passport, path, request, session, sessionStore, sessions, transactions, users; + var RedisStore, app, authorize, bodyParser, cache, calculator, config, cookieParser, express, fetchRates, fs, passport, path, request, session, sessionStore, sessions, tips, transactions, users; request = require('request'); @@ -103,7 +103,7 @@ return setTimeout(fetchRates, 120000); })(); - app.get('/', cache, sessions["new"]); + tips = app.get('/', cache, sessions["new"]); app.get('/register', cache, users["new"]); @@ -113,6 +113,19 @@ app.get('/address', cache, calculator.address); + app.get('/tips', cache, function(req, res) { + return res.render('tips', { + notice: true, + layout: 'layout', + js: (function() { + return global.js; + }), + css: (function() { + return global.css; + }) + }); + }); + app.get('/login', cache, sessions["new"]); app.post('/login', sessions.create); diff --git a/src/app.coffee b/src/app.coffee index 3208ae49..f62b7696 100644 --- a/src/app.coffee +++ b/src/app.coffee @@ -62,11 +62,21 @@ do fetchRates = -> ) setTimeout(fetchRates, 120000) +tips = + app.get('/', cache, sessions.new) app.get('/register', cache, users.new) app.get('/ticker', cache, calculator.ticker) app.get('/sweep', calculator.sweep) app.get('/address', cache, calculator.address) +app.get('/tips', cache, (req, res) -> + res.render('tips', + notice: true, + layout: 'layout', + js: (-> global.js), + css: (-> global.css) + ) +) app.get('/login', cache, sessions.new) app.post('/login', sessions.create) diff --git a/views/tips.html b/views/tips.html new file mode 100644 index 00000000..a4ac19ba --- /dev/null +++ b/views/tips.html @@ -0,0 +1,11 @@ +

Congratulations

+ +

+If you're here, you've probably received a Bitcoin tip from me. I've created a short YouTube video to explain what to do next and show how you can create your own paper wallets. Enjoy, and if you have any questions, don't hesitate to contact me!

+ +

+-Adam Soltys
+asoltys@gmail.com +

+ + -- cgit v1.2.3 From c1cd55151fdea2bd80e27a6a9dfc905a243dd379 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 11 Nov 2015 13:25:35 -0800 Subject: Fetch remote image files and store locally --- .gitignore | 2 +- public/assets/img/logos/yummyyards.png | Bin 0 -> 22968 bytes public/js/calculator.coffee | 4 +++- routes/users.js | 17 +++++++++++++++-- src/routes/users.coffee | 10 ++++++++++ 5 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 public/assets/img/logos/yummyyards.png diff --git a/.gitignore b/.gitignore index 2391f700..ca800b2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -public/bitcoins.pdf node_modules builtAssets database.json @@ -9,3 +8,4 @@ src/config.coffee config.js passenger* tmp +public/img/assets/logos diff --git a/public/assets/img/logos/yummyyards.png b/public/assets/img/logos/yummyyards.png new file mode 100644 index 00000000..e8f59c9f Binary files /dev/null and b/public/assets/img/logos/yummyyards.png differ diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee index cc2dcece..cc45cae5 100644 --- a/public/js/calculator.coffee +++ b/public/js/calculator.coffee @@ -59,7 +59,9 @@ setup = -> $('#title').html("#{g.user.title}").show() if g.user.logo - $('#logo').attr('src', g.user.logo).show() + ext = g.user.logo.substr(g.user.logo.length - 3) + src = "/assets/img/logos/#{g.user.username}.#{ext}" + $('#logo').attr('src', src).show() getAddress() diff --git a/routes/users.js b/routes/users.js index c5e0f0ee..28b89797 100644 --- a/routes/users.js +++ b/routes/users.js @@ -1,5 +1,5 @@ (function() { - var bcrypt, config, db; + var bcrypt, config, db, fs, request; db = require("../redis"); @@ -7,6 +7,10 @@ bcrypt = require('bcrypt'); + fs = require('fs'); + + request = require('request'); + module.exports = function(sessions) { return { exists: function(req, res) { @@ -34,7 +38,7 @@ }, show: function(req, res) { return db.hgetall("user:" + req.params.user, function(err, obj) { - var options; + var ext, options, path; if (obj) { options = { user: req.params.user, @@ -50,6 +54,15 @@ if (req.query.verified != null) { options.verified = true; } + if (obj.logo.length > 3) { + ext = obj.logo.substr(obj.logo.length - 3); + path = "public/assets/img/logos/" + obj.username + "." + ext; + fs.lstat(path, function(err, stats) { + if ((ext === 'jpg' || ext === 'png' || ext === 'gif') && (err || !stats.isFile())) { + return request("" + obj.logo).pipe(fs.createWriteStream(path)); + } + }); + } res.render('users/show', options); return delete req.session.verified; } else { diff --git a/src/routes/users.coffee b/src/routes/users.coffee index d3ecabaf..b1e4fd9a 100644 --- a/src/routes/users.coffee +++ b/src/routes/users.coffee @@ -1,6 +1,8 @@ db = require("../redis") config = require("../config") bcrypt = require('bcrypt') +fs = require('fs') +request = require('request') module.exports = (sessions) -> exists: (req, res) -> @@ -33,6 +35,14 @@ module.exports = (sessions) -> if req.query.verified? options.verified = true + if obj.logo.length > 3 + ext = obj.logo.substr(obj.logo.length - 3) + path = "public/assets/img/logos/#{obj.username}.#{ext}" + fs.lstat(path, (err, stats) -> + if ext in ['jpg', 'png', 'gif'] and (err or not stats.isFile()) + request("#{obj.logo}").pipe(fs.createWriteStream(path)) + ) + res.render('users/show', options) delete req.session.verified else -- cgit v1.2.3 From cfed6f916ea7d63821385db338daecc4a2bda4c2 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 11 Nov 2015 14:59:37 -0800 Subject: New payment received sound --- public/js/calculator.coffee | 5 +---- public/success.wav | Bin 0 -> 57388 bytes views/users/show.html | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) create mode 100644 public/success.wav diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee index cc45cae5..4d6b0013 100644 --- a/public/js/calculator.coffee +++ b/public/js/calculator.coffee @@ -116,17 +116,14 @@ listen = -> g.blockchain = new WebSocket("wss://ws.blockchain.info/inv") g.blockchain.onopen = -> - $('#connection').fadeIn().removeClass('glyphicon-exclamation-sign').addClass('glyphicon-signal') clear(SOCKET_FAIL) g.blockchain.send('{"op":"addr_sub", "addr":"' + g.user.address + '"}') g.blockchain.onerror = -> - $('#connection').addClass('glyphicon-exclamation-sign').removeClass('glyphicon-signal') g.blockchain = null fail(SOCKET_FAIL) g.blockchain.onclose = -> - $('#connection').addClass('glyphicon-exclamation-sign').removeClass('glyphicon-signal') g.blockchain = null fail(SOCKET_FAIL) listen() @@ -151,7 +148,7 @@ logTransaction = (txid, amount) -> $('#amount').blur() $('#payment').hide() $('#received').fadeIn('slow') - $('#chaching')[0].play() + $('#success')[0].play() g.user.index++ $.post("/#{g.user.username}/transactions", diff --git a/public/success.wav b/public/success.wav new file mode 100644 index 00000000..50547d2b Binary files /dev/null and b/public/success.wav differ diff --git a/views/users/show.html b/views/users/show.html index 5b8314a3..f37afad4 100644 --- a/views/users/show.html +++ b/views/users/show.html @@ -44,6 +44,6 @@ Your email has been verified. Thank you! -