File size: 6,099 Bytes
93be2a2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
<!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);
}
}
// Auto-refresh every 30 seconds
setInterval(getStatus, 30000);
// Initial connection
connectWebSocket();
getStatus();
</script>
</body>
</html> |