Servers and the agent, backend (2.1.0): join, jobs, schedules, port list, stats, alerts

- Agent API /api/agent/v1: join with a one-time token, then poll, stats,
  report and export upload, all signed with the server's Ed25519 key.
- Jobs signed with a separate job key (HUB_JOB_SIGNING_KEY_FILE) when
  delivered, config sealed to the server; one at a time per server;
  missed when not picked up in their window.
- New install (licence, ports, preflight against the release's env
  template), Proxy done with public URL checks, scheduled / emergency
  (2FA, reason) / batch updates with email and banner, uninstall with
  an encrypted export first (the key is never stored), adopt and
  linking existing installs, purge after 30 days.
- Port list, install defaults, server configuration (encrypted), stats
  per minute / hour with roll-up, server alerts. contracts 1.3.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 13:12:28 +02:00
co-authored by Claude Opus 5.5
parent 9aa06ae894
commit 041461f2b5
20 changed files with 2237 additions and 47 deletions
+4 -1
View File
@@ -10,12 +10,15 @@ app.use(cors({ origin: (process.env.FRONTEND_URL || 'http://localhost:3200').rep
// Keep the exact bytes: heartbeat signatures are over the raw body. 300 KB fits the largest AI
// request the Hub accepts (utils/ai.js MAX_INPUT_TOKENS).
app.use(express.json({ limit: '300kb', verify: (req, res, buf) => { req.rawBody = buf.toString('utf8'); } }));
app.use(express.json({ limit: '1mb', verify: (req, res, buf) => { req.rawBody = buf.toString('utf8'); } }));
app.get('/api/health', (req, res) => res.json({ ok: true }));
app.use('/api/agent/v1', require('./routes/agentApi'));
app.use('/api/exports', require('./routes/exports'));
app.use('/api', require('./routes/installApi'));
app.use('/api/auth', require('./routes/auth'));
app.use('/api/admin/billing', require('./routes/billing'));
app.use('/api/admin', require('./routes/servers'));
app.use('/api/admin', require('./routes/admin'));
app.use((req, res) => res.status(404).json({ message: 'Not found', code: 'NOT_FOUND' }));