use actix_web::{get, HttpResponse, web}; use actix_web::http::StatusCode; #[get("/gatus")] pub async fn get_gatus_services() -> HttpResponse { let status_response = if let Ok(res) = reqwest::get("https://s.ixvd.net/api/v1/endpoints/statuses").await { res } else { return HttpResponse::build(StatusCode::INTERNAL_SERVER_ERROR) .body("Failed to get status from gatus"); }; HttpResponse::build(StatusCode::OK) .body(status_response.text().await.unwrap()) } #[get("/hub_issues")] pub async fn get_hub_issues() -> HttpResponse { let status_response = if let Ok(res) = reqwest::get("https://git.ixvd.net/api/v1/repos/ixvd/hub/issues?state=open").await { res } else { return HttpResponse::build(StatusCode::INTERNAL_SERVER_ERROR) .body("Failed to get status from forgejo"); }; HttpResponse::build(StatusCode::OK) .body(status_response.text().await.unwrap()) } pub fn configure(cfg: &mut web::ServiceConfig) { cfg.service( web::scope("/relay") .service(get_gatus_services) .service(get_hub_issues) ); }