diff options
author | metamuffin <metamuffin@disroot.org> | 2023-06-16 21:26:34 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-06-16 21:26:34 +0200 |
commit | 8da7d4f730c4026883a75706920bb9bdd1b0f5e4 (patch) | |
tree | ec79ea50464ec0ef88343b7df4e7fc64eee15740 /server/src/routes/ui/node.rs | |
parent | 202030972f0c31c208474a23164f0768c9023ad5 (diff) | |
download | jellything-8da7d4f730c4026883a75706920bb9bdd1b0f5e4.tar jellything-8da7d4f730c4026883a75706920bb9bdd1b0f5e4.tar.bz2 jellything-8da7d4f730c4026883a75706920bb9bdd1b0f5e4.tar.zst |
cache images
Diffstat (limited to 'server/src/routes/ui/node.rs')
-rw-r--r-- | server/src/routes/ui/node.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs index 989f655..4d599dc 100644 --- a/server/src/routes/ui/node.rs +++ b/server/src/routes/ui/node.rs @@ -1,10 +1,11 @@ /* - This file is part of jellything (https://codeberg.org/metamuffin/jellything) - which is licensed under the GNU Affero General Public License (version 3); see /COPYING. - Copyright (C) 2023 metamuffin <metamuffin.org> +This file is part of jellything (https://codeberg.org/metamuffin/jellything) +which is licensed under the GNU Affero General Public License (version 3); see /COPYING. +Copyright (C) 2023 metamuffin <metamuffin.org> */ use super::error::MyError; use super::player::player_uri; +use super::CacheControlFile; use crate::uri; use crate::{ library::{Directory, Item, Library, Node}, @@ -148,7 +149,7 @@ pub async fn r_item_assets( path: PathBuf, role: AssetRole, library: &State<Library>, -) -> Result<(ContentType, File), MyError> { +) -> Result<(ContentType, CacheControlFile), MyError> { let node = library .nested_path(&path) .context("retrieving library node")?; @@ -157,6 +158,6 @@ pub async fn r_item_assets( let ext = path.extension().unwrap().to_str().unwrap(); Ok(( ContentType::from_extension(ext).unwrap(), - File::open(path).await?, + CacheControlFile::new(File::open(path).await?).await, )) } |