52 lines
933 B
Rust
52 lines
933 B
Rust
|
|
use tokio::sync::oneshot;
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub enum Source {
|
||
|
|
Irc,
|
||
|
|
Owncast,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone)]
|
||
|
|
pub enum BridgeEvent {
|
||
|
|
ChatMessage {
|
||
|
|
source: Source,
|
||
|
|
username: String,
|
||
|
|
body: String,
|
||
|
|
id: Option<String>,
|
||
|
|
},
|
||
|
|
StreamStarted {
|
||
|
|
title: String,
|
||
|
|
},
|
||
|
|
StreamStopped,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub enum OwncastState {
|
||
|
|
Online,
|
||
|
|
OfflineChatOpen,
|
||
|
|
Unavailable,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug)]
|
||
|
|
pub enum ControlCommand {
|
||
|
|
IrcConnect,
|
||
|
|
IrcDisconnect,
|
||
|
|
IrcReconnect,
|
||
|
|
OwncastConnect,
|
||
|
|
OwncastDisconnect,
|
||
|
|
OwncastReconnect,
|
||
|
|
Status {
|
||
|
|
reply: oneshot::Sender<BridgeStatus>,
|
||
|
|
},
|
||
|
|
Quit,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, serde::Serialize)]
|
||
|
|
pub struct BridgeStatus {
|
||
|
|
pub irc_connected: bool,
|
||
|
|
pub owncast_state: String,
|
||
|
|
pub webhook_listening: bool,
|
||
|
|
pub websocket_connected: bool,
|
||
|
|
pub uptime_secs: u64,
|
||
|
|
}
|