Add log rotation to server & UI improvements (#157)

This commit is contained in:
Andras Schmelczer 2025-11-02 17:52:04 +00:00 committed by GitHub
parent 2b9d77d165
commit cd57ea6682
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 508 additions and 38 deletions

View file

@ -2,14 +2,12 @@ pub mod cursors;
pub mod database;
pub mod websocket;
use std::ffi::OsString;
use anyhow::Result;
use cursors::Cursors;
use database::Database;
use websocket::broadcasts::Broadcasts;
use crate::{config::Config, consts::DEFAULT_CONFIG_PATH};
use crate::config::Config;
#[derive(Clone, Debug)]
pub struct AppState {
@ -20,11 +18,7 @@ pub struct AppState {
}
impl AppState {
pub async fn try_new(config_path: Option<OsString>) -> Result<Self> {
let config_path = config_path.unwrap_or_else(|| OsString::from(DEFAULT_CONFIG_PATH));
let path = std::path::PathBuf::from(config_path);
let config = Config::read_or_create(&path).await?;
pub async fn try_new(config: Config) -> Result<Self> {
let broadcasts = Broadcasts::new(&config.server);
let database = Database::try_new(&config.database, &broadcasts).await?;
let cursors: Cursors = Cursors::new(&config.database, &broadcasts);