mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-04 02:52:55 +08:00
CA 适配: - 移除 CA 模块对 macOS/Windows 的硬性限制,Linux 走完整初始化流程 - 按发行版自动选择安装命令:Debian 系 update-ca-certificates, Fedora/RHEL/Arch 系 update-ca-trust extract;已安装检测比对信任锚文件 - 删除不可达的 CaState::Unsupported 分支及前端"请使用 macOS 或 Windows"提示 静默启动(参考 cc-switch 实现逻辑): - 新增 DesktopSettings 持久化(service_settings 表)及 GET/PUT /api/settings/desktop - 主窗口统一以 visible(false) 创建,启动时读取配置决定是否显示 - 应用设置页:开启"开机启动"后显示"静默启动"子开关 安全修复: - ProviderEndpoint.api_key 增加 serde(skip_serializing), 避免明文 API Key 随 JSON 响应泄漏(provider_console 测试恢复通过) 其他: - Linux 补齐 open_terminal_with_command:按序探测 x-terminal-emulator / gnome-terminal / konsole 等并在新终端窗口执行命令 - "打开终端安装 CA"失败信息不再被前端静默吞掉 - 顺手修复上游遗留问题:desktop.rs 未使用导入、output.rs 测试模块位置、providers.rs 格式
76 lines
2.3 KiB
Rust
76 lines
2.3 KiB
Rust
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<ControlService>) -> Result<Json<ObservabilitySettings>> {
|
|
Ok(Json(service.observability().await?))
|
|
}
|
|
|
|
pub async fn update(
|
|
State(service): State<ControlService>,
|
|
Json(settings): Json<ObservabilitySettings>,
|
|
) -> Result<Json<ObservabilitySettings>> {
|
|
Ok(Json(service.set_observability(settings).await?))
|
|
}
|
|
|
|
pub async fn get_ports(State(service): State<ControlService>) -> Result<Json<PortSettings>> {
|
|
Ok(Json(service.ports().await?))
|
|
}
|
|
|
|
pub async fn update_ports(
|
|
State(service): State<ControlService>,
|
|
Json(settings): Json<PortSettings>,
|
|
) -> Result<Json<PortSettings>> {
|
|
Ok(Json(service.set_ports(settings).await?))
|
|
}
|
|
|
|
pub async fn get_storage(State(service): State<ControlService>) -> Result<Json<StatisticsStorage>> {
|
|
Ok(Json(service.statistics_storage().await?))
|
|
}
|
|
|
|
pub async fn clear_storage(
|
|
State(service): State<ControlService>,
|
|
) -> Result<Json<StatisticsStorage>> {
|
|
Ok(Json(service.clear_statistics_storage().await?))
|
|
}
|
|
|
|
pub async fn get_proxy(State(service): State<ControlService>) -> Result<Json<ProxySettings>> {
|
|
Ok(Json(service.proxy_settings().await?))
|
|
}
|
|
|
|
pub async fn update_proxy(
|
|
State(service): State<ControlService>,
|
|
Json(settings): Json<ProxySettingsInput>,
|
|
) -> Result<Json<ProxySettings>> {
|
|
Ok(Json(service.set_proxy_settings(settings).await?))
|
|
}
|
|
|
|
pub async fn get_tab(State(service): State<ControlService>) -> Result<Json<TabSettings>> {
|
|
Ok(Json(service.tab_settings().await?))
|
|
}
|
|
|
|
pub async fn update_tab(
|
|
State(service): State<ControlService>,
|
|
Json(settings): Json<TabSettings>,
|
|
) -> Result<Json<TabSettings>> {
|
|
Ok(Json(service.set_tab_settings(settings).await?))
|
|
}
|
|
|
|
pub async fn get_desktop(State(service): State<ControlService>) -> Result<Json<DesktopSettings>> {
|
|
Ok(Json(service.desktop_settings().await?))
|
|
}
|
|
|
|
pub async fn update_desktop(
|
|
State(service): State<ControlService>,
|
|
Json(settings): Json<DesktopSettings>,
|
|
) -> Result<Json<DesktopSettings>> {
|
|
service.set_desktop_settings(settings).await?;
|
|
get_desktop(State(service)).await
|
|
}
|