hive-c0re: add /api aliases for bare dashboard routes (phase 1 of route consolidation)

This commit is contained in:
damocles 2026-06-22 00:17:00 +02:00 committed by mara
commit 0c48caff1e

View file

@ -179,6 +179,46 @@ pub async fn serve(port: u16, coord: Arc<Coordinator>) -> Result<()> {
.route("/dashboard/stream", get(dashboard_stream))
.route("/dashboard/history", get(dashboard_history))
.route("/webhook/knowledge", post(webhook::post_webhook_knowledge))
// Transitional `/api/`-prefixed aliases for the bare backend
// routes above (same handlers). Phase 1 of the route-naming
// consolidation: register both paths so the frontend can move to
// `/api/...` without a lockstep cutover; the bare paths are
// dropped once the frontend has migrated. `/webhook/knowledge`
// is forge-driven (not the SPA), so it keeps its own prefix.
.route("/api/approve/{id}", post(approvals::post_approve))
.route("/api/deny/{id}", post(approvals::post_deny))
.route("/api/destroy/{name}", post(lifecycle_ops::post_destroy))
.route("/api/kill/{name}", post(lifecycle_ops::post_kill))
.route("/api/restart/{name}", post(lifecycle_ops::post_restart))
.route("/api/start/{name}", post(lifecycle_ops::post_start))
.route("/api/rebuild/{name}", post(lifecycle_ops::post_rebuild))
.route("/api/update-all", post(lifecycle_ops::post_update_all))
.route(
"/api/answer-question/{id}",
post(questions::post_answer_question),
)
.route(
"/api/cancel-question/{id}",
post(questions::post_cancel_question),
)
.route("/api/purge-tombstone/{name}", post(post_purge_tombstone))
.route(
"/api/matrix-account-login",
post(matrix_accounts::post_matrix_account_login),
)
.route(
"/api/cancel-reminder/{id}",
post(reminders::post_cancel_reminder),
)
.route(
"/api/retry-reminder/{id}",
post(reminders::post_retry_reminder),
)
.route("/api/request-spawn", post(post_request_spawn))
.route("/api/op-send", post(post_op_send))
.route("/api/meta-update", post(post_meta_update))
.route("/api/dashboard/stream", get(dashboard_stream))
.route("/api/dashboard/history", get(dashboard_history))
// Anything not matched by the dynamic routes above falls
// through to the bundled dashboard dist (GET / →
// dist/index.html, /favicon.svg → dist/favicon.svg,