feat: add mcp

This commit is contained in:
zhom
2026-01-11 03:59:00 +04:00
parent 2725cf9316
commit 149ae81246
4 changed files with 641 additions and 5 deletions
+19 -4
View File
@@ -322,10 +322,12 @@ impl ApiServer {
let api = ApiDoc::openapi();
let v1_routes = v1_routes.layer(middleware::from_fn_with_state(
state.clone(),
auth_middleware,
));
let v1_routes = v1_routes
.layer(middleware::from_fn_with_state(
state.clone(),
auth_middleware,
))
.layer(middleware::from_fn(terms_check_middleware));
let app = Router::new()
.nest("/v1", v1_routes)
@@ -363,6 +365,19 @@ impl ApiServer {
}
}
// Terms and Conditions check middleware
async fn terms_check_middleware(
request: axum::extract::Request,
next: Next,
) -> Result<Response, StatusCode> {
// Check if Wayfern terms have been accepted
if !crate::wayfern_terms::WayfernTermsManager::instance().is_terms_accepted() {
return Err(StatusCode::FORBIDDEN);
}
Ok(next.run(request).await)
}
// Authentication middleware
async fn auth_middleware(
State(state): State<ApiServerState>,