Simplify pool frontend to single-coin mode
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 35s
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 35s
This commit is contained in:
@@ -104,9 +104,7 @@
|
||||
<script>
|
||||
// Store last pool statistics
|
||||
let lastStats;
|
||||
let mergedStats = {};
|
||||
let blockExplorers = {};
|
||||
let mergedApis = {};
|
||||
|
||||
function getUrlVars() {
|
||||
let vars = {};
|
||||
@@ -150,16 +148,12 @@ function pulseLiveUpdate(){
|
||||
// Update live informations
|
||||
function updateLiveStats(data, key) {
|
||||
pulseLiveUpdate();
|
||||
if (key !== parentCoin) {
|
||||
mergedStats[key] = data;
|
||||
} else {
|
||||
lastStats = data;
|
||||
if (lastStats && lastStats.pool && lastStats.pool.totalMinersPaid.toString() == '-1'){
|
||||
lastStats.pool.totalMinersPaid = 0;
|
||||
}
|
||||
updateIndex();
|
||||
lastStats = data;
|
||||
if (lastStats && lastStats.pool && lastStats.pool.totalMinersPaid.toString() == '-1'){
|
||||
lastStats.pool.totalMinersPaid = 0;
|
||||
}
|
||||
if (currentPage) currentPage.update(key);
|
||||
updateIndex();
|
||||
if (currentPage) currentPage.update(lastStats.config.coin);
|
||||
}
|
||||
|
||||
// Update global informations
|
||||
@@ -185,14 +179,13 @@ function loadLiveStats(reload) {
|
||||
let address = getCurrentAddress();
|
||||
if (address) { apiURL = apiURL + '?address=' + encodeURIComponent(address); }
|
||||
|
||||
if (xhrLiveStats[parentCoin]){
|
||||
xhrLiveStats[parentCoin].abort();
|
||||
}
|
||||
|
||||
$.get(apiURL, function(data){
|
||||
updateLiveStats(data, parentCoin);
|
||||
if (xhrLiveStats[data.config.coin]){
|
||||
xhrLiveStats[data.config.coin].abort();
|
||||
}
|
||||
updateLiveStats(data, data.config.coin);
|
||||
if (!reload) {
|
||||
routePage(fetchLiveStats(api, parentCoin));
|
||||
routePage(fetchLiveStats(api, data.config.coin));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user