diff options
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/config.rs | 1 | ||||
-rw-r--r-- | src/data/mod.rs | 8 | ||||
-rw-r--r-- | src/data/namespace.rs | 5 | ||||
-rw-r--r-- | src/data/page.rs | 2 |
4 files changed, 1 insertions, 15 deletions
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<String>, } -#[cfg(feature = "ssr")] impl Config { pub fn read_from_file() -> Result<Self, String> { 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<Config> = LazyLock::new(|| Config::read_from_file().expect("Could not open config file")); -#[cfg(feature = "ssr")] static DATA_LOCK: LazyLock<StormscribeData> = LazyLock::new(|| { let config = &CONFIG; let lock_path = Path::join(&config.data_dir, ".lock"); @@ -53,7 +47,6 @@ static DATA_LOCK: LazyLock<StormscribeData> = LazyLock::new(|| { } }); -#[cfg(feature = "ssr")] pub struct StormscribeData { file_lock: File, data_snapshot: Mutex<Arc<DataSnapshot>>, @@ -71,7 +64,6 @@ pub struct PageData { content: String, } -#[cfg(feature = "ssr")] impl StormscribeData { async fn get_snapshot() -> Arc<DataSnapshot> { 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<PageUuid>, pub children: HashMap<String, Namespace>, @@ -28,7 +26,6 @@ impl Namespace { } } -#[cfg(feature = "ssr")] impl Namespaces { pub fn init(namespaces_dir: &Path) -> Result<Self, String> { // 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 = "<!-- trans rights ~ath&+ -->"; -#[cfg(feature = "ssr")] impl Pages { pub fn init(pages_dir: &Path) -> Result<Self, String> { // Read dir @@ -152,7 +151,6 @@ impl Pages { } } -#[cfg(feature = "ssr")] impl Page { pub async fn read_content(&self) -> Result<String, String> { use std::io::Read; |