use crate::Result; use axum::{extract::State, Json}; use crate::store::{ DesktopSettings, PortSettings, ProxySettings, ProxySettingsInput, StatisticsStorage, TabSettings, }; use super::{ControlService, ObservabilitySettings}; pub async fn get(State(service): State) -> Result> { Ok(Json(service.observability().await?)) } pub async fn update( State(service): State, Json(settings): Json, ) -> Result> { Ok(Json(service.set_observability(settings).await?)) } pub async fn get_ports(State(service): State) -> Result> { Ok(Json(service.ports().await?)) } pub async fn update_ports( State(service): State, Json(settings): Json, ) -> Result> { Ok(Json(service.set_ports(settings).await?)) } pub async fn get_storage(State(service): State) -> Result> { Ok(Json(service.statistics_storage().await?)) } pub async fn clear_storage( State(service): State, ) -> Result> { Ok(Json(service.clear_statistics_storage().await?)) } pub async fn get_proxy(State(service): State) -> Result> { Ok(Json(service.proxy_settings().await?)) } pub async fn update_proxy( State(service): State, Json(settings): Json, ) -> Result> { Ok(Json(service.set_proxy_settings(settings).await?)) } pub async fn get_tab(State(service): State) -> Result> { Ok(Json(service.tab_settings().await?)) } pub async fn update_tab( State(service): State, Json(settings): Json, ) -> Result> { Ok(Json(service.set_tab_settings(settings).await?)) } pub async fn get_desktop(State(service): State) -> Result> { Ok(Json(service.desktop_settings().await?)) } pub async fn update_desktop( State(service): State, Json(settings): Json, ) -> Result> { service.set_desktop_settings(settings).await?; get_desktop(State(service)).await }