diff options
author | metamuffin <metamuffin@disroot.org> | 2024-01-24 18:11:23 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-01-24 18:47:29 +0100 |
commit | 7323709537c6ff14136cd79fb07606cd79391758 (patch) | |
tree | 3d817d449d4c0a821b9b5073c8acf826c6ccfda1 /base/src/lib.rs | |
parent | cbb2e163abfefd8ed61c41a096d5d6c27b4721b4 (diff) | |
download | jellything-7323709537c6ff14136cd79fb07606cd79391758.tar jellything-7323709537c6ff14136cd79fb07606cd79391758.tar.bz2 jellything-7323709537c6ff14136cd79fb07606cd79391758.tar.zst |
refactor asset system pt. 1
Diffstat (limited to 'base/src/lib.rs')
-rw-r--r-- | base/src/lib.rs | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/base/src/lib.rs b/base/src/lib.rs index 015b62b..90ac27b 100644 --- a/base/src/lib.rs +++ b/base/src/lib.rs @@ -8,13 +8,10 @@ pub mod cache; pub mod database; pub mod federation; pub mod permission; -pub mod temp; +pub mod assetfed; -use jellycommon::{ - config::{GlobalConfig, SecretsConfig}, - AssetLocation, -}; -use std::{fs::File, path::PathBuf, sync::LazyLock}; +use jellycommon::config::{GlobalConfig, SecretsConfig}; +use std::{fs::File, sync::LazyLock}; pub static CONF: LazyLock<GlobalConfig> = LazyLock::new(|| { serde_yaml::from_reader( @@ -39,18 +36,3 @@ pub static SECRETS: LazyLock<SecretsConfig> = LazyLock::new(|| { serde_yaml::from_reader(File::open(&CONF.secrets_path).expect("secrets file missing")) .expect("secrets config invalid") }); - -pub trait AssetLocationExt { - fn path(&self) -> PathBuf; -} -impl AssetLocationExt for AssetLocation { - fn path(&self) -> PathBuf { - match self { - AssetLocation::Assets(p) => CONF.asset_path.join(p), - AssetLocation::Cache(p) => CONF.cache_path.join(p), - AssetLocation::Library(p) => CONF.library_path.join(p), - AssetLocation::Temp(p) => CONF.temp_path.join(p), - AssetLocation::Media(p) => CONF.media_path.join(p), - } - } -} |