async sockets
This commit is contained in:
commit
4170b9f387
23 changed files with 544 additions and 479 deletions
31
src/main.rs
31
src/main.rs
|
|
@ -12,11 +12,12 @@ mod eula;
|
|||
mod gui;
|
||||
mod langu;
|
||||
mod omikron;
|
||||
mod server;
|
||||
mod users;
|
||||
mod util;
|
||||
|
||||
use crate::communities::community_manager;
|
||||
use crate::communities::interactables::registry;
|
||||
use crate::communities::{community_manager, community_socket};
|
||||
use crate::data::communication::{CommunicationType, CommunicationValue, DataTypes};
|
||||
use crate::gui::app_state::AppState;
|
||||
use crate::gui::log_panel::{log_message, log_message_trans};
|
||||
|
|
@ -24,13 +25,14 @@ use crate::gui::{log_panel, ratatui_interface};
|
|||
use crate::langu::language_creator;
|
||||
use crate::langu::language_manager::format;
|
||||
use crate::omikron::omikron_connection::OmikronConnection;
|
||||
use crate::server::socket::start;
|
||||
use crate::users::user_manager;
|
||||
use crate::util::config_util::CONFIG;
|
||||
|
||||
pub static APP_STATE: LazyLock<Arc<Mutex<AppState>>> =
|
||||
LazyLock::new(|| Arc::new(Mutex::new(AppState::new())));
|
||||
|
||||
#[tokio::main]
|
||||
#[tokio::main(flavor = "multi_thread", worker_threads = 8)]
|
||||
#[allow(unused_must_use, dead_code)]
|
||||
async fn main() {
|
||||
// EULA
|
||||
//if !eula_checker::check_eula() {
|
||||
|
|
@ -38,22 +40,33 @@ async fn main() {
|
|||
// return;
|
||||
//}
|
||||
|
||||
// LANGUAGE PACK
|
||||
if let Err(e) = language_creator::create_languages() {
|
||||
println!("Language pack creation failed: {}", e);
|
||||
return;
|
||||
}
|
||||
|
||||
// UI
|
||||
log_panel::setup();
|
||||
ratatui_interface::launch();
|
||||
// LANGUAGE PACK
|
||||
language_creator::create_languages();
|
||||
if let Err(e) = ratatui_interface::launch() {
|
||||
println!("Ui launch failed: {}", &e.to_string());
|
||||
return;
|
||||
}
|
||||
|
||||
// BASIC CONFIGURATION
|
||||
CONFIG.lock().unwrap().load();
|
||||
if !CONFIG.lock().unwrap().config.has_key("iota_id") {
|
||||
CONFIG.lock().unwrap().change("iota_id", Uuid::new_v4());
|
||||
CONFIG.lock().unwrap().save();
|
||||
CONFIG.lock().unwrap().update();
|
||||
}
|
||||
|
||||
// USER MANAGEMENT
|
||||
let _ = user_manager::load_users().await;
|
||||
if let Err(_) = user_manager::load_users().await {
|
||||
log_message_trans("user_load_failed");
|
||||
}
|
||||
|
||||
let mut sb = "".to_string();
|
||||
|
||||
for up in user_manager::get_users() {
|
||||
sb = sb + "," + &up.user_id.to_string().as_str();
|
||||
}
|
||||
|
|
@ -91,7 +104,7 @@ async fn main() {
|
|||
}
|
||||
log_message(format!("Community IDS: {}", sb1));
|
||||
let port = CONFIG.lock().unwrap().get_port();
|
||||
if community_socket::start(port).await {
|
||||
if start(port).await {
|
||||
log_message(format("community_active", &[&port.to_string()]));
|
||||
} else {
|
||||
if port < 1024 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue