|
1 | 1 | use std::collections::HashMap; |
| 2 | +use std::time::{SystemTime, UNIX_EPOCH}; |
2 | 3 |
|
3 | 4 | use anyhow::{Context, bail}; |
4 | 5 | use async_trait::async_trait; |
@@ -26,9 +27,9 @@ use now_proto_pdu::{ |
26 | 27 | ComApartmentStateKind, NowChannelCapsetMsg, NowChannelCloseMsg, NowChannelHeartbeatMsg, NowChannelMessage, |
27 | 28 | NowExecBatchMsg, NowExecCancelRspMsg, NowExecCapsetFlags, NowExecDataMsg, NowExecDataStreamKind, NowExecMessage, |
28 | 29 | NowExecProcessMsg, NowExecPwshMsg, NowExecResultMsg, NowExecRunMsg, NowExecStartedMsg, NowExecWinPsMsg, NowMessage, |
29 | | - NowMsgBoxResponse, NowProtoError, NowProtoVersion, NowSessionCapsetFlags, NowSessionMessage, |
30 | | - NowSessionMsgBoxReqMsg, NowSessionMsgBoxRspMsg, NowStatusError, NowSystemCapsetFlags, NowSystemMessage, |
31 | | - SetKbdLayoutOption, |
| 30 | + NowMsgBoxResponse, NowProtoError, NowProtoVersion, NowRdmCapabilitiesMsg, NowRdmMessage, NowSessionCapsetFlags, |
| 31 | + NowSessionMessage, NowSessionMsgBoxReqMsg, NowSessionMsgBoxRspMsg, NowStatusError, NowSystemCapsetFlags, |
| 32 | + NowSystemMessage, SetKbdLayoutOption, |
32 | 33 | }; |
33 | 34 | use win_api_wrappers::event::Event; |
34 | 35 | use win_api_wrappers::security::privilege::ScopedPrivileges; |
@@ -331,6 +332,20 @@ impl MessageProcessor { |
331 | 332 | message: NowMessage<'static>, |
332 | 333 | ) -> anyhow::Result<ProcessMessageAction> { |
333 | 334 | match message { |
| 335 | + NowMessage::Rdm(NowRdmMessage::Capabilities(_)) => { |
| 336 | + // Send empty capabilities (as RDM app is not available on the server side). |
| 337 | + |
| 338 | + let server_timestamp = SystemTime::now() |
| 339 | + .duration_since(UNIX_EPOCH) |
| 340 | + .context("Failed to get current timestamp")? |
| 341 | + .as_secs(); |
| 342 | + |
| 343 | + let rdm_caps = NowRdmCapabilitiesMsg::new(server_timestamp, String::new())?; |
| 344 | + |
| 345 | + self.dvc_tx |
| 346 | + .send(NowMessage::Rdm(NowRdmMessage::Capabilities(rdm_caps))) |
| 347 | + .await?; |
| 348 | + } |
334 | 349 | NowMessage::Channel(NowChannelMessage::Capset(client_caps)) => { |
335 | 350 | return Ok(ProcessMessageAction::Restart(client_caps)); |
336 | 351 | } |
|
0 commit comments