feat: ixvd/hub integration

This commit is contained in:
Strix 2023-10-16 01:36:02 +02:00
parent 7c44053eae
commit d692c61590
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774
7 changed files with 177 additions and 16 deletions

View file

@ -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;

View file

@ -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)
);
}