mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-13 02:54:26 +08:00
fix: 修复 rtsp 和 RustDesk 扩展启停错误;修改部分参数描述文本
This commit is contained in:
@@ -53,3 +53,59 @@ pub async fn update_rtsp_config(
|
||||
|
||||
Ok(Json(RtspConfigResponse::from(&new_config)))
|
||||
}
|
||||
|
||||
pub async fn start_rtsp_service(
|
||||
State(state): State<Arc<AppState>>,
|
||||
) -> Result<Json<RtspStatusResponse>> {
|
||||
let _apply_guard = try_apply_lock(&state.config_apply_locks.rtsp, "rtsp")?;
|
||||
let current_config = state.config.get().rtsp.clone();
|
||||
let mut start_config = current_config.clone();
|
||||
start_config.enabled = true;
|
||||
|
||||
apply_rtsp_config(
|
||||
&state,
|
||||
¤t_config,
|
||||
&start_config,
|
||||
ConfigApplyOptions::forced(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let status = {
|
||||
let guard = state.rtsp.read().await;
|
||||
if let Some(ref service) = *guard {
|
||||
service.status().await
|
||||
} else {
|
||||
crate::rtsp::RtspServiceStatus::Stopped
|
||||
}
|
||||
};
|
||||
|
||||
Ok(Json(RtspStatusResponse::new(¤t_config, status)))
|
||||
}
|
||||
|
||||
pub async fn stop_rtsp_service(
|
||||
State(state): State<Arc<AppState>>,
|
||||
) -> Result<Json<RtspStatusResponse>> {
|
||||
let _apply_guard = try_apply_lock(&state.config_apply_locks.rtsp, "rtsp")?;
|
||||
let current_config = state.config.get().rtsp.clone();
|
||||
let mut stop_config = current_config.clone();
|
||||
stop_config.enabled = false;
|
||||
|
||||
apply_rtsp_config(
|
||||
&state,
|
||||
¤t_config,
|
||||
&stop_config,
|
||||
ConfigApplyOptions::forced(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let status = {
|
||||
let guard = state.rtsp.read().await;
|
||||
if let Some(ref service) = *guard {
|
||||
service.status().await
|
||||
} else {
|
||||
crate::rtsp::RtspServiceStatus::Stopped
|
||||
}
|
||||
};
|
||||
|
||||
Ok(Json(RtspStatusResponse::new(¤t_config, status)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user