As PocketClaw matured, a single status page wasn't enough. Changing an API key required SSH access and manual file editing. Reading gateway logs meant tailing files over SSH. For a device meant to run autonomously, all management should be accessible from a web browser.
The dashboard was extended from 1 page to 3 pages, plus 4 API endpoints, all served from hijack.js within the same Node.js process.
Routes added to the HTTP interceptor:
| Route | Page | Function |
|---|---|---|
| /dashboard | STATUS | Services, RAM bar, swap, top processes, uptime |
| /keys | KEYS | View masked keys, edit, test connectivity |
| /logs | LOGS | Real-time gateway logs, color-coded errors |
| /api/status | JSON | Status data |
| /api/keys | JSON | Key list (GET) / save (POST) |
| /api/keys/test | JSON | Test key validity |
| /api/logs | JSON | Log buffer + lazy load history |
All pages share a common CRT-themed layout with tab navigation:
function getTabNav(active) {
return `
<nav style="display:flex;gap:8px;margin-bottom:24px">
<a href="/dashboard" ${active==='status'?'class="active"':''}>STATUS</a>
<a href="/keys" ${active==='keys'?'class="active"':''}>KEYS</a>
<a href="/logs" ${active==='logs'?'class="active"':''}>LOGS</a>
</nav>
`;
}All pages auto-refresh every 2-3 seconds via fetch() to their respective API endpoints:
// Auto-refresh pattern used by all 3 pages:
setInterval(async () => {
const res = await fetch('/api/status');
const data = await res.json();
updateDOM(data);
}, 3000);# Test all 3 pages:
curl -s http://localhost:9000/dashboard | grep "STATUS"
# Expected: STATUS tab active
curl -s http://localhost:9000/keys | grep "KEYS"
# Expected: KEYS tab active
curl -s http://localhost:9000/logs | grep "LOGS"
# Expected: LOGS tab active
# Test API endpoints:
curl -s http://localhost:9000/api/status | head -1
curl -s http://localhost:9000/api/keys | head -1
curl -s http://localhost:9000/api/logs | head -1
# Expected: JSON responses for each| Metric | Before | After |
|---|---|---|
| Dashboard pages | 1 | 3 |
| API endpoints | 1 | 4 |
| SSH required for | Keys, logs | Nothing (web UI) |
| Management overhead | Manual | Browser-based |