From cd40c3ae73aa11beeae361a8bc3107df671ecbab Mon Sep 17 00:00:00 2001 From: Dan Janosik Date: Fri, 11 May 2018 13:04:32 -0400 Subject: [PATCH] updated footer, style tweaks --- app.js | 18 ++++++++++++ app/env.js | 7 +++++ public/css/styling.css | 18 ++++++++++++ routes/baseActionsRouter.js | 10 +------ views/about.pug | 42 ++++++++++++++------------- views/layout.pug | 57 ++++++++++++++++++++++--------------- 6 files changed, 100 insertions(+), 52 deletions(-) diff --git a/app.js b/app.js index c981ec4..caf0957 100755 --- a/app.js +++ b/app.js @@ -20,6 +20,7 @@ var momentDurationFormat = require("moment-duration-format"); var rpcApi = require("./app/rpcApi.js"); var coins = require("./app/coins.js"); var request = require("request"); +var qrcode = require("qrcode"); var baseActionsRouter = require('./routes/baseActionsRouter'); @@ -82,9 +83,26 @@ function refreshExchangeRate() { app.runOnStartup = function() { global.env = env; global.coinConfig = coins[env.coin]; + global.coinConfigs = coins; console.log("Running RPC Explorer for coin: " + global.coinConfig.name); + if (env.donationAddresses) { + var getDonationAddressQrCode = function(coinId) { + qrcode.toDataURL(env.donationAddresses[coinId].address, function(err, url) { + console.log("coinId: " + coinId + ", url: " + url); + + global.donationAddressQrCodeUrls[coinId] = url; + }); + }; + + global.donationAddressQrCodeUrls = {}; + + env.donationAddresses.coins.forEach(function(item) { + getDonationAddressQrCode(item); + }); + } + if (global.exchangeRate == null) { refreshExchangeRate(); } diff --git a/app/env.js b/app/env.js index a841a84..1dca17e 100644 --- a/app/env.js +++ b/app/env.js @@ -33,4 +33,11 @@ module.exports = { username:"rpc-username", password:"rpc-password" }*/ + + donationAddresses:{ + coins:["BTC", "LTC"], + + "BTC":{address:"3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe", urlPrefix:"bitcoin:"}, + "LTC":{address:"ME4pXiXuWfEi1ANBDo9irUJVcZBhsTx14i", urlPrefix:"litecoin:"} + }, }; \ No newline at end of file diff --git a/public/css/styling.css b/public/css/styling.css index 49e627f..de6df0b 100755 --- a/public/css/styling.css +++ b/public/css/styling.css @@ -50,8 +50,26 @@ code, .monospace { text-decoration: underline; } +strong { + font-weight: 500; +} + @media (min-width: 1920px) { .container { max-width: 1800px; } +} + +footer { + border-top: solid 5px #597FA5; + border-bottom: solid 5px #597FA5; +} + +footer a { + color: #ccc; + text-decoration: underline; +} + +footer a:hover { + color: white; } \ No newline at end of file diff --git a/routes/baseActionsRouter.js b/routes/baseActionsRouter.js index c0708b8..54d4e61 100644 --- a/routes/baseActionsRouter.js +++ b/routes/baseActionsRouter.js @@ -580,15 +580,7 @@ router.get("/rpc-browser", function(req, res) { }); router.get("/about", function(req, res) { - qrcode.toDataURL('3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe', function(err, url) { - res.locals.bitcoinDonationQrCodeUrl = url; - - qrcode.toDataURL('ME4pXiXuWfEi1ANBDo9irUJVcZBhsTx14i', function(err, url) { - res.locals.litecoinDonationQrCodeUrl = url; - - res.render("about"); - }); - }); + res.render("about"); }); router.get("/fun", function(req, res) { diff --git a/views/about.pug b/views/about.pug index d57cdb1..034378c 100644 --- a/views/about.pug +++ b/views/about.pug @@ -11,23 +11,25 @@ block content p I built this tool because I wanted to use it myself. Whatever reasons one might have for running a full node (trustlessness, technical curiosity, supporting the network, etc) it's helpful to appreciate the "fullness" of your own node. With this explorer, you can not only explore the blockchain (in the traditional sense of the term "explorer"), but also explore the functional capabilities of your own node. - p If you'd like to support my continued work on this project, please consider a small donation: - - - div(class="row") - div(class="col-md-6 text-center") - a(href="bitcoin:3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe") Bitcoin (BTC) - br - span 3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe - br - img(src=bitcoinDonationQrCodeUrl, alt="3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe", style="border: solid 1px #ccc;") - br - - div(class="col-md-6 text-center") - a(href="litecoin:ME4pXiXuWfEi1ANBDo9irUJVcZBhsTx14i") Litecoin (LTC) - br - span ME4pXiXuWfEi1ANBDo9irUJVcZBhsTx14i - br - img(src=litecoinDonationQrCodeUrl, alt="ME4pXiXuWfEi1ANBDo9irUJVcZBhsTx14i", style="border: solid 1px #ccc;") - br - \ No newline at end of file + span Pull requests are welcome! + a(href="https://github.com/janoside/btc-rpc-explorer") github.com/janoside/btc-rpc-explorer + + if (env.donationAddresses) + hr + + p If you value this tool and want to support my work on this project, please consider a small donation. Anything is appreciated! + + div(class="row mb-5") + each coin, index in env.donationAddresses.coins + div(class="col text-center") + if (env.donationAddresses[coin].urlPrefix) + a(href=("bitcoin:" + env.donationAddresses["BTC"])) #{coinConfigs[coin].name} (#{coin}) + else + span #{coinConfigs[coin].name} (#{coin}) + + br + span #{env.donationAddresses[coin].address} + br + img(src=donationAddressQrCodeUrls[coin], alt=env.donationAddresses[coin].address, style="border: solid 1px #ccc;") + br + \ No newline at end of file diff --git a/views/layout.pug b/views/layout.pug index 9f2ebd8..d082246 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -6,7 +6,7 @@ html link(rel="stylesheet", href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css", integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4", crossorigin="anonymous") link(rel="stylesheet", href="https://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css") - link(rel="stylesheet", href="https://fonts.googleapis.com/css?family=Lato|Open+Sans|Cousine|Ubuntu") + link(rel="stylesheet", href="https://fonts.googleapis.com/css?family=Lato|Open+Sans|Cousine|Ubuntu:400,500,700") link(rel="stylesheet", href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css") link(rel='stylesheet', href='/css/styling.css') @@ -90,30 +90,41 @@ html div(style="margin-bottom: 30px;") - footer(class="pt-4 my-md-5 pt-md-5 border-top") - ul - li MIT-licensed source code available on github: - a(href="https://github.com/janoside/btc-rpc-explorer") janoside/btc-rpc-explorer - if (sourcecodeVersion) - span (@ - a(href=("https://github.com/janoside/btc-rpc-explorer/commit/" + sourcecodeVersion)) #{sourcecodeVersion} - span ) + footer(class="footer bg-dark text-light pt-3 pb-1 px-3", style="margin-top: 50px;") + div(class="container") + div(class="row") + div(class="col-md-6") + dl + dt Source + dd + a(href="https://github.com/janoside/btc-rpc-explorer") github.com/janoside/btc-rpc-explorer - li Public instance maintained at - a(href="https://btc-explorer.com") https://btc-explorer.com - - li Donate - ul - li - a(href="bitcoin:3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe") BTC - span - 3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe - li - a(href="litecoin:ME4pXiXuWfEi1ANBDo9irUJVcZBhsTx14i") LTC - span - ME4pXiXuWfEi1ANBDo9irUJVcZBhsTx14i - + dt Running Version + dd + a(href=("https://github.com/janoside/btc-rpc-explorer/commit/" + sourcecodeVersion)) #{sourcecodeVersion} + + dt Public Demo + dd + if (coinConfig.demoSiteUrl) + a(href=coinConfig.demoSiteUrl) #{coinConfig.demoSiteUrl} + else + a(href="https://btc-explorer.chaintools.io") https://btc-explorer.chaintools.io + + div(class="col-md-6 text-md-right") + dl + dt Support Development of #{coinConfig.siteTitle} + dd + div + each coin, index in env.donationAddresses.coins + div(style="display: inline-block;", class="text-center", class=(index > 0 ? "ml-3" : false)) + img(src=donationAddressQrCodeUrls[coin], alt=env.donationAddresses[coin].address, style="border: solid 1px #ccc;") + br + if (env.donationAddresses[coin].urlPrefix) + span #{coin}: + a(href=(env.donationAddresses[coin].urlPrefix + donationAddressQrCodeUrls[coin])) #{env.donationAddresses[coin].address.substring(0, 10)}... + else + span #{coin} - li © 2018 - a(href="https://danjanosik.com") Dan Janosik if (env.showForkBanner) div(class="d-none d-md-block")