Prevent caching of local css files
This commit is contained in:
+42
-27
@@ -10,11 +10,11 @@ function route_get_block(res, blockhash) {
|
||||
lib.get_block(blockhash, function (block) {
|
||||
if (block && block != 'There was an error. Check your console.') {
|
||||
if (blockhash == settings.block_page.genesis_block)
|
||||
res.render('block', { active: 'block', block: block, confirmations: settings.shared_pages.confirmations, txs: 'GENESIS', showSync: db.check_show_sync_message()});
|
||||
res.render('block', { active: 'block', block: block, confirmations: settings.shared_pages.confirmations, txs: 'GENESIS', showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
else {
|
||||
db.get_txs(block, function(txs) {
|
||||
if (txs.length > 0)
|
||||
res.render('block', { active: 'block', block: block, confirmations: settings.shared_pages.confirmations, txs: txs, showSync: db.check_show_sync_message()});
|
||||
res.render('block', { active: 'block', block: block, confirmations: settings.shared_pages.confirmations, txs: txs, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
else {
|
||||
// cannot find block in local database so get the data from the wallet directly
|
||||
var ntxs = [];
|
||||
@@ -41,7 +41,7 @@ function route_get_block(res, blockhash) {
|
||||
loop.next();
|
||||
});
|
||||
}, function() {
|
||||
res.render('block', { active: 'block', block: block, confirmations: settings.shared_pages.confirmations, txs: ntxs, showSync: db.check_show_sync_message()});
|
||||
res.render('block', { active: 'block', block: block, confirmations: settings.shared_pages.confirmations, txs: ntxs, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -62,6 +62,13 @@ function route_get_block(res, blockhash) {
|
||||
});
|
||||
}
|
||||
|
||||
function get_file_timestamp(file_name) {
|
||||
if (db.fs.existsSync(file_name))
|
||||
return parseInt(db.fs.statSync(file_name).mtimeMs / 1000);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/* GET functions */
|
||||
|
||||
function route_get_tx(res, txid) {
|
||||
@@ -73,10 +80,10 @@ function route_get_tx(res, txid) {
|
||||
lib.get_blockcount(function(blockcount) {
|
||||
if (settings.claim_address_page.enabled == true) {
|
||||
db.populate_claim_address_names(tx, function(tx) {
|
||||
res.render('tx', { active: 'tx', tx: tx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: tx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else
|
||||
res.render('tx', { active: 'tx', tx: tx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: tx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else {
|
||||
lib.get_rawtransaction(txid, function(rtx) {
|
||||
@@ -97,10 +104,10 @@ function route_get_tx(res, txid) {
|
||||
|
||||
if (settings.claim_address_page.enabled == true) {
|
||||
db.populate_claim_address_names(utx, function(utx) {
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount:-1, showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount:-1, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount:-1, showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount:-1, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
} else {
|
||||
// check if blockheight exists
|
||||
if (!rtx.blockheight && rtx.blockhash) {
|
||||
@@ -121,10 +128,10 @@ function route_get_tx(res, txid) {
|
||||
lib.get_blockcount(function(blockcount) {
|
||||
if (settings.claim_address_page.enabled == true) {
|
||||
db.populate_claim_address_names(utx, function(utx) {
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else {
|
||||
// cannot load tx
|
||||
@@ -146,10 +153,10 @@ function route_get_tx(res, txid) {
|
||||
lib.get_blockcount(function(blockcount) {
|
||||
if (settings.claim_address_page.enabled == true) {
|
||||
db.populate_claim_address_names(utx, function(utx) {
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -169,11 +176,11 @@ function route_get_index(res, error) {
|
||||
if (settings.index_page.page_header.show_last_updated == true) {
|
||||
// lookup last updated date
|
||||
db.get_stats(settings.coin.name, function (stats) {
|
||||
res.render('index', { active: 'home', error: error, last_updated: stats.blockchain_last_updated, showSync: db.check_show_sync_message()});
|
||||
res.render('index', { active: 'home', error: error, last_updated: stats.blockchain_last_updated, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else {
|
||||
// skip lookup of the last updated date and display the page now
|
||||
res.render('index', { active: 'home', error: error, last_updated: null, showSync: db.check_show_sync_message()});
|
||||
res.render('index', { active: 'home', error: error, last_updated: null, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +190,7 @@ function route_get_address(res, hash) {
|
||||
// lookup address in local collection
|
||||
db.get_address(hash, false, function(address) {
|
||||
if (address)
|
||||
res.render('address', { active: 'address', address: address, showSync: db.check_show_sync_message()});
|
||||
res.render('address', { active: 'address', address: address, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
else
|
||||
route_get_index(res, hash + ' not found');
|
||||
});
|
||||
@@ -197,12 +204,12 @@ function route_get_claim_form(res, hash) {
|
||||
// check if a hash was passed in
|
||||
if (hash == null || hash == '') {
|
||||
// no hash so just load the claim page without an address
|
||||
res.render("claim_address", { active: "claim-address", hash: hash, claim_name: '', showSync: db.check_show_sync_message()});
|
||||
res.render("claim_address", { active: "claim-address", hash: hash, claim_name: '', showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
} else {
|
||||
// lookup hash in the address collection
|
||||
db.get_address(hash, false, function(address) {
|
||||
// load the claim page regardless of whether the address exists or not
|
||||
res.render("claim_address", { active: "claim-address", hash: hash, claim_name: (address == null || address.name == null ? '' : address.name), showSync: db.check_show_sync_message()});
|
||||
res.render("claim_address", { active: "claim-address", hash: hash, claim_name: (address == null || address.name == null ? '' : address.name), showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
}
|
||||
} else
|
||||
@@ -219,7 +226,7 @@ router.get('/info', function(req, res) {
|
||||
// ensure api page is enabled
|
||||
if (settings.api_page.enabled == true) {
|
||||
// load the api page
|
||||
res.render('info', { active: 'info', address: req.headers.host, showSync: db.check_show_sync_message() });
|
||||
res.render('info', { active: 'info', address: req.headers.host, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
} else {
|
||||
// api page is not enabled so default to the index page
|
||||
route_get_index(res, null);
|
||||
@@ -254,7 +261,9 @@ router.get('/markets/:market/:coin_symbol/:pair_symbol', function(req, res) {
|
||||
},
|
||||
market: market_id,
|
||||
last_updated: stats.markets_last_updated,
|
||||
showSync: db.check_show_sync_message()
|
||||
showSync: db.check_show_sync_message(),
|
||||
styleHash: get_file_timestamp('./public/css/style.scss'),
|
||||
themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css')
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@@ -270,7 +279,9 @@ router.get('/markets/:market/:coin_symbol/:pair_symbol', function(req, res) {
|
||||
},
|
||||
market: market_id,
|
||||
last_updated: null,
|
||||
showSync: db.check_show_sync_message()
|
||||
showSync: db.check_show_sync_message(),
|
||||
styleHash: get_file_timestamp('./public/css/style.scss'),
|
||||
themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css')
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -303,7 +314,9 @@ router.get('/richlist', function(req, res) {
|
||||
distd: distribution.t_76_100,
|
||||
diste: distribution.t_101plus,
|
||||
last_updated: (settings.richlist_page.page_header.show_last_updated == true ? stats.richlist_last_updated : null),
|
||||
showSync: db.check_show_sync_message()
|
||||
showSync: db.check_show_sync_message(),
|
||||
styleHash: get_file_timestamp('./public/css/style.scss'),
|
||||
themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css')
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@@ -325,11 +338,11 @@ router.get('/movement', function(req, res) {
|
||||
if (settings.movement_page.page_header.show_last_updated == true) {
|
||||
// lookup last updated date
|
||||
db.get_stats(settings.coin.name, function (stats) {
|
||||
res.render('movement', {active: 'movement', last_updated: stats.blockchain_last_updated, showSync: db.check_show_sync_message()});
|
||||
res.render('movement', {active: 'movement', last_updated: stats.blockchain_last_updated, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else {
|
||||
// skip lookup of the last updated date and display the page now
|
||||
res.render('movement', {active: 'movement', last_updated: null, showSync: db.check_show_sync_message()});
|
||||
res.render('movement', {active: 'movement', last_updated: null, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
}
|
||||
} else {
|
||||
// movement page is not enabled so default to the index page
|
||||
@@ -344,11 +357,11 @@ router.get('/network', function(req, res) {
|
||||
if (settings.network_page.page_header.show_last_updated == true) {
|
||||
// lookup last updated date
|
||||
db.get_stats(settings.coin.name, function (stats) {
|
||||
res.render('network', {active: 'network', last_updated: stats.network_last_updated, showSync: db.check_show_sync_message()});
|
||||
res.render('network', {active: 'network', last_updated: stats.network_last_updated, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else {
|
||||
// skip lookup of the last updated date and display the page now
|
||||
res.render('network', {active: 'network', last_updated: null, showSync: db.check_show_sync_message()});
|
||||
res.render('network', {active: 'network', last_updated: null, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
}
|
||||
} else {
|
||||
// network page is not enabled so default to the index page
|
||||
@@ -364,11 +377,11 @@ router.get('/masternodes', function(req, res) {
|
||||
if (settings.masternodes_page.page_header.show_last_updated == true) {
|
||||
// lookup last updated date
|
||||
db.get_stats(settings.coin.name, function (stats) {
|
||||
res.render('masternodes', {active: 'masternodes', last_updated: stats.masternodes_last_updated, showSync: db.check_show_sync_message()});
|
||||
res.render('masternodes', {active: 'masternodes', last_updated: stats.masternodes_last_updated, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
});
|
||||
} else {
|
||||
// skip lookup of the last updated date and display the page now
|
||||
res.render('masternodes', {active: 'masternodes', last_updated: null, showSync: db.check_show_sync_message()});
|
||||
res.render('masternodes', {active: 'masternodes', last_updated: null, showSync: db.check_show_sync_message(), styleHash: get_file_timestamp('./public/css/style.scss'), themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css') });
|
||||
}
|
||||
} else {
|
||||
// masternode page is not enabled so default to the index page
|
||||
@@ -401,7 +414,9 @@ router.get('/reward', function(req, res) {
|
||||
heavy: heavy,
|
||||
votes: votes,
|
||||
last_updated: (settings.blockchain_specific.heavycoin.reward_page.page_header.show_last_updated == true ? stats.reward_last_updated : null),
|
||||
showSync: db.check_show_sync_message()
|
||||
showSync: db.check_show_sync_message(),
|
||||
styleHash: get_file_timestamp('./public/css/style.scss'),
|
||||
themeHash: get_file_timestamp('./public/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css')
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+2
-2
@@ -5,14 +5,14 @@ html(lang='en')
|
||||
meta(name='viewport' content='width=device-width, initial-scale=1')
|
||||
meta(http-equiv='Content-Language', content='en')
|
||||
title=settings.shared_pages.page_title
|
||||
link(rel='stylesheet', href='/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css')
|
||||
link(rel='stylesheet', href='/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css' + (themeHash == null ? '' : '?h=' + themeHash))
|
||||
link(rel='stylesheet', href='https://use.fontawesome.com/releases/v5.15.4/css/all.css')
|
||||
if active == 'markets' || active == 'richlist'
|
||||
link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/jquery.jqplot.min.css')
|
||||
if active == 'network'
|
||||
link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/4.1.4/css/flag-icons.min.css')
|
||||
link(rel='stylesheet', type='text/css', href='https://cdn.datatables.net/v/bs5/dt-1.11.3/datatables.min.css')
|
||||
link(rel='stylesheet', href='/css/style.min.css')
|
||||
link(rel='stylesheet', href='/css/style.min.css' + (styleHash == null ? '' : '?h=' + styleHash))
|
||||
script(type='text/javascript', src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js', integrity='sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==', crossorigin='anonymous', referrerpolicy='no-referrer')
|
||||
script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js', integrity='sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p', crossorigin='anonymous')
|
||||
if active == 'markets' || active == 'richlist'
|
||||
|
||||
Reference in New Issue
Block a user