Some checks failed
Deploy Nexus / deploy (push) Failing after 3s
Co-authored-by: Google AI Agent <gemini@hermes.local> Co-committed-by: Google AI Agent <gemini@hermes.local>
222 lines
8.4 KiB
HTML
222 lines
8.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="refresh" content="60">
|
|
<title>Nexus Heartbeat</title>
|
|
<style>
|
|
body {
|
|
font-family: 'Courier New', monospace;
|
|
background-color: #0a0a0a;
|
|
color: #00ff00;
|
|
margin: 0;
|
|
padding: 10px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
min-height: 100vh;
|
|
box-sizing: border-box;
|
|
line-height: 1.4;
|
|
}
|
|
.container {
|
|
width: 100%;
|
|
max-width: 375px; /* Mobile screen width */
|
|
padding: 10px;
|
|
border: 1px solid #006600;
|
|
box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
|
|
margin-bottom: 10px;
|
|
}
|
|
h1 {
|
|
color: #00ffff;
|
|
text-align: center;
|
|
font-size: 1.5em;
|
|
margin-top: 5px;
|
|
margin-bottom: 15px;
|
|
text-shadow: 0 0 5px rgba(0, 255, 255, 0.7);
|
|
}
|
|
.status-section {
|
|
margin-bottom: 15px;
|
|
}
|
|
.status-section h2 {
|
|
color: #00ffcc;
|
|
font-size: 1.2em;
|
|
border-bottom: 1px dashed #003300;
|
|
padding-bottom: 5px;
|
|
margin-top: 0;
|
|
margin-bottom: 10px;
|
|
}
|
|
.status-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-bottom: 5px;
|
|
}
|
|
.status-label {
|
|
color: #00ccff;
|
|
flex-shrink: 0;
|
|
margin-right: 10px;
|
|
}
|
|
.status-value {
|
|
color: #00ff00;
|
|
text-align: right;
|
|
word-break: break-all;
|
|
}
|
|
.agent-status.working { color: #00ff00; }
|
|
.agent-status.idle { color: #ffff00; }
|
|
.agent-status.dead { color: #ff0000; }
|
|
|
|
.last-updated {
|
|
text-align: center;
|
|
font-size: 0.8em;
|
|
color: #009900;
|
|
margin-top: 20px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>NEXUS HEARTBEAT</h1>
|
|
|
|
<div class="status-section">
|
|
<h2>SOVEREIGNTY STATUS</h2>
|
|
<div class="status-item">
|
|
<span class="status-label">SCORE:</span>
|
|
<span class="status-value" id="sovereignty-score">LOADING...</span>
|
|
</div>
|
|
<div class="status-item">
|
|
<span class="status-label">LABEL:</span>
|
|
<span class="status-value" id="sovereignty-label">LOADING...</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="status-section">
|
|
<h2>AGENT STATUSES</h2>
|
|
<div id="agent-statuses">
|
|
<div class="status-item"><span class="status-label">LOADING...</span><span class="status-value"></span></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="status-section">
|
|
<h2>LAST COMMITS</h2>
|
|
<div id="last-commits">
|
|
<div class="status-item"><span class="status-label">LOADING...</span><span class="status-value"></span></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="status-section">
|
|
<h2>ENVIRONMENTALS</h2>
|
|
<div class="status-item">
|
|
<span class="status-label">WEATHER:</span>
|
|
<span class="status-value" id="weather">UNKNOWN</span>
|
|
</div>
|
|
<div class="status-item">
|
|
<span class="status-label">BTC BLOCK:</span>
|
|
<span class="status-value" id="btc-block">UNKNOWN</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="last-updated" id="last-updated">
|
|
Last Updated: NEVER
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const GITEA_API_URL = 'http://143.198.27.163:3000/api/v1/repos/Timmy_Foundation/the-nexus/commits?limit=10';
|
|
const GITEA_TOKEN = 'dc0517a965226b7a0c5ffdd961b1ba26521ac592';
|
|
const SOVEREIGNTY_STATUS_FILE = './sovereignty-status.json';
|
|
const API_STATUS_FILE = './api/status.json';
|
|
|
|
async function fetchSovereigntyStatus() {
|
|
try {
|
|
const response = await fetch(SOVEREIGNTY_STATUS_FILE);
|
|
const data = await response.json();
|
|
document.getElementById('sovereignty-score').textContent = data.score + '%';
|
|
document.getElementById('sovereignty-label').textContent = data.label.toUpperCase();
|
|
} catch (error) {
|
|
console.error('Error fetching sovereignty status:', error);
|
|
document.getElementById('sovereignty-score').textContent = 'ERROR';
|
|
document.getElementById('sovereignty-label').textContent = 'ERROR';
|
|
}
|
|
}
|
|
|
|
async function fetchAgentStatuses() {
|
|
try {
|
|
const response = await fetch(API_STATUS_FILE);
|
|
const data = await response.json();
|
|
const agentStatusesDiv = document.getElementById('agent-statuses');
|
|
agentStatusesDiv.innerHTML = ''; // Clear previous statuses
|
|
|
|
data.agents.forEach(agent => {
|
|
const agentItem = document.createElement('div');
|
|
agentItem.className = 'status-item';
|
|
const statusClass = agent.status.toLowerCase(); // working, idle, dead
|
|
agentItem.innerHTML = `
|
|
<span class="status-label">${agent.name.toUpperCase()}:</span>
|
|
<span class="status-value agent-status ${statusClass}">${agent.status.toUpperCase()}</span>
|
|
`;
|
|
agentStatusesDiv.appendChild(agentItem);
|
|
});
|
|
} catch (error) {
|
|
console.error('Error fetching agent statuses:', error);
|
|
const agentStatusesDiv = document.getElementById('agent-statuses');
|
|
agentStatusesDiv.innerHTML = '<div class="status-item"><span class="status-label">AGENTS:</span><span class="status-value agent-status dead">ERROR</span></div>';
|
|
}
|
|
}
|
|
|
|
async function fetchLastCommits() {
|
|
try {
|
|
const response = await fetch(GITEA_API_URL, {
|
|
headers: {
|
|
'Authorization': `token ${GITEA_TOKEN}`
|
|
}
|
|
});
|
|
const commits = await response.json();
|
|
const lastCommitsDiv = document.getElementById('last-commits');
|
|
lastCommitsDiv.innerHTML = ''; // Clear previous commits
|
|
|
|
if (commits.length === 0) {
|
|
lastCommitsDiv.innerHTML = '<div class="status-item"><span class="status-label">NO COMMITS</span><span class="status-value"></span></div>';
|
|
return;
|
|
}
|
|
|
|
commits.slice(0, 5).forEach(commit => { // Display top 5 recent commits
|
|
const commitItem = document.createElement('div');
|
|
commitItem.className = 'status-item';
|
|
const author = commit.commit.author.name;
|
|
const date = new Date(commit.commit.author.date).toLocaleString();
|
|
const message = commit.commit.message.split('
|
|
')[0]; // First line of commit message
|
|
|
|
commitItem.innerHTML = `
|
|
<span class="status-label">${author}:</span>
|
|
<span class="status-value" title="${message}">${date}</span>
|
|
`;
|
|
lastCommitsDiv.appendChild(commitItem);
|
|
});
|
|
} catch (error) {
|
|
console.error('Error fetching last commits:', error);
|
|
const lastCommitsDiv = document.getElementById('last-commits');
|
|
lastCommitsDiv.innerHTML = '<div class="status-item"><span class="status-label">COMMITS:</span><span class="status-value agent-status dead">ERROR</span></div>';
|
|
}
|
|
}
|
|
|
|
function updateTimestamp() {
|
|
document.getElementById('last-updated').textContent = 'Last Updated: ' + new Date().toLocaleString();
|
|
}
|
|
|
|
async function updateStatus() {
|
|
await fetchSovereigntyStatus();
|
|
await fetchAgentStatuses();
|
|
await fetchLastCommits();
|
|
updateTimestamp();
|
|
}
|
|
|
|
// Initial load
|
|
updateStatus();
|
|
|
|
// Auto-refresh every 60 seconds (already set by meta tag, but this ensures data fetch)
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|