|
|
<!DOCTYPE html> |
|
|
<html lang="en"> |
|
|
<head> |
|
|
<meta charset="UTF-8"> |
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
<title>E-FIRE-1 Mobile - Chase</title> |
|
|
<meta name="theme-color" content="#00ff88"> |
|
|
<style> |
|
|
body { |
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; |
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
|
|
color: white; |
|
|
margin: 0; |
|
|
padding: 20px; |
|
|
min-height: 100vh; |
|
|
} |
|
|
.container { |
|
|
max-width: 400px; |
|
|
margin: 0 auto; |
|
|
} |
|
|
.card { |
|
|
background: rgba(255,255,255,0.1); |
|
|
border-radius: 15px; |
|
|
padding: 20px; |
|
|
margin: 10px 0; |
|
|
backdrop-filter: blur(10px); |
|
|
} |
|
|
.earnings { |
|
|
font-size: 2em; |
|
|
font-weight: bold; |
|
|
color: #00ff88; |
|
|
} |
|
|
.button { |
|
|
background: #00ff88; |
|
|
color: #000; |
|
|
border: none; |
|
|
padding: 15px 30px; |
|
|
border-radius: 25px; |
|
|
font-size: 1.1em; |
|
|
margin: 5px; |
|
|
cursor: pointer; |
|
|
width: 100%; |
|
|
max-width: 300px; |
|
|
} |
|
|
.status { |
|
|
padding: 10px; |
|
|
border-radius: 10px; |
|
|
margin: 5px 0; |
|
|
} |
|
|
.connected { background: #00ff88; color: #000; } |
|
|
.disconnected { background: #ff4444; } |
|
|
.progress-bar { |
|
|
width: 100%; |
|
|
height: 20px; |
|
|
background: #333; |
|
|
border-radius: 10px; |
|
|
overflow: hidden; |
|
|
} |
|
|
.progress-fill { |
|
|
height: 100%; |
|
|
background: #00ff88; |
|
|
transition: width 0.3s ease; |
|
|
} |
|
|
</style> |
|
|
</head> |
|
|
<body> |
|
|
<div class="container"> |
|
|
<h1>π€ E-FIRE-1 Mobile</h1> |
|
|
<p>Hi Chase! π</p> |
|
|
|
|
|
<div class="card"> |
|
|
<h3>π Today's Earnings</h3> |
|
|
<div class="earnings" id="earnings">$0.00</div> |
|
|
<div class="progress-bar"> |
|
|
<div class="progress-fill" id="progress" style="width: 0%"></div> |
|
|
</div> |
|
|
<p>Goal: $50/day for H200 + food</p> |
|
|
</div> |
|
|
|
|
|
<div class="card"> |
|
|
<h3>π― Active Agents</h3> |
|
|
<div id="agents">Loading...</div> |
|
|
</div> |
|
|
|
|
|
<div class="card"> |
|
|
<h3>π Controls</h3> |
|
|
<button class="button" onclick="spawnAgent('crypto_trader')">Spawn Crypto Trader</button> |
|
|
<button class="button" onclick="spawnAgent('defi_farmer')">Spawn DeFi Farmer</button> |
|
|
<button class="button" onclick="spawnAgent('content_creator')">Spawn Content Creator</button> |
|
|
<button class="button" onclick="getStatus()">Refresh Status</button> |
|
|
</div> |
|
|
|
|
|
<div class="card"> |
|
|
<h3>π± Connection Status</h3> |
|
|
<div id="connection" class="status disconnected">Connecting...</div> |
|
|
</div> |
|
|
|
|
|
<div class="card"> |
|
|
<h3>π Quick Access</h3> |
|
|
<p><strong>Server IP:</strong> <span id="server-ip">Loading...</span></p> |
|
|
<p><strong>WebSocket:</strong> Connected</p> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<script> |
|
|
const serverUrl = window.location.origin; |
|
|
let ws; |
|
|
|
|
|
function connectWebSocket() { |
|
|
ws = new WebSocket(`${serverUrl.replace('http', 'ws')}/ws`); |
|
|
|
|
|
ws.onopen = function() { |
|
|
document.getElementById('connection').className = 'status connected'; |
|
|
document.getElementById('connection').textContent = 'Connected to E-FIRE-1'; |
|
|
getStatus(); |
|
|
}; |
|
|
|
|
|
ws.onmessage = function(event) { |
|
|
const data = JSON.parse(event.data); |
|
|
if (data.type === 'status') { |
|
|
updateEarnings(data.earnings || 0); |
|
|
updateAgents(data.agents || 0); |
|
|
} |
|
|
}; |
|
|
|
|
|
ws.onclose = function() { |
|
|
document.getElementById('connection').className = 'status disconnected'; |
|
|
document.getElementById('connection').textContent = 'Disconnected - retrying...'; |
|
|
setTimeout(connectWebSocket, 3000); |
|
|
}; |
|
|
} |
|
|
|
|
|
function updateEarnings(amount) { |
|
|
document.getElementById('earnings').textContent = `$${amount.toFixed(2)}`; |
|
|
const progress = Math.min((amount / 50) * 100, 100); |
|
|
document.getElementById('progress').style.width = `${progress}%`; |
|
|
} |
|
|
|
|
|
function updateAgents(count) { |
|
|
document.getElementById('agents').innerHTML = `${count} agents earning for you`; |
|
|
} |
|
|
|
|
|
async function spawnAgent(type) { |
|
|
try { |
|
|
const response = await fetch('/api/agents/spawn', { |
|
|
method: 'POST', |
|
|
headers: {'Content-Type': 'application/json'}, |
|
|
body: JSON.stringify({type: type}) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
alert(`Agent spawned: ${data.agent_id}`); |
|
|
getStatus(); |
|
|
} catch (error) { |
|
|
alert('Error spawning agent: ' + error.message); |
|
|
} |
|
|
} |
|
|
|
|
|
async function getStatus() { |
|
|
try { |
|
|
const response = await fetch('/api/earnings'); |
|
|
const data = await response.json(); |
|
|
updateEarnings(data.total_earnings); |
|
|
updateAgents(data.strategies_used || 0); |
|
|
document.getElementById('server-ip').textContent = window.location.host; |
|
|
} catch (error) { |
|
|
console.error('Error getting status:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setInterval(getStatus, 30000); |
|
|
|
|
|
|
|
|
connectWebSocket(); |
|
|
getStatus(); |
|
|
</script> |
|
|
</body> |
|
|
</html> |