feat(web): expose the dashboard API
One module per domain, each route declaring the minimum access level the server enforces before the handler runs. Irreversible actions ask for the exact name to be typed back, and every write lands in `event_logs` with its author so the history says who did what. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
11 files changed
+2713
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { registerAuthRoutes } from '../auth/routes.js';
|
||||
import { registerCommunityRoutes } from './community.js';
|
||||
import { registerConfigurationRoutes } from './configuration.js';
|
||||
import { registerDeploymentRoutes } from './deployments.js';
|
||||
import { registerDiscordRoutes } from './discord.js';
|
||||
import { registerLogRoutes } from './logs.js';
|
||||
import { registerOrganizationRoutes } from './organization.js';
|
||||
import { registerOverviewRoutes } from './overview.js';
|
||||
import { registerReleaseRoutes } from './releases.js';
|
||||
import { registerRepositoryRoutes } from './repositories.js';
|
||||
import { registerSettingsRoutes } from './settings.js';
|
||||
|
||||
/**
|
||||
* Route registration order matters only for readability: the router matches on
|
||||
* the full pattern, not on declaration order.
|
||||
*/
|
||||
export function registerApiRoutes(router, { setupOnly = false } = {}) {
|
||||
// Liveness probe for a reverse proxy or an uptime monitor. Registered first so
|
||||
// it answers even in bootstrap mode, when nothing else is mounted.
|
||||
router.get(
|
||||
'/api/health',
|
||||
({ context }) => ({
|
||||
status: context.client?.isReady?.() ? 'ok' : 'starting',
|
||||
setupOnly: context.setupOnly,
|
||||
uptimeMs: Date.now() - context.startedAt,
|
||||
}),
|
||||
{ public: true },
|
||||
);
|
||||
|
||||
registerAuthRoutes(router);
|
||||
registerConfigurationRoutes(router);
|
||||
|
||||
// In bootstrap mode the bot is not connected and the database may be empty:
|
||||
// only the wizard makes sense.
|
||||
if (setupOnly) return router;
|
||||
|
||||
registerOverviewRoutes(router);
|
||||
registerOrganizationRoutes(router);
|
||||
registerRepositoryRoutes(router);
|
||||
registerReleaseRoutes(router);
|
||||
registerDeploymentRoutes(router);
|
||||
registerDiscordRoutes(router);
|
||||
registerCommunityRoutes(router);
|
||||
registerSettingsRoutes(router);
|
||||
registerLogRoutes(router);
|
||||
return router;
|
||||
}
|
||||
Reference in new issue
Block a user