From 2dacece4eedc8af2ccde3be6918371293350cc4e Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Sat, 26 Apr 2025 21:06:00 -0600 Subject: Convert to rocket and morgana --- src/data/config.rs | 1 - src/data/mod.rs | 8 -------- src/data/namespace.rs | 5 +---- src/data/page.rs | 2 -- 4 files changed, 1 insertion(+), 15 deletions(-) (limited to 'src/data') diff --git a/src/data/config.rs b/src/data/config.rs index 11e10cc..34ec958 100644 --- a/src/data/config.rs +++ b/src/data/config.rs @@ -20,7 +20,6 @@ pub struct Config { pub footer_copyright: Option, } -#[cfg(feature = "ssr")] impl Config { pub fn read_from_file() -> Result { let config_path = Self::get_location()?; diff --git a/src/data/mod.rs b/src/data/mod.rs index 1465fee..2be1f0a 100644 --- a/src/data/mod.rs +++ b/src/data/mod.rs @@ -1,13 +1,9 @@ use serde::{Deserialize, Serialize}; -#[cfg(feature = "ssr")] use tokio::sync::Mutex; use uuid::Uuid; -#[cfg(feature = "ssr")] use fs2::FileExt; -#[cfg(feature = "ssr")] use std::fs::File; -#[cfg(feature = "ssr")] use std::sync::LazyLock; use std::{collections::HashMap, path::Path, sync::Arc}; @@ -23,11 +19,9 @@ pub use page::{Page, Pages}; #[derive(Hash, PartialEq, Eq, Clone, Debug, Deserialize, Serialize)] pub struct PageUuid(Uuid); -#[cfg(feature = "ssr")] pub static CONFIG: LazyLock = LazyLock::new(|| Config::read_from_file().expect("Could not open config file")); -#[cfg(feature = "ssr")] static DATA_LOCK: LazyLock = LazyLock::new(|| { let config = &CONFIG; let lock_path = Path::join(&config.data_dir, ".lock"); @@ -53,7 +47,6 @@ static DATA_LOCK: LazyLock = LazyLock::new(|| { } }); -#[cfg(feature = "ssr")] pub struct StormscribeData { file_lock: File, data_snapshot: Mutex>, @@ -71,7 +64,6 @@ pub struct PageData { content: String, } -#[cfg(feature = "ssr")] impl StormscribeData { async fn get_snapshot() -> Arc { DATA_LOCK.data_snapshot.lock().await.clone() diff --git a/src/data/namespace.rs b/src/data/namespace.rs index 4aa0419..4347abb 100644 --- a/src/data/namespace.rs +++ b/src/data/namespace.rs @@ -1,15 +1,13 @@ -use serde::{Deserialize, Serialize}; use std::collections::HashMap; use uuid::Uuid; use crate::data::PageUuid; -#[cfg(feature = "ssr")] use std::{ fs, path::{Path, PathBuf}, }; -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug)] pub struct Namespace { pub page: Option, pub children: HashMap, @@ -28,7 +26,6 @@ impl Namespace { } } -#[cfg(feature = "ssr")] impl Namespaces { pub fn init(namespaces_dir: &Path) -> Result { // Read dir recursive diff --git a/src/data/page.rs b/src/data/page.rs index 7b7d432..4a31894 100644 --- a/src/data/page.rs +++ b/src/data/page.rs @@ -28,7 +28,6 @@ pub struct Pages { const METADATA_DIVIDER: &'static str = ""; -#[cfg(feature = "ssr")] impl Pages { pub fn init(pages_dir: &Path) -> Result { // Read dir @@ -152,7 +151,6 @@ impl Pages { } } -#[cfg(feature = "ssr")] impl Page { pub async fn read_content(&self) -> Result { use std::io::Read; -- cgit 1.4.1