diff --git a/config_manager.py b/config_manager.py index 237c65f..fb8d05b 100644 --- a/config_manager.py +++ b/config_manager.py @@ -31,9 +31,9 @@ class ConfigManager: return { "pools": [ { - "url": "stratum+tcp://p2pool.org:9332", - "user": "user", - "pass": "password" + "url": "stratum+tcp://solo.ckpool.org:3333", + "user": "144N35t62x8qC21eQ8qW2q2q2q2q2q2q2q", + "pass": "x" } ], "api-listen": True, diff --git a/static/js/dashboard.js b/static/js/dashboard.js index e25b91b..d482b93 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -1,4 +1,12 @@ document.addEventListener('DOMContentLoaded', function() { + // Helper to format hashrate + function formatHashrate(mhs) { + if (mhs >= 1000) { + return (mhs / 1000).toFixed(2) + ' GH/s'; + } + return parseFloat(mhs).toFixed(2) + ' MH/s'; + } + // Initialize Chart const ctx = document.getElementById('hashrateChart').getContext('2d'); const hashrateChart = new Chart(ctx, { @@ -6,7 +14,7 @@ document.addEventListener('DOMContentLoaded', function() { data: { labels: [], datasets: [{ - label: 'Hashrate (MH/s)', + label: 'Hashrate', data: [], borderColor: '#0d6efd', backgroundColor: 'rgba(13, 110, 253, 0.1)', @@ -21,6 +29,13 @@ document.addEventListener('DOMContentLoaded', function() { plugins: { legend: { display: false + }, + tooltip: { + callbacks: { + label: function(context) { + return formatHashrate(context.raw); + } + } } }, scales: { @@ -53,7 +68,25 @@ document.addEventListener('DOMContentLoaded', function() { // Update Top Stats if (summary) { const mhs = summary['MHS 5s'] || summary['MHS av'] || 0; - document.getElementById('stat-mhs').innerText = parseFloat(mhs).toFixed(2); + + // Parse unit + const formatted = formatHashrate(mhs); + // Check if GH/s or MH/s + let unit = 'MH/s'; + let val = mhs; + if (formatted.includes('GH/s')) { + unit = 'GH/s'; + val = (mhs / 1000).toFixed(2); + } else { + val = parseFloat(mhs).toFixed(2); + } + + document.getElementById('stat-mhs').innerText = val; + // Note: HTML might still say MH/s in static part, need to update ID or text node of

+ // But simplified: + const unitElem = document.querySelector('#stat-mhs').nextElementSibling; + if(unitElem) unitElem.innerText = unit; + document.getElementById('stat-accepted').innerText = formatNumber(summary['Accepted'] || 0); document.getElementById('stat-hw').innerText = formatNumber(summary['Hardware Errors'] || 0); } @@ -94,8 +127,8 @@ document.addEventListener('DOMContentLoaded', function() { ${dev['Enabled']} ${dev['Status']} ${temp > 0 ? temp.toFixed(1) : '-'} - ${parseFloat(dev['MHS 5s'] || 0).toFixed(2)} - ${parseFloat(dev['MHS av'] || 0).toFixed(2)} + ${formatHashrate(dev['MHS 5s'] || 0)} + ${formatHashrate(dev['MHS av'] || 0)} ${dev['Accepted']} ${dev['Rejected']} ${dev['Hardware Errors']}