feat: ixvd/hub integration
This commit is contained in:
parent
7c44053eae
commit
d692c61590
7 changed files with 177 additions and 16 deletions
|
@ -2,7 +2,6 @@ use std::env;
|
|||
|
||||
use actix_files as fs;
|
||||
use actix_web::{App, HttpServer, middleware};
|
||||
use actix_web::web::Redirect;
|
||||
use env_logger;
|
||||
|
||||
mod relay;
|
||||
|
|
14
src/relay.rs
14
src/relay.rs
|
@ -14,9 +14,23 @@ pub async fn get_gatus_services() -> HttpResponse {
|
|||
.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)
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue