mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-06 13:44:21 +08:00
28 lines
708 B
Rust
28 lines
708 B
Rust
use axum::{extract::State, Json};
|
|
|
|
use crate::{
|
|
harness::{CursorHarnessStatus, SetEnabled},
|
|
Result,
|
|
};
|
|
|
|
use super::ControlService;
|
|
|
|
pub async fn status(State(service): State<ControlService>) -> Result<Json<CursorHarnessStatus>> {
|
|
Ok(Json(service.cursor_harness().status().await?))
|
|
}
|
|
|
|
pub async fn initialize_ca(
|
|
State(service): State<ControlService>,
|
|
) -> Result<Json<CursorHarnessStatus>> {
|
|
Ok(Json(service.cursor_harness().initialize_ca().await?))
|
|
}
|
|
|
|
pub async fn set_enabled(
|
|
State(service): State<ControlService>,
|
|
Json(input): Json<SetEnabled>,
|
|
) -> Result<Json<CursorHarnessStatus>> {
|
|
Ok(Json(
|
|
service.cursor_harness().set_enabled(input.enabled).await?,
|
|
))
|
|
}
|