this repo has no description
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 31 lines 833 B view raw
1use std::sync::Arc; 2 3use axum::{Extension, http::{HeaderMap, StatusCode}, response::Response}; 4 5use crate::{nginx::NginxManager, utils}; 6 7pub async fn post( 8 headers: HeaderMap, 9 Extension(nginx): Extension<Arc<NginxManager>> 10) -> Response{ 11 let Ok(_) = utils::auth::check_auth(&headers) else { 12 return Response::builder().status(StatusCode::FORBIDDEN).body("".into()).unwrap() 13 }; 14 15 if let Err(error) = nginx.test_config().await{ 16 return Response::builder() 17 .status(StatusCode::INTERNAL_SERVER_ERROR) 18 .body(error.to_string().into()) 19 .unwrap() 20 } 21 22 match nginx.reload_nginx().await{ 23 Ok(_) => Response::builder() 24 .body("".into()) 25 .unwrap(), 26 Err(error) => Response::builder() 27 .status(StatusCode::INTERNAL_SERVER_ERROR) 28 .body(error.to_string().into()) 29 .unwrap() 30 } 31}