mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-04-30 01:46:37 +08:00
feat(web): 改为通过 WebSocket 推送 ttyd 状态并清理轮询与冗余接口
This commit is contained in:
@@ -7,7 +7,7 @@ pub mod types;
|
||||
|
||||
pub use types::{
|
||||
AtxDeviceInfo, AudioDeviceInfo, ClientStats, HidDeviceInfo, MsdDeviceInfo, SystemEvent,
|
||||
VideoDeviceInfo,
|
||||
TtydDeviceInfo, VideoDeviceInfo,
|
||||
};
|
||||
|
||||
use tokio::sync::broadcast;
|
||||
|
||||
@@ -100,6 +100,15 @@ pub struct AudioDeviceInfo {
|
||||
pub error: Option<String>,
|
||||
}
|
||||
|
||||
/// ttyd status information
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TtydDeviceInfo {
|
||||
/// Whether ttyd binary is available
|
||||
pub available: bool,
|
||||
/// Whether ttyd is currently running
|
||||
pub running: bool,
|
||||
}
|
||||
|
||||
/// Per-client statistics
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ClientStats {
|
||||
@@ -325,6 +334,8 @@ pub enum SystemEvent {
|
||||
atx: Option<AtxDeviceInfo>,
|
||||
/// Audio device information (None if audio not enabled)
|
||||
audio: Option<AudioDeviceInfo>,
|
||||
/// ttyd status information
|
||||
ttyd: TtydDeviceInfo,
|
||||
},
|
||||
|
||||
/// WebSocket error notification (for connection-level errors like lag)
|
||||
|
||||
Reference in New Issue
Block a user