this repo has no description
0
fork

Configure Feed

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

man pages amirite

Mar 812bdfc9 ec0fecdb

+359 -115
+77 -4
Cargo.lock
··· 152 152 checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" 153 153 154 154 [[package]] 155 + name = "bytecount" 156 + version = "0.6.8" 157 + source = "registry+https://github.com/rust-lang/crates.io-index" 158 + checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" 159 + 160 + [[package]] 155 161 name = "bytemuck" 156 162 version = "1.22.0" 157 163 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 226 232 227 233 [[package]] 228 234 name = "cynthia_con" 229 - version = "0.1.1" 235 + version = "0.1.2" 230 236 source = "registry+https://github.com/rust-lang/crates.io-index" 231 - checksum = "f1e7e8893beb4cc9d0699024fb1edb180a167247cbfe727a243c25ddd297f6a5" 237 + checksum = "8b32bacbfe19e6f1e20d22051bb617eb55c9848879e9c987bb8a68d7cc3b80ae" 232 238 dependencies = [ 233 239 "termsize", 234 240 ] ··· 572 578 ] 573 579 574 580 [[package]] 581 + name = "heck" 582 + version = "0.5.0" 583 + source = "registry+https://github.com/rust-lang/crates.io-index" 584 + checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 585 + 586 + [[package]] 575 587 name = "hermit-abi" 576 588 version = "0.3.9" 577 589 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 932 944 "rocket_ws", 933 945 "serde", 934 946 "serde_json", 947 + "tabled", 935 948 "tokio", 936 949 "tokio-postgres", 937 - "tracing", 938 - "tracing-subscriber", 939 950 "uuid", 940 951 ] 941 952 ··· 1057 1068 checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 1058 1069 1059 1070 [[package]] 1071 + name = "papergrid" 1072 + version = "0.14.0" 1073 + source = "registry+https://github.com/rust-lang/crates.io-index" 1074 + checksum = "b915f831b85d984193fdc3d3611505871dc139b2534530fa01c1a6a6707b6723" 1075 + dependencies = [ 1076 + "bytecount", 1077 + "fnv", 1078 + "unicode-width", 1079 + ] 1080 + 1081 + [[package]] 1060 1082 name = "parking_lot" 1061 1083 version = "0.12.3" 1062 1084 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1190 1212 ] 1191 1213 1192 1214 [[package]] 1215 + name = "proc-macro-error-attr2" 1216 + version = "2.0.0" 1217 + source = "registry+https://github.com/rust-lang/crates.io-index" 1218 + checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" 1219 + dependencies = [ 1220 + "proc-macro2", 1221 + "quote", 1222 + ] 1223 + 1224 + [[package]] 1225 + name = "proc-macro-error2" 1226 + version = "2.0.1" 1227 + source = "registry+https://github.com/rust-lang/crates.io-index" 1228 + checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" 1229 + dependencies = [ 1230 + "proc-macro-error-attr2", 1231 + "proc-macro2", 1232 + "quote", 1233 + "syn", 1234 + ] 1235 + 1236 + [[package]] 1193 1237 name = "proc-macro2" 1194 1238 version = "1.0.93" 1195 1239 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1720 1764 ] 1721 1765 1722 1766 [[package]] 1767 + name = "tabled" 1768 + version = "0.18.0" 1769 + source = "registry+https://github.com/rust-lang/crates.io-index" 1770 + checksum = "121d8171ee5687a4978d1b244f7d99c43e7385a272185a2f1e1fa4dc0979d444" 1771 + dependencies = [ 1772 + "papergrid", 1773 + "tabled_derive", 1774 + ] 1775 + 1776 + [[package]] 1777 + name = "tabled_derive" 1778 + version = "0.10.0" 1779 + source = "registry+https://github.com/rust-lang/crates.io-index" 1780 + checksum = "52d9946811baad81710ec921809e2af67ad77719418673b2a3794932d57b7538" 1781 + dependencies = [ 1782 + "heck", 1783 + "proc-macro-error2", 1784 + "proc-macro2", 1785 + "quote", 1786 + "syn", 1787 + ] 1788 + 1789 + [[package]] 1723 1790 name = "tempfile" 1724 1791 version = "3.18.0" 1725 1792 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2097 2164 version = "0.1.3" 2098 2165 source = "registry+https://github.com/rust-lang/crates.io-index" 2099 2166 checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" 2167 + 2168 + [[package]] 2169 + name = "unicode-width" 2170 + version = "0.2.0" 2171 + source = "registry+https://github.com/rust-lang/crates.io-index" 2172 + checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" 2100 2173 2101 2174 [[package]] 2102 2175 name = "unicode-xid"
+2 -2
README.MD
··· 19 19 | `LUMINA_SERVER_PORT` | `"8085"` | Port for Lumina to accept HTTP requests on. | 20 20 | `LUMINA_SERVER_ADDR` | `127.0.0.1` | Address for Lumina to accept HTTP requests on. (usually `127.0.0.1` or `0.0.0.0`) | 21 21 | `LUMINA_SERVER_HTTPS` | `"false"` | Wether to use 'https' rather than 'http' in links, etc. (please do!) | 22 - | `LUMINA_SYNCHRONISATION_IID` | `"localhost"` | A name Lumina uses when communicating with other instances, must be equal to where it's http is facing the public internet | 23 - | `LUMINA_SYNCHRONISATION_INTERVAL` | `"30"` | Specifies the interval between syncs. Minimum is 30. | 22 + | `LUMINA_SYNC_IID` | `"localhost"` | A name Lumina uses when communicating with other instances, must be equal to where it's http is facing the public internet | 23 + | `LUMINA_SYNC_INTERVAL` | `"30"` | Specifies the interval between syncs. Minimum is 30. |
+2 -3
server/Cargo.toml
··· 12 12 [dependencies] 13 13 tokio = { version = "1.0", features = ["full"] } 14 14 serde = { version = "1.0", features = ["derive"] } 15 - tracing = "0.1" 16 - tracing-subscriber = { version = "0.3", features = ["env-filter"] } 17 15 rocket = "0.5.1" 18 16 ws = { package = "rocket_ws", version = "0.1.1" } 19 17 serde_json = "1.0.140" 20 18 uuid = { version = "1.16.0", features = ["v4", "serde"] } 21 - cynthia_con = "0.1.1" 19 + cynthia_con = { version = "0.1.2" } 22 20 dotenv = "0.15.0" 23 21 tokio-postgres = { version = "0.7.13", features = ["with-uuid-1"] } 24 22 bcrypt = "0.17.0" 25 23 r2d2 = "0.8.10" 26 24 r2d2_sqlite = {version = "0.27.0", features = ["bundled"]} 25 + tabled = "0.18.0"
+5 -5
server/src/client_communication.rs
··· 3 3 use cynthia_con::{CynthiaColors, CynthiaStyles}; 4 4 extern crate rocket; 5 5 use rocket::State; 6 - use tracing::info; 7 6 8 7 #[get("/connection")] 9 8 pub(crate) fn wsconnection<'k>(ws: ws::WebSocket, state: &'k State<AppState>) -> ws::Channel<'k> { 10 9 use rocket::futures::{SinkExt, StreamExt}; 11 10 // Just a few log prefixes 11 + let info = "[INFO]".color_green().style_bold(); 12 12 let incoming = "[INCOMING]".color_lilac().style_bold(); 13 13 let registrationerror = "[RegistrationError]".color_bright_red().style_bold(); 14 + // End of log prefixes 14 15 ws.channel(move |mut stream| { 15 16 Box::pin(async move { 16 17 let mut client_session_data: SessionData = SessionData { ··· 39 40 password, 40 41 }) => { 41 42 println!( 42 - "{incoming} {} {} {}", 43 - "Register request" 43 + "{incoming} Register request: {} {}", 44 44 email.clone().color_orange(), 45 45 username.clone().color_bright_cyan() 46 46 ); ··· 52 52 match User::create_user(email.clone(), username.clone(), password, db).await 53 53 { 54 54 Ok(user) => { 55 - info!( 56 - "User created: {}", 55 + println!( 56 + "{info} User created: {}", 57 57 user.clone().username.color_bright_cyan() 58 58 ); 59 59 match User::create_session_token(user, db).await {
+2 -2
server/src/database.rs
··· 6 6 use tokio_postgres::tls::NoTlsStream; 7 7 use tokio_postgres::{Client, Connection, Socket}; 8 8 9 - pub(crate) async fn setup(config: crate::ServerConfig) -> Result<DbConn, LuminaError> { 9 + pub(crate) async fn setup() -> Result<DbConn, LuminaError> { 10 10 let warn = "[WARN]".color_bright_orange().style_bold(); 11 11 match (std::env::var("LUMINA_DB_TYPE") 12 12 .map_err(|_| ConfMissing("LUMINA_DB_TYPE".to_string())) ··· 53 53 .map_err(|_| ConfMissing("LUMINA_POSTGRES_DATABASE".to_string()))? 54 54 }); 55 55 pg_config.port(std::env::var("LUMINA_POSTGRES_PORT").unwrap_or_else(|_| { 56 - eprintln!("{warn} No Postgres database port provided under environment variable '_LUMINA_POSTGRES_PORT_'. Using default value '5432'."); 56 + eprintln!("{warn} No Postgres database port provided under environment variable 'LUMINA_POSTGRES_PORT'. Using default value '5432'."); 57 57 "5432".to_string() 58 58 }).parse::<u16>().map_err(|_| { LuminaError::ConfInvalid("LUMINA_POSTGRES_PORT is not a valid integer number".to_string()) })?); 59 59 match std::env::var("LUMINA_POSTGRES_HOST") {
+267 -95
server/src/main.rs
··· 1 + extern crate dotenv; 2 + #[macro_use] 3 + extern crate rocket; 1 4 mod client_communication; 2 5 pub mod errors; 3 6 mod staticroutes; ··· 5 8 mod database; 6 9 mod tests; 7 10 8 - #[macro_use] 9 - extern crate rocket; 10 - use std::{ 11 - net::{IpAddr, Ipv4Addr, Ipv6Addr}, 12 - process, 13 - sync::Arc, 14 - }; 11 + use std::io::ErrorKind; 12 + use std::{net::IpAddr, process, sync::Arc}; 15 13 use tokio::sync::Mutex; 16 14 mod user; 17 - use r2d2_sqlite::rusqlite as sqlite; 18 15 use tokio_postgres as postgres; 19 16 struct AppState(Arc<(ServerConfig, Mutex<DbConn>)>); 20 17 ··· 25 22 port: u16, 26 23 host: IpAddr, 27 24 } 28 - 29 - extern crate dotenv; 30 25 31 26 use crate::errors::LuminaError; 32 27 use cynthia_con::{CynthiaColors, CynthiaStyles}; ··· 48 43 49 44 #[rocket::main] 50 45 async fn main() { 51 - dotenv().ok(); 52 - 53 - match config_get() { 54 - Ok(config) => { 55 - let db = match database::setup(config.clone()).await { 56 - Ok(db) => db, 46 + // Some print prefixes 47 + let error = "[ERROR]".color_error_red().style_bold(); 48 + let info = "[INFO]".color_green().style_bold(); 49 + // End of print prefixes 50 + let me = format!("Lumina Server, version {}", env!("CARGO_PKG_VERSION")); 51 + let args: Vec<String> = std::env::args().skip(1).collect(); 52 + match ( 53 + args.is_empty(), 54 + args.first().unwrap_or(&String::new()).as_str(), 55 + ) { 56 + (true, _) | (false, "start") | (false, "") => { 57 + dotenv().ok(); 58 + println!("{info} Starting {}.", me.clone().color_lightblue()); 59 + println!( 60 + "{info} {} and contributors, licenced under {}.", 61 + "MLC Bloeiman".color_pink(), 62 + "BSD-3".color_blue() 63 + ); 64 + println!("{}", cynthia_con::horizline()); 65 + match config_get() { 66 + Ok(config) => { 67 + let db = match database::setup().await { 68 + Ok(db) => db, 69 + Err(LuminaError::ConfMissing(a)) => { 70 + eprintln!( 71 + "{error} Missing environment variable {}, which is required to continue. Please make sure it is set, or change other variables to make it redundant, if possible.", 72 + a.color_bright_orange() 73 + ); 74 + process::exit(1); 75 + } 76 + Err(LuminaError::ConfInvalid(a)) => { 77 + eprintln!( 78 + "{error} Invalid environment variable: {}", 79 + a.color_bright_orange() 80 + ); 81 + process::exit(1); 82 + } 83 + Err(LuminaError::Sqlite(a)) => { 84 + eprintln!("{error} While opening sqlite database: {}", a); 85 + process::exit(1); 86 + } 87 + Err(LuminaError::Postgres(a)) => { 88 + eprintln!("{error} While connecting to postgres database: {}", a); 89 + process::exit(1); 90 + } 91 + Err(_) => { 92 + eprintln!( 93 + "{error} Unknown error: could not setup database connection.", 94 + ); 95 + process::exit(1); 96 + } 97 + }; 98 + let appstate = AppState(Arc::from((config.clone(), Mutex::from(db)))); 99 + let def = rocket::Config { 100 + port: config.port, 101 + address: config.host, 102 + ident: rocket::config::Ident::try_new(me.clone()).unwrap_or_default(), 103 + log_level: rocket::config::LogLevel::Off, 104 + ..rocket::Config::default() 105 + }; 106 + let result = rocket::build() 107 + .configure(def) 108 + .mount( 109 + "/", 110 + routes![ 111 + staticroutes::index, 112 + staticroutes::lumina_js, 113 + staticroutes::lumina_css, 114 + client_communication::wsconnection, 115 + staticroutes::logo_svg, 116 + staticroutes::logo_png, 117 + staticroutes::favicon, 118 + ], 119 + ) 120 + .manage(appstate) 121 + .launch() 122 + .await 123 + .map_err(LuminaError::RocketFaillure); 124 + match result { 125 + Ok(_) => {} 126 + Err(LuminaError::RocketFaillure(e)) => { 127 + // This handling should slowly expand as I run into newer ones, the 'defh' (default handling) is good enough, but for the most-bumped into errors, I'd like to give more human responses. 128 + let defh = || eprintln!("{error} Error starting server: {:?}", e); 129 + match e.kind() { 130 + rocket::error::ErrorKind::Bind(e) => match e.kind() { 131 + ErrorKind::AddrInUse => { 132 + println!( 133 + "{error} Another program or instance is running on this port or adress." 134 + ); 135 + println!( 136 + "{error} Make sure you have not double-started Lumina, or have a different program serving on this port!" 137 + ); 138 + println!( 139 + "{error} {}", 140 + format!("Technical explanation: {}", e).style_dim() 141 + ); 142 + } 143 + _ => defh(), 144 + }, 145 + _ => defh(), 146 + } 147 + process::exit(1); 148 + } 149 + Err(_) => { 150 + eprintln!("{error} Unknown error starting server.",); 151 + } 152 + } 153 + } 57 154 Err(LuminaError::ConfMissing(a)) => { 58 155 eprintln!( 59 - "{} Missing environment variable {}, which is required to continue. Please make sure it is set, or change other variables to make it redundant, if possible.", 60 - "[ERROR]".color_error_red().style_bold(), 156 + "{error} Missing environment variable {}, which is required to continue. Please make sure it is set, or change other variables to make it redundant, if possible.", 61 157 a.color_bright_orange() 62 158 ); 63 159 process::exit(1); ··· 70 166 ); 71 167 process::exit(1); 72 168 } 73 - Err(LuminaError::Sqlite(a)) => { 74 - eprintln!( 75 - "{} While opening sqlite database: {}", 76 - "[ERROR]".color_error_red().style_bold(), 77 - a 78 - ); 79 - process::exit(1); 80 - } 81 - Err(LuminaError::Postgres(a)) => { 82 - eprintln!( 83 - "{} While connecting to postgres database: {}", 84 - "[ERROR]".color_error_red().style_bold(), 85 - a 86 - ); 87 - process::exit(1); 88 - } 89 169 Err(_) => { 90 170 eprintln!( 91 - "{} Unknown error: could not setup database connection.", 171 + "{} Unknown error: could not setup server configuration.", 92 172 "[ERROR]".color_error_red().style_bold() 93 173 ); 94 174 process::exit(1); 95 175 } 96 176 }; 97 - let appstate = AppState(Arc::from((config.clone(), Mutex::from(db)))); 98 - let def = rocket::Config { 99 - port: config.port, 100 - address: config.host, 101 - ..rocket::Config::default() 102 - }; 103 - let result = rocket::build() 104 - .configure(def) 105 - .mount( 106 - "/", 107 - routes![ 108 - staticroutes::index, 109 - staticroutes::lumina_js, 110 - staticroutes::lumina_css, 111 - client_communication::wsconnection, 112 - staticroutes::logo_svg, 113 - staticroutes::logo_png, 114 - staticroutes::favicon, 115 - ], 116 - ) 117 - .manage(appstate) 118 - .launch() 119 - .await 120 - .map_err(LuminaError::RocketFaillure); 121 - match result { 122 - Ok(_) => {} 123 - Err(LuminaError::RocketFaillure(e)) => { 124 - eprintln!( 125 - "{} Error starting server: {:?}", 126 - "[ERROR]".color_error_red().style_bold(), 127 - e 128 - ); 129 - } 130 - Err(_) => { 131 - eprintln!( 132 - "{} Unknown error starting server.", 133 - "[ERROR]".color_error_red().style_bold() 134 - ); 135 - } 136 - } 137 177 } 138 - Err(LuminaError::ConfMissing(a)) => { 139 - eprintln!( 140 - "{} Missing environment variable {}, which is required to continue. Please make sure it is set, or change other variables to make it redundant, if possible.", 141 - "[ERROR]".color_error_red().style_bold(), 142 - a.color_bright_orange() 178 + (false, "licence") | (false, "license") => { 179 + println!( 180 + "Licence for {} and its {}.", 181 + me.color_lightblue().style_italic(), 182 + "Lumina Client".color_yellow().style_italic() 143 183 ); 144 - process::exit(1); 184 + println!("MLC Bloeiman and contributors."); 185 + println!("{}", cynthia_con::horizline()); 186 + println!("{}", include_str!("../../LICENSE")); 145 187 } 146 - Err(LuminaError::ConfInvalid(a)) => { 147 - eprintln!( 148 - "{} Invalid environment variable: {}", 149 - "[ERROR]".color_error_red().style_bold(), 150 - a.color_bright_orange() 151 - ); 152 - process::exit(1); 188 + (false, "help") | (false, "man") => { 189 + fn table_to_centered_string(a: &mut tabled::Table) -> String { 190 + let s: Vec<String> = a 191 + .to_string() 192 + .split("\n") 193 + .map(|s| s.style_centered()) 194 + .collect(); 195 + let d = s.join("\n"); 196 + d 197 + } 198 + println!("{}", me); 199 + { 200 + println!("{}", "Subcommands".style_centered().style_bold()); 201 + println!(); 202 + println!( 203 + "\t\t{}|{}\tShow this help", 204 + "help".color_lightblue().style_italic(), 205 + "man".color_lightblue().style_italic() 206 + ); 207 + println!( 208 + "\t\t{}\t\tShow version and exit", 209 + "version".color_lightblue().style_italic() 210 + ); 211 + println!( 212 + "\t\t{}\t\tShow licence and exit", 213 + "licence".color_lightblue().style_italic() 214 + ); 215 + println!( 216 + "\t\t{}\t\tStart Lumina server", 217 + "start".color_lightblue().style_italic() 218 + ); 219 + } 220 + println!(); 221 + { 222 + println!("{}", "Environment variables".style_centered().style_bold()); 223 + println!(); 224 + let mut builder = tabled::builder::Builder::new(); 225 + builder.push_record(["Name", "Default value", "Description"]); 226 + builder.push_record(["LUMINA_DB_TYPE", r#""sqlite""#, r#"The kind of database to use. Options are 'postgres' (recommended) or 'sqlite'."#]); 227 + builder.push_record([ 228 + "LUMINA_DB_SALT", 229 + r#""sal""#, 230 + r#"The salting to use for some data on the database."#, 231 + ]); 232 + builder.push_record([ 233 + "LUMINA_SERVER_PORT", 234 + r#"8085"#, 235 + r#"Port for Lumina to accept HTTP requests on."#, 236 + ]); 237 + builder.push_record(["LUMINA_SERVER_ADDR", r#"127.0.0.1"#, "Address for Lumina to accept HTTP requests on. (usually '127.0.0.1' or '0.0.0.0')"]); 238 + builder.push_record(["LUMINA_SERVER_HTTPS", r#"false"#, "Wether to use 'https' rather than 'http' in links, etc. Recommendation is to set to true."]); 239 + builder.push_record([ 240 + "LUMINA_SYNC_IID", 241 + r#""localhost""#, 242 + "Broadcasted domain name, should be equal to public domain name.", 243 + ]); 244 + builder.push_record([ 245 + "LUMINA_SYNC_INTERVAL", 246 + r#"30"#, 247 + "Specifies the interval between syncs. Minimum is 30.", 248 + ]); 249 + println!( 250 + "{}", 251 + table_to_centered_string( 252 + builder.build().with(tabled::settings::Style::modern()) 253 + ) 254 + .style_dim() 255 + ); 256 + println!(); 257 + println!( 258 + "{}", 259 + format!( 260 + r#"When having "LUMINA_DB_TYPE" set to '{}': (recommended)"#, 261 + "postgres".color_lilac().style_bold() 262 + ) 263 + .style_centered() 264 + .style_italic() 265 + ); 266 + let mut builder = tabled::builder::Builder::new(); 267 + builder.push_record(["Name", "Default value", "Description"]); 268 + builder.push_record([ 269 + "LUMINA_POSTGRES_PORT", 270 + r#"5432"#, 271 + r#"The port to contact the database on."#, 272 + ]); 273 + builder.push_record([ 274 + "LUMINA_POSTGRES_HOST", 275 + r#""localhost""#, 276 + r#"The address to contact the database on."#, 277 + ]); 278 + builder.push_record([ 279 + "LUMINA_POSTGRES_USERNAME", 280 + r#""#, 281 + r#"The username to log in to the database with."#, 282 + ]); 283 + builder.push_record(["LUMINA_POSTGRES_PASSWORD", r#""#, r#"The password to log in to the database with. If not set, Lumina will try without."#]); 284 + builder.push_record([ 285 + "LUMINA_POSTGRES_DATABASE", 286 + r#""#, 287 + r#"The name of the database to use."#, 288 + ]); 289 + println!( 290 + "{}", 291 + table_to_centered_string( 292 + builder.build().with(tabled::settings::Style::modern()) 293 + ) 294 + .color_lilac() 295 + .style_dim() 296 + ); 297 + 298 + println!(); 299 + println!( 300 + "{}", 301 + format!( 302 + r#"When having "LUMINA_DB_TYPE" set to '{}':"#, 303 + "sqlite".color_bright_orange().style_bold() 304 + ) 305 + .style_centered() 306 + .style_italic() 307 + ); 308 + let mut builder = tabled::builder::Builder::new(); 309 + builder.push_record(["Name", "Default value", "Description"]); 310 + 311 + builder.push_record([ 312 + "LUMINA_SQLITE_FILE", 313 + r#""instance.sqlite""#, 314 + "SQLite file to connect to. Always a relative path from the instance folder.", 315 + ]); 316 + println!( 317 + "{}", 318 + table_to_centered_string( 319 + builder.build().with(tabled::settings::Style::modern()) 320 + ) 321 + .color_bright_orange() 322 + .style_dim() 323 + ) 324 + } 153 325 } 154 - Err(_) => { 155 - eprintln!( 156 - "{} Unknown error: could not setup server configuration.", 157 - "[ERROR]".color_error_red().style_bold() 158 - ); 159 - process::exit(1); 326 + (false, unknown) => { 327 + println!( 328 + "{error} Unknown subcommand, '{}', use '{}' for available commands.'", 329 + unknown.color_blue().style_italic(), 330 + "help".color_lightblue().style_italic() 331 + ) 160 332 } 161 - }; 333 + } 162 334 }
+4 -4
server/src/user.rs
··· 1 1 use crate::{LuminaError, database::DbConn}; 2 - use cynthia_con::CynthiaColors; 2 + use cynthia_con::{CynthiaColors, CynthiaStyles}; 3 3 use std::str::FromStr; 4 - use tracing::info; 5 4 use uuid::Uuid; 6 5 7 6 #[derive(Debug, Clone)] ··· 242 241 user: User, 243 242 db: &DbConn, 244 243 ) -> Result<(String, User), LuminaError> { 244 + let info = "[INFO]".color_green().style_bold(); 245 245 let user_id = user.id; 246 246 match db { 247 247 DbConn::PgsqlConnection(client) => { ··· 253 253 ) 254 254 .await 255 255 .map_err(LuminaError::Postgres)?; 256 - info!( 257 - "New session created by {}", 256 + println!( 257 + "{info} New session created by {}", 258 258 user.clone().username.color_bright_cyan() 259 259 ); 260 260 Ok((session_key, user))