aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/assets.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-04-10 19:51:37 +0200
committermetamuffin <metamuffin@disroot.org>2024-04-10 19:51:43 +0200
commita820b817bf4bfbf7e8978ffc427ccbf75a74309a (patch)
treea59a5c89f8fe3e62fc39f485ffffe84d02989409 /server/src/routes/ui/assets.rs
parent18e23f2454cc6b3a75165eaafebe6c51bbe1f1d0 (diff)
downloadjellything-a820b817bf4bfbf7e8978ffc427ccbf75a74309a.tar
jellything-a820b817bf4bfbf7e8978ffc427ccbf75a74309a.tar.bz2
jellything-a820b817bf4bfbf7e8978ffc427ccbf75a74309a.tar.zst
pretranscode poster buutton
Diffstat (limited to 'server/src/routes/ui/assets.rs')
-rw-r--r--server/src/routes/ui/assets.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/src/routes/ui/assets.rs b/server/src/routes/ui/assets.rs
index 115c02a..c278a31 100644
--- a/server/src/routes/ui/assets.rs
+++ b/server/src/routes/ui/assets.rs
@@ -20,6 +20,9 @@ use log::info;
use rocket::{get, http::ContentType, response::Redirect, State};
use std::path::PathBuf;
+pub const AVIF_QUALITY: f32 = 50.;
+pub const AVIF_SPEED: u8 = 5;
+
#[get("/asset/<token>?<width>")]
pub async fn r_asset(
_session: Session,
@@ -43,8 +46,7 @@ pub async fn r_asset(
// fit the resolution into a finite set so the maximum cache is finite too.
let width = 2usize.pow(width.clamp(128, 2048).ilog2());
- // TODO configure avif quality and speed.
- jellytranscoder::image::transcode(source, 50., 5, width)
+ jellytranscoder::image::transcode(source, AVIF_QUALITY, AVIF_SPEED, width)
.await
.context("transcoding asset")?
};