diff --git a/html/admin.html b/html/admin.html index bab6db8..d30e737 100644 --- a/html/admin.html +++ b/html/admin.html @@ -450,6 +450,8 @@ let currentTab = 'overview'; let usersOffset = 0; let outcomesChart = null; + let atomicDivisor = 1e11; // Default WOW, updated from server on login + let cryptoSymbol = 'WOW'; // Updated from server on login // Check if already logged in if (apiKey) { @@ -562,10 +564,13 @@ document.getElementById('statFailed').textContent = `${failed} failed`; document.getElementById('statFailed').className = 'subtext' + (failed > 0 ? ' danger' : ''); + // Update divisor and symbol from server + if (overview.atomicDivisor) atomicDivisor = overview.atomicDivisor; + if (overview.cryptoType) cryptoSymbol = overview.cryptoType; + // Wallet balance if (overview.walletBalance) { const walletEl = document.getElementById('walletStatus'); - const cryptoType = window.location.hostname.includes('monerogue') ? 'XMR' : 'WOW'; if (overview.walletBalance.error) { // Wallet RPC error - show error state @@ -577,11 +582,11 @@ } else { // Wallet connected - show balance const bal = overview.walletBalance.unlocked_balance || 0; - const formatted = (bal / 1e12).toFixed(4); + const formatted = (bal / atomicDivisor).toFixed(4); document.getElementById('statBalance').textContent = formatted; document.getElementById('statUnlocked').textContent = `Unlocked: ${formatted}`; - walletEl.className = 'wallet-status' + (bal < 100000000000 ? ' warning' : ' healthy'); - document.getElementById('walletBalance').textContent = `${formatted} ${cryptoType}`; + walletEl.className = 'wallet-status' + (bal < atomicDivisor ? ' warning' : ' healthy'); + document.getElementById('walletBalance').textContent = `${formatted} ${cryptoSymbol}`; } } else { document.getElementById('statBalance').textContent = '-'; @@ -724,7 +729,7 @@ tbody.innerHTML = data.payouts.map(p => `