Add 2 network charts to page header
-Hashrate chart is populated from get_hashrate -Difficulty chart is populated from get_difficulty -Added a networkhistories collection to hold the new network data -Index sync and resync functions now check for and update network history data at the end of the sync process -restore_backup.sh and delete_database.sh scripts now drop the new networkhistories collection -Added a new javascript library chartjs-plugin-crosshair which adds crosshair functionality to the new chart.js line charts -Added new settings to settings.json for controlling things like collecting network_history data, independently enabling/disabling the network charts and changing colors of various aspects of the charts -Updated README to introduce the network charts and added a line for the chartjs-plugin-crosshair library
This commit is contained in:
@@ -78,6 +78,7 @@ Table of Contents
|
||||
- Luxon v2.1.1
|
||||
- jqPlot v1.0.9
|
||||
- Chart.js v3.6.1
|
||||
- chartjs-plugin-crosshair v1.2.0 ([https://github.com/abelheinsbroek/chartjs-plugin-crosshair](https://github.com/abelheinsbroek/chartjs-plugin-crosshair))
|
||||
- flag-icon-css v4.1.4 ([https://github.com/lipis/flag-icon-css](https://github.com/lipis/flag-icon-css))
|
||||
- Mobile-friendly
|
||||
- Sass support
|
||||
@@ -161,6 +162,9 @@ Table of Contents
|
||||
- **Price:** Displays the current market price (value measured using default market pair)
|
||||
- **Market Cap:** Displays the current market cap value in (value measured using default market pair)
|
||||
- **Logo:** Display an image of your coin logo
|
||||
- Configurable network charts that can be independently displayed in the header of any page
|
||||
- **Hashrate chart:** Line graph listing of the estimated network hashes per second over the last number of blocks *\*Requires a full sync before network data will start being collected*
|
||||
- **Difficulty chart:** Line graph listing of the block difficulty over the last number of blocks *\*Requires a full sync before network data will start being collected*
|
||||
- Add as many custom social links to the explorer footer as desired. Useful for linking to github, twitter, coinmarketcap or any other social media or external links as necessary.
|
||||
- Custom rpc/api command support which increases blockchain compatibility. Supported cmds:
|
||||
- **getnetworkhashps:** Returns the estimated network hashes per second
|
||||
|
||||
@@ -575,6 +575,15 @@ app.use('/ext/getmasternoderewardstotal/:hash/:since', function(req, res) {
|
||||
res.end('This method is disabled');
|
||||
});
|
||||
|
||||
app.use('/ext/getnetworkchartdata', function(req, res) {
|
||||
db.get_network_chart_data(function(data) {
|
||||
if (data)
|
||||
res.send(data);
|
||||
else
|
||||
res.send();
|
||||
});
|
||||
});
|
||||
|
||||
var market_data = [];
|
||||
var market_count = 0;
|
||||
|
||||
@@ -680,6 +689,7 @@ settings.api_page.public_apis.rpc.getmasternodelist = { "enabled": false };
|
||||
app.set('explorer_version', package_metadata.version);
|
||||
app.set('locale', locale);
|
||||
app.set('coin', settings.coin);
|
||||
app.set('network_history', settings.network_history);
|
||||
app.set('shared_pages', settings.shared_pages);
|
||||
app.set('index_page', settings.index_page);
|
||||
app.set('block_page', settings.block_page);
|
||||
|
||||
@@ -8,6 +8,7 @@ var mongoose = require('mongoose'),
|
||||
Richlist = require('../models/richlist'),
|
||||
Peers = require('../models/peers'),
|
||||
Heavy = require('../models/heavy'),
|
||||
NetworkHistory = require('../models/networkhistory'),
|
||||
lib = require('./explorer'),
|
||||
settings = require('./settings'),
|
||||
locale = require('./locale'),
|
||||
@@ -826,6 +827,65 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
// updates network history (nethash and difficulty) data
|
||||
// height: current block height
|
||||
update_network_history: function(height, cb) {
|
||||
// lookup network history data for this block height
|
||||
NetworkHistory.findOne({blockindex: height}, function(err, network_hist) {
|
||||
// check if there is already network history data for this block height
|
||||
if (!network_hist) {
|
||||
// lookup network hashrate
|
||||
lib.get_hashrate(function(hashrate) {
|
||||
// lookup network difficulty
|
||||
lib.get_difficulty(function(difficulty) {
|
||||
// create a new network history record
|
||||
var newNetworkHistory = new NetworkHistory({
|
||||
blockindex: height,
|
||||
nethash: (hashrate == null || hashrate == '-' ? 0 : hashrate),
|
||||
difficulty: difficulty
|
||||
});
|
||||
|
||||
// save the new network history record
|
||||
newNetworkHistory.save(function(err) {
|
||||
// check for errors
|
||||
if (err) {
|
||||
console.log('error updating network history: ' + err);
|
||||
return cb();
|
||||
} else {
|
||||
// get the count of network history records
|
||||
NetworkHistory.find({}).countDocuments(function(err, count) {
|
||||
// read maximum allowed records from settings
|
||||
let max_records = settings.network_history.max_saved_records;
|
||||
|
||||
// check if the current count of records is greater than the maximum allowed
|
||||
if (count > max_records) {
|
||||
// prune network history records to keep collection small and quick to access
|
||||
NetworkHistory.find().select('blockindex').sort({blockindex: 1}).limit(count - max_records).exec(function(err, records) {
|
||||
// create a list of the oldest network history ids that will be deleted
|
||||
const ids = records.map((doc) => doc.blockindex);
|
||||
|
||||
// delete old network history records
|
||||
NetworkHistory.deleteMany({blockindex: {$in: ids}}, function(err) {
|
||||
console.log('network history update complete');
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.log('network history update complete');
|
||||
return cb();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// skip saving network history data when the block hasn't moved since saving last time
|
||||
return cb();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// updates market data for given market; called by sync.js
|
||||
update_markets_db: function(market, coin_symbol, pair_symbol, cb) {
|
||||
// check if market exists
|
||||
@@ -1377,5 +1437,12 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
get_network_chart_data: function(cb) {
|
||||
// lookup all network history data for populating network charts
|
||||
NetworkHistory.find().sort({blockindex: 1}).exec(function (err, data) {
|
||||
return cb(data);
|
||||
});
|
||||
},
|
||||
|
||||
fs: fs
|
||||
};
|
||||
+116
-1
@@ -79,6 +79,15 @@ exports.coin = {
|
||||
"symbol": "EXOR"
|
||||
};
|
||||
|
||||
// network_history: a collection of settings that controls saving of extra historical network data during a block sync
|
||||
exports.network_history = {
|
||||
// enabled: Enable/disable the saving of additional network history data (true/false)
|
||||
// If set to false, historical data such as network hashrate and difficulty values will not be saved or available for network charts
|
||||
"enabled": true,
|
||||
// max_saved_records: The maximum # of blocks to save historical data for
|
||||
"max_saved_records": 120
|
||||
};
|
||||
|
||||
/* Shared page settings */
|
||||
|
||||
// shared_pages: a collection of settings that pertain to all webpages for the explorer
|
||||
@@ -127,7 +136,7 @@ exports.shared_pages = {
|
||||
// Hybrid: Display both the proof-of-work and proof-of-stake difficulty values
|
||||
"difficulty": "POS",
|
||||
// show_hashrate: Determine whether to show network hash rate where applicable (true/false)
|
||||
// If set to false, the /api/getnetworkhashps and /ext/getsummary apis will no longer show hash rate information
|
||||
// If set to false, the /api/getnetworkhashps and /ext/getsummary apis will no longer show hash rate information, and the network hashrate chart will automatically be disabled
|
||||
"show_hashrate": true,
|
||||
// page_header: A collection of settings that pertain to the page header that is displayed at the top of all pages
|
||||
"page_header": {
|
||||
@@ -250,6 +259,60 @@ exports.shared_pages = {
|
||||
"image_path": "/img/page-title-img.png",
|
||||
// enable_animation: Enable/disable the flip/spin animation on the page title image (true/false)
|
||||
"enable_animation": true
|
||||
},
|
||||
// network_charts: A collection of settings that pertain to the network hashrate and difficulty line charts displayed on page header of all pages
|
||||
// NOTE: You can independently show/hide individual charts by changing the show_nethash_chart and show_difficulty_chart values in the settings for each page
|
||||
// The "network_history.enabled" setting must be set to true for network charts to work correctly
|
||||
// If the "network_history.enabled" setting is false, all network charts will be completely disabled, regardless of their independent settings
|
||||
"network_charts": {
|
||||
// nethash_chart: A collection of settings that pertain to the network hashrate chart
|
||||
"nethash_chart": {
|
||||
// enabled: Enable/disable the network hashrate chart (true/false)
|
||||
// If set to false, the network hashrate chart will be completely inaccessible
|
||||
// NOTE: The `shared_pages.show_hashrate` option must be set to true or else the network hashrate chart will be completely inaccessible
|
||||
"enabled": true,
|
||||
// bgcolor: Change the background color of the network hashrate chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"bgcolor": "#ffffff",
|
||||
// line_color: Change the line color of the network hashrate chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"line_color": "rgba(54, 162, 235, 1)",
|
||||
// fill_color: Change the fill color of the network hashrate chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"fill_color": "rgba(54, 162, 235, 0.2)",
|
||||
// crosshair_color: Change the vertical crosshair line color of the network hashrate chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"crosshair_color": "#000000"
|
||||
},
|
||||
// difficulty_chart: A collection of settings that pertain to the network difficulty chart
|
||||
"difficulty_chart": {
|
||||
// enabled: Enable/disable the network difficulty chart (true/false)
|
||||
// If set to false, the network difficulty chart will be completely inaccessible
|
||||
"enabled": true,
|
||||
// bgcolor: Change the background color of the network difficulty chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"bgcolor": "#ffffff",
|
||||
// line_color: Change the line color of the network difficulty chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"line_color": "rgba(255, 99, 132, 1)",
|
||||
// fill_color: Change the fill color of the network difficulty chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"fill_color": "rgba(255, 99, 132, 0.2)",
|
||||
// crosshair_color: Change the vertical crosshair line color of the network difficulty chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"crosshair_color": "#000000"
|
||||
},
|
||||
// reload_chart_seconds: The time in seconds to automatically reload the network chart data from the server
|
||||
// Set to 0 to disable automatic reloading of chart data
|
||||
"reload_chart_seconds": 60
|
||||
}
|
||||
},
|
||||
// page_footer: A collection of settings that pertain to the page footer that is displayed at the bottom of all pages
|
||||
@@ -294,6 +357,10 @@ exports.shared_pages = {
|
||||
exports.index_page = {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": true,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": true,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": true,
|
||||
// page_header: a collection of settings that pertain to the index page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -323,6 +390,10 @@ exports.index_page = {
|
||||
exports.block_page = {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the block page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -342,6 +413,10 @@ exports.block_page = {
|
||||
exports.transaction_page = {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the transaction/tx page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -364,6 +439,10 @@ exports.transaction_page = {
|
||||
exports.address_page = {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the address page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -398,6 +477,10 @@ exports.address_page = {
|
||||
exports.error_page = {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the error page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -418,6 +501,10 @@ exports.masternodes_page = {
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the masternodes page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -446,6 +533,10 @@ exports.movement_page = {
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the movement page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -484,6 +575,10 @@ exports.network_page = {
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the network page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -528,6 +623,10 @@ exports.richlist_page = {
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the richlist/top100 page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -579,6 +678,10 @@ exports.markets_page = {
|
||||
"enabled": false,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the markets page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -714,6 +817,10 @@ exports.api_page = {
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the api page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -951,6 +1058,10 @@ exports.claim_address_page = {
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the claim address page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -1073,6 +1184,10 @@ exports.blockchain_specific = {
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the reward page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
var mongoose = require('mongoose'),
|
||||
Schema = mongoose.Schema;
|
||||
|
||||
var NetworkHistorySchema = new Schema({
|
||||
blockindex: {type: Number, default: 0, index: true},
|
||||
nethash: { type: Number, default: 0 },
|
||||
difficulty: { type: Number, default: 0 }
|
||||
}, {id: false});
|
||||
|
||||
module.exports = mongoose.model('NetworkHistory', NetworkHistorySchema);
|
||||
@@ -21,6 +21,7 @@ sudo touch "${SCRIPT_PATH}/del.tmp" && mongo <<EOF
|
||||
use explorerdb
|
||||
db.addresses.drop()
|
||||
db.addresstxes.drop()
|
||||
db.networkhistories.drop()
|
||||
db.coinstats.drop()
|
||||
db.heavies.drop()
|
||||
db.markets.drop()
|
||||
|
||||
@@ -34,6 +34,7 @@ sudo mongo <<EOF
|
||||
use explorerdb
|
||||
db.addresses.drop()
|
||||
db.addresstxes.drop()
|
||||
db.networkhistories.drop()
|
||||
db.coinstats.drop()
|
||||
db.heavies.drop()
|
||||
db.markets.drop()
|
||||
|
||||
+23
-8
@@ -339,11 +339,14 @@ if (database == 'peers') {
|
||||
db.get_stats(settings.coin.name, function(nstats) {
|
||||
// check for and update heavycoin data if applicable
|
||||
update_heavy(settings.coin.name, stats.count, 20, settings.blockchain_specific.heavycoin.enabled, function(heavy) {
|
||||
// always check for and remove the sync msg if exists
|
||||
remove_sync_message();
|
||||
// check for and update network history data if applicable
|
||||
update_network_history(nstats.last, settings.network_history.enabled, function(network_hist) {
|
||||
// always check for and remove the sync msg if exists
|
||||
remove_sync_message();
|
||||
|
||||
console.log('reindex complete (block: %s)', nstats.last);
|
||||
exit();
|
||||
console.log('reindex complete (block: %s)', nstats.last);
|
||||
exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -383,11 +386,14 @@ if (database == 'peers') {
|
||||
db.get_stats(settings.coin.name, function(nstats) {
|
||||
// check for and update heavycoin data if applicable
|
||||
update_heavy(settings.coin.name, stats.count, 20, settings.blockchain_specific.heavycoin.enabled, function(heavy) {
|
||||
// always check for and remove the sync msg if exists
|
||||
remove_sync_message();
|
||||
// check for and update network history data if applicable
|
||||
update_network_history(nstats.last, settings.network_history.enabled, function(network_hist) {
|
||||
// always check for and remove the sync msg if exists
|
||||
remove_sync_message();
|
||||
|
||||
console.log('update complete (block: %s)', nstats.last);
|
||||
exit();
|
||||
console.log('update complete (block: %s)', nstats.last);
|
||||
exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -580,6 +586,15 @@ function update_heavy(coin, height, count, heavycoin_enabled, cb) {
|
||||
return cb(false);
|
||||
}
|
||||
|
||||
function update_network_history(height, network_history_enabled, cb) {
|
||||
if (network_history_enabled == true) {
|
||||
db.update_network_history(height, function() {
|
||||
return cb(true);
|
||||
});
|
||||
} else
|
||||
return cb(false);
|
||||
}
|
||||
|
||||
function check_show_sync_message(blocks_to_sync) {
|
||||
var retVal = false;
|
||||
var filePath = './tmp/show_sync_message.tmp';
|
||||
|
||||
+116
-1
@@ -78,6 +78,15 @@
|
||||
"symbol": "EXOR"
|
||||
},
|
||||
|
||||
// network_history: a collection of settings that controls saving of extra historical network data during a block sync
|
||||
"network_history": {
|
||||
// enabled: Enable/disable the saving of additional network history data (true/false)
|
||||
// If set to false, historical data such as network hashrate and difficulty values will not be saved or available for network charts
|
||||
"enabled": true,
|
||||
// max_saved_records: The maximum # of blocks to save historical data for
|
||||
"max_saved_records": 120
|
||||
},
|
||||
|
||||
/* Shared page settings */
|
||||
|
||||
// shared_pages: a collection of settings that pertain to all webpages for the explorer
|
||||
@@ -126,7 +135,7 @@
|
||||
// Hybrid: Display both the proof-of-work and proof-of-stake difficulty values
|
||||
"difficulty": "POS",
|
||||
// show_hashrate: Determine whether to show network hash rate where applicable (true/false)
|
||||
// If set to false, the /api/getnetworkhashps and /ext/getsummary apis will no longer show hash rate information
|
||||
// If set to false, the /api/getnetworkhashps and /ext/getsummary apis will no longer show hash rate information, and the network hashrate chart will automatically be disabled
|
||||
"show_hashrate": true,
|
||||
// page_header: A collection of settings that pertain to the page header that is displayed at the top of all pages
|
||||
"page_header": {
|
||||
@@ -249,6 +258,60 @@
|
||||
"image_path": "/img/page-title-img.png",
|
||||
// enable_animation: Enable/disable the flip/spin animation on the page title image (true/false)
|
||||
"enable_animation": true
|
||||
},
|
||||
// network_charts: A collection of settings that pertain to the network hashrate and difficulty line charts displayed on page header of all pages
|
||||
// NOTE: You can independently show/hide individual charts by changing the show_nethash_chart and show_difficulty_chart values in the settings for each page
|
||||
// The "network_history.enabled" setting must be set to true for network charts to work correctly
|
||||
// If the "network_history.enabled" setting is false, all network charts will be completely disabled, regardless of their independent settings
|
||||
"network_charts": {
|
||||
// nethash_chart: A collection of settings that pertain to the network hashrate chart
|
||||
"nethash_chart": {
|
||||
// enabled: Enable/disable the network hashrate chart (true/false)
|
||||
// If set to false, the network hashrate chart will be completely inaccessible
|
||||
// NOTE: The `shared_pages.show_hashrate` option must be set to true or else the network hashrate chart will be completely inaccessible
|
||||
"enabled": true,
|
||||
// bgcolor: Change the background color of the network hashrate chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"bgcolor": "#ffffff",
|
||||
// line_color: Change the line color of the network hashrate chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"line_color": "rgba(54, 162, 235, 1)",
|
||||
// fill_color: Change the fill color of the network hashrate chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"fill_color": "rgba(54, 162, 235, 0.2)",
|
||||
// crosshair_color: Change the vertical crosshair line color of the network hashrate chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"crosshair_color": "#000000"
|
||||
},
|
||||
// difficulty_chart: A collection of settings that pertain to the network difficulty chart
|
||||
"difficulty_chart": {
|
||||
// enabled: Enable/disable the network difficulty chart (true/false)
|
||||
// If set to false, the network difficulty chart will be completely inaccessible
|
||||
"enabled": true,
|
||||
// bgcolor: Change the background color of the network difficulty chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"bgcolor": "#ffffff",
|
||||
// line_color: Change the line color of the network difficulty chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"line_color": "rgba(255, 99, 132, 1)",
|
||||
// fill_color: Change the fill color of the network difficulty chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"fill_color": "rgba(255, 99, 132, 0.2)",
|
||||
// crosshair_color: Change the vertical crosshair line color of the network difficulty chart
|
||||
// Set this to any valid html color
|
||||
// Ex: "#ffffff" or "rgba(255, 255, 255, 1)" or "white"
|
||||
"crosshair_color": "#000000"
|
||||
},
|
||||
// reload_chart_seconds: The time in seconds to automatically reload the network chart data from the server
|
||||
// Set to 0 to disable automatic reloading of chart data
|
||||
"reload_chart_seconds": 60
|
||||
}
|
||||
},
|
||||
// page_footer: A collection of settings that pertain to the page footer that is displayed at the bottom of all pages
|
||||
@@ -378,6 +441,10 @@
|
||||
"index_page": {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": true,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": true,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": true,
|
||||
// page_header: a collection of settings that pertain to the index page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -407,6 +474,10 @@
|
||||
"block_page": {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the block page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -426,6 +497,10 @@
|
||||
"transaction_page": {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the transaction/tx page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -448,6 +523,10 @@
|
||||
"address_page": {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the address page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -482,6 +561,10 @@
|
||||
"error_page": {
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the error page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -502,6 +585,10 @@
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the masternodes page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -530,6 +617,10 @@
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the movement page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -568,6 +659,10 @@
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the network page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -612,6 +707,10 @@
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the richlist/top100 page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -663,6 +762,10 @@
|
||||
"enabled": false,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the markets page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -798,6 +901,10 @@
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the api page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -1035,6 +1142,10 @@
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the claim address page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
@@ -1190,6 +1301,10 @@
|
||||
"enabled": true,
|
||||
// show_panels: Determine whether to show the panels configured in the shared_pages.page_header section across the top of this page (true/false)
|
||||
"show_panels": false,
|
||||
// show_nethash_chart: Determine whether to show the network hashrate chart configured in the shared_pages.network_charts.nethash_chart section across the top of this page (true/false)
|
||||
"show_nethash_chart": false,
|
||||
// show_difficulty_chart: Determine whether to show the network difficulty chart configured in the shared_pages.network_charts.difficulty_chart section across the top of this page (true/false)
|
||||
"show_difficulty_chart": false,
|
||||
// page_header: a collection of settings that pertain to the reward page header
|
||||
"page_header": {
|
||||
// show_img: Determine whether to show the page title image defined in the "shared_pages.page_header.page_title_image" setting (true/false)
|
||||
|
||||
+299
-49
@@ -24,61 +24,105 @@ html(lang='en')
|
||||
if active == 'richlist'
|
||||
script(type='text/javascript', src='https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/plugins/jqplot.pieRenderer.min.js')
|
||||
script(type='text/javascript', src='https://cdn.datatables.net/v/bs5/dt-1.11.3/datatables.min.js')
|
||||
if active == 'reward'
|
||||
script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/chart.js@3.6.1/dist/chart.min.js')
|
||||
- var showPanels = false
|
||||
- var showNethashChart = false
|
||||
- var showDifficultyChart = false
|
||||
case active
|
||||
when 'home'
|
||||
if settings.index_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.index_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.index_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'block'
|
||||
if settings.block_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.block_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.block_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'tx'
|
||||
if settings.transaction_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.transaction_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.transaction_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'address'
|
||||
if settings.address_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.address_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.address_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'masternodes'
|
||||
if settings.masternodes_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.masternodes_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.masternodes_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'movement'
|
||||
if settings.movement_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.movement_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.movement_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'network'
|
||||
if settings.network_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.network_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.network_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'richlist'
|
||||
if settings.richlist_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.richlist_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.richlist_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'markets'
|
||||
if settings.markets_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.markets_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.markets_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'info'
|
||||
if settings.api_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.api_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.api_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'claim-address'
|
||||
if settings.claim_address_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.claim_address_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.claim_address_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
when 'reward'
|
||||
if settings.blockchain_specific.heavycoin.reward_page.show_panels == true
|
||||
- showPanels = true
|
||||
break
|
||||
- showPanels = true
|
||||
if settings.blockchain_specific.heavycoin.reward_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.blockchain_specific.heavycoin.reward_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
default
|
||||
if settings.error_page.show_panels == true
|
||||
- showPanels = true
|
||||
- showPanels = true
|
||||
if settings.error_page.show_nethash_chart == true
|
||||
- showNethashChart = true
|
||||
if settings.error_page.show_difficulty_chart == true
|
||||
- showDifficultyChart = true
|
||||
if active == 'reward' || (settings.network_history.enabled == true && ((showNethashChart == true && settings.shared_pages.page_header.network_charts.nethash_chart.enabled == true && settings.shared_pages.show_hashrate == true) || (showDifficultyChart == true && settings.shared_pages.page_header.network_charts.difficulty_chart.enabled == true)))
|
||||
script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/chart.js@3.6.1/dist/chart.min.js')
|
||||
if settings.network_history.enabled == true && ((showNethashChart == true && settings.shared_pages.page_header.network_charts.nethash_chart.enabled == true && settings.shared_pages.show_hashrate == true) || (showDifficultyChart == true && settings.shared_pages.page_header.network_charts.difficulty_chart.enabled == true))
|
||||
script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/chartjs-plugin-crosshair@1.2.0')
|
||||
script.
|
||||
/* Special thanks to the stackoverflow community for the getParameterByName function: https://stackoverflow.com/a/901144/3038650 */
|
||||
function getParameterByName(name, url = window.location.href) {
|
||||
@@ -180,6 +224,30 @@ html(lang='en')
|
||||
rotateElement(elementSelector);
|
||||
}, 100);
|
||||
}
|
||||
function getNetHashUnits() {
|
||||
var networkSuffix='';
|
||||
switch ('#{settings.shared_pages.page_header.panels.network_panel.nethash_units}') {
|
||||
case "K":
|
||||
networkSuffix='(KH/s)';
|
||||
break;
|
||||
case "M":
|
||||
networkSuffix='(MH/s)';
|
||||
break;
|
||||
case "G":
|
||||
networkSuffix='(GH/s)';
|
||||
break;
|
||||
case "T":
|
||||
networkSuffix='(TH/s)';
|
||||
break;
|
||||
case "P":
|
||||
networkSuffix='(PH/s)';
|
||||
break;
|
||||
case "H":
|
||||
networkSuffix='(H/s)';
|
||||
break;
|
||||
}
|
||||
return networkSuffix;
|
||||
}
|
||||
$(document).ready(function() {
|
||||
if ('#{active}' != '')
|
||||
$('##{active} > a.nav-link').addClass('active');
|
||||
@@ -265,34 +333,187 @@ html(lang='en')
|
||||
$("#lblBlockcount").text(json.blockcount + ' blocks');
|
||||
}});
|
||||
}
|
||||
var nethashChart;
|
||||
var difficultyChart;
|
||||
function update_network_charts() {
|
||||
$.ajax({
|
||||
url: '/ext/getnetworkchartdata',
|
||||
success: function(result) {
|
||||
if (#{settings.network_history.enabled} == true && #{showNethashChart} == true && #{settings.shared_pages.page_header.network_charts.nethash_chart.enabled} == true && #{settings.shared_pages.show_hashrate} == true) {
|
||||
const ctxNethash = document.getElementById('nethashChart').getContext('2d');
|
||||
|
||||
if (nethashChart == null) {
|
||||
nethashChart = new Chart(ctxNethash, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: result.map(function(a) {return a.blockindex;}),
|
||||
datasets: [
|
||||
{
|
||||
label: 'Hashrate',
|
||||
data: result.map(function(a) {return a.nethash;}),
|
||||
backgroundColor: ['#{settings.shared_pages.page_header.network_charts.nethash_chart.fill_color}'],
|
||||
borderColor: ['#{settings.shared_pages.page_header.network_charts.nethash_chart.line_color}'],
|
||||
fill: 'start'
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
elements: {
|
||||
point: {
|
||||
radius: 1
|
||||
},
|
||||
line: {
|
||||
tension: 0.1
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
yAxis: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Network ' + getNetHashUnits(),
|
||||
font: {
|
||||
weight: 'bold'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: true,
|
||||
position: 'bottom'
|
||||
},
|
||||
title: {
|
||||
display: false
|
||||
},
|
||||
tooltip: {
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
displayColors: true,
|
||||
callbacks: {
|
||||
title: function(context) {
|
||||
return 'Block ' + context[0].label + ' Hashrate';
|
||||
},
|
||||
label: function(context) {
|
||||
return context.formattedValue + ' ' + getNetHashUnits()
|
||||
}
|
||||
}
|
||||
},
|
||||
crosshair: {
|
||||
line: {
|
||||
color: '#{settings.shared_pages.page_header.network_charts.nethash_chart.crosshair_color}',
|
||||
width: 1
|
||||
},
|
||||
sync: {
|
||||
enabled: false
|
||||
},
|
||||
zoom: {
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#nethashChartParent').fadeIn();
|
||||
} else {
|
||||
nethashChart.data.labels = result.map(function(a) {return a.blockindex;});
|
||||
nethashChart.data.datasets[0].data = result.map(function(a) {return a.nethash;});
|
||||
nethashChart.update();
|
||||
}
|
||||
}
|
||||
|
||||
if (#{settings.network_history.enabled} == true && #{showDifficultyChart} == true && #{settings.shared_pages.page_header.network_charts.difficulty_chart.enabled} == true) {
|
||||
const ctxDifficulty = document.getElementById('difficultyChart').getContext('2d');
|
||||
|
||||
if (difficultyChart == null) {
|
||||
difficultyChart = new Chart(ctxDifficulty, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: result.map(function(a) {return a.blockindex;}),
|
||||
datasets: [
|
||||
{
|
||||
label: 'Difficulty',
|
||||
data: result.map(function(a) {return a.difficulty;}),
|
||||
backgroundColor: ['#{settings.shared_pages.page_header.network_charts.difficulty_chart.fill_color}'],
|
||||
borderColor: ['#{settings.shared_pages.page_header.network_charts.difficulty_chart.line_color}'],
|
||||
fill: 'start'
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
elements: {
|
||||
point: {
|
||||
radius: 1
|
||||
},
|
||||
line: {
|
||||
tension: 0.1
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
yAxis: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Difficulty',
|
||||
font: {
|
||||
weight: 'bold'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: true,
|
||||
position: 'bottom'
|
||||
},
|
||||
title: {
|
||||
display: false
|
||||
},
|
||||
tooltip: {
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
displayColors: true,
|
||||
callbacks: {
|
||||
title: function(context) {
|
||||
return 'Block ' + context[0].label + ' Difficulty';
|
||||
},
|
||||
label: function(context) {
|
||||
return context.formattedValue;
|
||||
}
|
||||
}
|
||||
},
|
||||
crosshair: {
|
||||
line: {
|
||||
color: '#{settings.shared_pages.page_header.network_charts.difficulty_chart.crosshair_color}',
|
||||
width: 1
|
||||
},
|
||||
sync: {
|
||||
enabled: false
|
||||
},
|
||||
zoom: {
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#difficultyChartParent').fadeIn();
|
||||
} else {
|
||||
difficultyChart.data.labels = result.map(function(a) {return a.blockindex;});
|
||||
difficultyChart.data.datasets[0].data = result.map(function(a) {return a.difficulty;});
|
||||
difficultyChart.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$(window).resize(function () {
|
||||
fixDataTableColumns();
|
||||
fixFooterHeightAndPosition();
|
||||
});
|
||||
function getNetworkPanel() {
|
||||
var networkSuffix='';
|
||||
switch ('#{settings.shared_pages.page_header.panels.network_panel.nethash_units}') {
|
||||
case "K":
|
||||
networkSuffix='(KH/s)';
|
||||
break;
|
||||
case "M":
|
||||
networkSuffix='(MH/s)';
|
||||
break;
|
||||
case "G":
|
||||
networkSuffix='(GH/s)';
|
||||
break;
|
||||
case "T":
|
||||
networkSuffix='(TH/s)';
|
||||
break;
|
||||
case "P":
|
||||
networkSuffix='(PH/s)';
|
||||
break;
|
||||
case "H":
|
||||
networkSuffix='(H/s)';
|
||||
break;
|
||||
}
|
||||
var hashRateType='<label id="hashrate"></label>';
|
||||
return '<div class="card-header"><strong>#{settings.locale.network} <span class="small fw-normal">'+networkSuffix+'</span></strong></div><div class="card-body"><div id="hashratePanelLoading" class="header-panel"><i class="fa fa-spinner fa-pulse"></i></div><div id="hashratepanel" class="header-panel" style="display:none;"><span class="fa fa-cogs"></span>'+hashRateType+'</div></div>';
|
||||
return '<div class="card-header"><strong>#{settings.locale.network} <span class="small fw-normal">'+getNetHashUnits()+'</span></strong></div><div class="card-body"><div id="hashratePanelLoading" class="header-panel"><i class="fa fa-spinner fa-pulse"></i></div><div id="hashratepanel" class="header-panel" style="display:none;"><span class="fa fa-cogs"></span>'+hashRateType+'</div></div>';
|
||||
}
|
||||
function getDifficultyPanel() {
|
||||
var difficultyType='<label id="difficulty"></label>';
|
||||
@@ -372,6 +593,15 @@ html(lang='en')
|
||||
setInterval(function() {
|
||||
update_stats();
|
||||
}, 60000);
|
||||
if (#{settings.network_history.enabled} == true && ((#{showNethashChart} == true && #{settings.shared_pages.page_header.network_charts.nethash_chart.enabled} == true && #{settings.shared_pages.show_hashrate} == true) || (#{showDifficultyChart} == true && #{settings.shared_pages.page_header.network_charts.difficulty_chart.enabled} == true))) {
|
||||
var setting_reload_chart_seconds = #{settings.shared_pages.page_header.network_charts.reload_chart_seconds};
|
||||
if (setting_reload_chart_seconds > 0) {
|
||||
setInterval(function() {
|
||||
update_network_charts();
|
||||
}, (setting_reload_chart_seconds * 1000));
|
||||
}
|
||||
update_network_charts();
|
||||
}
|
||||
update_stats();
|
||||
fixFooterHeightAndPosition();
|
||||
enableTooltips();
|
||||
@@ -521,6 +751,26 @@ html(lang='en')
|
||||
#index-search.form-group.d-flex.justify-content-center
|
||||
input.form-control(type='text', name='search', placeholder=settings.locale.ex_search_message, style='min-width:80%;margin-right:5px;')
|
||||
button.btn.btn-success(type='submit') #{settings.locale.ex_search_button}
|
||||
if settings.network_history.enabled == true && ((showNethashChart == true && settings.shared_pages.page_header.network_charts.nethash_chart.enabled == true && settings.shared_pages.show_hashrate == true) || (showDifficultyChart == true && settings.shared_pages.page_header.network_charts.difficulty_chart.enabled == true))
|
||||
.container
|
||||
.row.align-items-start
|
||||
- var chartColumnClass = 'col-lg-12';
|
||||
if showNethashChart == true && settings.shared_pages.page_header.network_charts.nethash_chart.enabled == true && settings.shared_pages.show_hashrate == true && showDifficultyChart == true && settings.shared_pages.page_header.network_charts.difficulty_chart.enabled == true
|
||||
- chartColumnClass = 'col-lg-6';
|
||||
if showNethashChart == true && settings.shared_pages.page_header.network_charts.nethash_chart.enabled == true && settings.shared_pages.show_hashrate == true
|
||||
div#nethashChartParent(class=chartColumnClass, style='display:none;margin:10px 0;')
|
||||
.card.card-default.border-0
|
||||
.card-header
|
||||
strong Network Hashrate
|
||||
.card-body
|
||||
canvas#nethashChart(style='max-height:300px;background-color:'+settings.shared_pages.page_header.network_charts.nethash_chart.bgcolor+';')
|
||||
if showDifficultyChart == true && settings.shared_pages.page_header.network_charts.difficulty_chart.enabled == true
|
||||
div#difficultyChartParent(class=chartColumnClass, style='display:none;margin:10px 0;')
|
||||
.card.card-default.border-0
|
||||
.card-header
|
||||
strong Network Difficulty
|
||||
.card-body
|
||||
canvas#difficultyChart(style='max-height:300px;background-color:'+settings.shared_pages.page_header.network_charts.difficulty_chart.bgcolor+';')
|
||||
block content
|
||||
div#footer-container(class=footerClasses, role='navigation')
|
||||
.col-4.navbar-nav
|
||||
|
||||
+4
-2
@@ -123,7 +123,8 @@ block content
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false
|
||||
}
|
||||
},
|
||||
crosshair: false
|
||||
}
|
||||
};
|
||||
new Chart(ctx, { type: 'doughnut', data: data, options: options });
|
||||
@@ -162,7 +163,8 @@ block content
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false
|
||||
}
|
||||
},
|
||||
crosshair: false
|
||||
},
|
||||
scales: {
|
||||
y: {
|
||||
|
||||
Reference in New Issue
Block a user