rmux_sdk/web_share/
types.rs1use rmux_proto::{PaneTargetRef, WebShareListener, WebShareScope};
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct WebShareSummary {
6 pub id: String,
8 pub scope: WebShareScope,
10 pub spectator_url_redacted: Option<String>,
12 pub operator: bool,
14 pub spectator: bool,
16 pub active_spectators: u16,
18 pub active_operators: u16,
20 pub max_spectators: Option<u16>,
22 pub max_operators: Option<u16>,
24 pub expires_at_unix: Option<u64>,
26 pub kill_session_on_expire: bool,
28}
29
30impl WebShareSummary {
31 #[must_use]
33 pub fn pane_target(&self) -> Option<&PaneTargetRef> {
34 match &self.scope {
35 WebShareScope::Pane(target) => Some(target),
36 WebShareScope::Session(_) => None,
37 }
38 }
39}
40
41impl From<rmux_proto::WebShareSummary> for WebShareSummary {
42 fn from(value: rmux_proto::WebShareSummary) -> Self {
43 Self {
44 id: value.share_id,
45 scope: value.scope,
46 spectator_url_redacted: value.spectator_url,
47 operator: value.operator,
48 spectator: value.spectator,
49 active_spectators: value.active_spectators,
50 active_operators: value.active_operators,
51 max_spectators: value.max_spectators,
52 max_operators: value.max_operators,
53 expires_at_unix: value.expires_at_unix,
54 kill_session_on_expire: value.kill_session_on_expire,
55 }
56 }
57}
58
59#[derive(Debug, Clone, PartialEq, Eq)]
61pub struct WebConfigInfo {
62 pub host: String,
64 pub port: u16,
66 pub frontend_origin: String,
68}
69
70impl From<WebShareListener> for WebConfigInfo {
71 fn from(value: WebShareListener) -> Self {
72 Self {
73 host: value.host,
74 port: value.port,
75 frontend_origin: value.frontend_origin,
76 }
77 }
78}