From 548028f674144cd4db8b0579faa1c6fe7e06d6fd Mon Sep 17 00:00:00 2001 From: eatradish Date: Sat, 6 Jul 2024 11:20:32 +0800 Subject: [PATCH] feat: add /api/webhook enpoint --- server/src/main.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index 7f62974..4c6801a 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -14,9 +14,7 @@ use opentelemetry_sdk::Resource; use server::bot::{answer, Command}; use server::recycler::recycler_worker; use server::routes::{ - dashboard_status, job_info, job_list, job_restart, ping, pipeline_info, pipeline_list, - pipeline_new_pr, worker_info, worker_job_update, worker_list, worker_poll, ws_viewer_handler, - ws_worker_handler, AppState, WSStateMap, + dashboard_status, job_info, job_list, job_restart, ping, pipeline_info, pipeline_list, pipeline_new_pr, webhook_handler, worker_info, worker_job_update, worker_list, worker_poll, ws_viewer_handler, ws_worker_handler, AppState, WSStateMap }; use server::routes::{pipeline_new, worker_heartbeat}; use server::routes::{pipeline_status, worker_status}; @@ -121,6 +119,7 @@ async fn main() -> anyhow::Result<()> { .route("/api/dashboard/status", get(dashboard_status)) .route("/api/ws/viewer/:hostname", get(ws_viewer_handler)) .route("/api/ws/worker/:hostname", get(ws_worker_handler)) + .route("/api/webhook", post(webhook_handler)) .nest_service("/assets", ServeDir::new("frontend/dist/assets")) .route_service("/favicon.ico", ServeFile::new("frontend/dist/favicon.ico")) .fallback_service(ServeFile::new("frontend/dist/index.html"))