this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

format

+21 -16
+9 -7
server/src/client_communication.rs
··· 1 1 use crate::user::User; 2 2 use crate::{ 3 - error_elog, http_code_elog, incoming_elog, info_elog, registration_error_elog, warn_elog, AppState, LuminaError 3 + AppState, LuminaError, error_elog, http_code_elog, incoming_elog, info_elog, 4 + registration_error_elog, warn_elog, 4 5 }; 5 6 use cynthia_con::{CynthiaColors, CynthiaStyles}; 6 7 extern crate rocket; ··· 8 9 use uuid::Uuid; 9 10 10 11 #[get("/connection")] 11 - pub(crate) async fn wsconnection<'k>(ws: ws::WebSocket, state: &'k State<AppState>) -> ws::Channel<'k> { 12 + pub(crate) async fn wsconnection<'k>( 13 + ws: ws::WebSocket, 14 + state: &'k State<AppState>, 15 + ) -> ws::Channel<'k> { 12 16 let ev_log = { 13 - let appstate = state.0.clone(); 14 - appstate.2.clone().await 15 - }; 17 + let appstate = state.0.clone(); 18 + appstate.2.clone().await 19 + }; 16 20 http_code_elog!(ev_log, 200, "/connection"); 17 21 use rocket::futures::{SinkExt, StreamExt}; 18 22 19 23 ws.channel(move |mut stream| { 20 24 Box::pin(async move { 21 25 http_code_elog!(ev_log, 101, "/connection"); 22 - 23 26 let mut client_session_data: SessionData = SessionData { 24 27 client_type: None, 25 28 user: None, ··· 301 304 } 302 305 Ok(Message::TimelineRequest { by_id: _ }) => { 303 306 error_elog!(ev_log,"Not yet implemented: Message::TimelineRequest") 304 - 305 307 }, 306 308 // Responding variants are not supposed to ever arrive here. 307 309 Ok(Message::ClientInit { .. }) |
+7 -8
server/src/helpers/events.rs
··· 73 73 } 74 74 } 75 75 76 - pub async fn clone(&self) -> Self { 76 + pub async fn clone(&self) -> Self { 77 77 match self { 78 78 EventLogger::WithDatabase { db } => Self::from_db(db).await, 79 79 EventLogger::OnlyStdout => Self::OnlyStdout, ··· 105 105 101 => format!("[HTTP/{} (Switching Protocols)]", code) 106 106 .color_blue() 107 107 .style_bold(), 108 - 200..=299 => format!("[HTTP/{} (OK)]", code).color_ok_green().style_bold(), 108 + 200..=299 => format!("[HTTP/{} (OK)]", code) 109 + .color_ok_green() 110 + .style_bold(), 109 111 400..=499 => format!("[HTTP/{} (Client Error)]", code) 110 112 .color_yellow() 111 113 .style_bold(), 112 - 113 - 500..=599 => format!("[HTTP/{} (Server Error)]", code 114 - ) 114 + 115 + 500..=599 => format!("[HTTP/{} (Server Error)]", code) 115 116 .color_error_red() 116 117 .style_bold(), 117 118 _ => format!("[HTTP/{}]", code).color_blue().style_bold(), ··· 146 147 EventType::Log => String::from("LOG"), 147 148 EventType::Incoming => String::from("INCOMING"), 148 149 EventType::RegistrationError => String::from("REGISTRATION_ERROR"), 149 - EventType::HTTPCode(code) => 150 - format!("HTTP/{}", code) 151 - 150 + EventType::HTTPCode(code) => format!("HTTP/{}", code), 152 151 }; 153 152 let ansi_regex = regex::Regex::new(r"\x1B\[[0-?]*[ -/]*[@-~]").unwrap(); 154 153
+5 -1
server/src/main.rs
··· 134 134 let ev_log = EventLogger::new(&db_mut).await; 135 135 let db = db_mut.unwrap(); 136 136 137 - let appstate = AppState(Arc::from((config.clone(), Mutex::from(db), ev_log.clone().await))); 137 + let appstate = AppState(Arc::from(( 138 + config.clone(), 139 + Mutex::from(db), 140 + ev_log.clone().await, 141 + ))); 138 142 139 143 let def = rocket::Config { 140 144 port: config.port,