From 8da7d4f730c4026883a75706920bb9bdd1b0f5e4 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 16 Jun 2023 21:26:34 +0200 Subject: cache images --- server/src/routes/ui/node.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'server/src/routes/ui/node.rs') 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 +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 */ 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, -) -> 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, )) } -- cgit v1.2.3-70-g09d2