aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/api/mod.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-06-16 21:26:34 +0200
committermetamuffin <metamuffin@disroot.org>2023-06-16 21:26:34 +0200
commit8da7d4f730c4026883a75706920bb9bdd1b0f5e4 (patch)
treeec79ea50464ec0ef88343b7df4e7fc64eee15740 /server/src/routes/api/mod.rs
parent202030972f0c31c208474a23164f0768c9023ad5 (diff)
downloadjellything-8da7d4f730c4026883a75706920bb9bdd1b0f5e4.tar
jellything-8da7d4f730c4026883a75706920bb9bdd1b0f5e4.tar.bz2
jellything-8da7d4f730c4026883a75706920bb9bdd1b0f5e4.tar.zst
cache images
Diffstat (limited to 'server/src/routes/api/mod.rs')
-rw-r--r--server/src/routes/api/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/src/routes/api/mod.rs b/server/src/routes/api/mod.rs
index fab60c6..af795f1 100644
--- a/server/src/routes/api/mod.rs
+++ b/server/src/routes/api/mod.rs
@@ -10,6 +10,7 @@ use std::path::PathBuf;
use super::ui::{
account::{login_logic, LoginForm},
node::AssetRole,
+ CacheControlFile,
};
use crate::{
database::Database,
@@ -56,7 +57,7 @@ pub async fn r_api_assets_node(
path: PathBuf,
role: AssetRole,
library: &State<Library>,
-) -> ApiResult<(ContentType, File)> {
+) -> ApiResult<(ContentType, CacheControlFile)> {
let node = library
.nested_path(&path)
.context("retrieving library node")?;
@@ -65,7 +66,7 @@ pub async fn r_api_assets_node(
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,
))
}