feat: 新增安卓平台支持

This commit is contained in:
mofeng-git
2026-05-24 08:37:19 +00:00
parent dc6475776e
commit b31aae284d
105 changed files with 7900 additions and 473 deletions

View File

@@ -415,7 +415,7 @@ pub async fn apply_rustdesk_config(
let mut rustdesk_guard = state.rustdesk.write().await;
let mut credentials_to_save = None;
if old_config.enabled && !new_config.enabled {
if !new_config.enabled {
if let Some(ref service) = *rustdesk_guard {
service
.stop()
@@ -493,7 +493,7 @@ pub async fn apply_rtsp_config(
let mut rtsp_guard = state.rtsp.write().await;
if old_config.enabled && !new_config.enabled {
if !new_config.enabled {
if let Some(ref service) = *rtsp_guard {
service
.stop()

View File

@@ -21,10 +21,13 @@ pub use hid::{get_hid_config, update_hid_config};
#[cfg(unix)]
pub use msd::{get_msd_config, update_msd_config};
pub use redfish::{get_redfish_config, update_redfish_config};
pub use rtsp::{get_rtsp_config, get_rtsp_status, update_rtsp_config};
pub use rtsp::{
get_rtsp_config, get_rtsp_status, start_rtsp_service, stop_rtsp_service, update_rtsp_config,
};
pub use rustdesk::{
get_device_password, get_rustdesk_config, get_rustdesk_status, regenerate_device_id,
regenerate_device_password, update_rustdesk_config,
regenerate_device_password, start_rustdesk_service, stop_rustdesk_service,
update_rustdesk_config,
};
pub use stream::{get_stream_config, update_stream_config};
pub use video::{get_video_config, update_video_config};

View File

@@ -9,6 +9,12 @@ pub async fn update_overview(
State(state): State<Arc<AppState>>,
axum::extract::Query(query): axum::extract::Query<UpdateOverviewQuery>,
) -> Result<Json<UpdateOverviewResponse>> {
if cfg!(feature = "android") {
return Err(AppError::BadRequest(
"Online upgrade is disabled on Android".to_string(),
));
}
let channel = query.channel.unwrap_or(UpdateChannel::Stable);
let response = state.update.overview(channel).await?;
Ok(Json(response))
@@ -18,6 +24,12 @@ pub async fn update_upgrade(
State(state): State<Arc<AppState>>,
Json(req): Json<UpgradeRequest>,
) -> Result<Json<LoginResponse>> {
if cfg!(feature = "android") {
return Err(AppError::BadRequest(
"Online upgrade is disabled on Android".to_string(),
));
}
state.update.start_upgrade(req, state.shutdown_tx.clone())?;
Ok(Json(LoginResponse {
@@ -26,6 +38,14 @@ pub async fn update_upgrade(
}))
}
pub async fn update_status(State(state): State<Arc<AppState>>) -> Json<UpdateStatusResponse> {
Json(state.update.status().await)
pub async fn update_status(
State(state): State<Arc<AppState>>,
) -> Result<Json<UpdateStatusResponse>> {
if cfg!(feature = "android") {
return Err(AppError::BadRequest(
"Online upgrade is disabled on Android".to_string(),
));
}
Ok(Json(state.update.status().await))
}