aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/src/routes.rs16
-rw-r--r--server/src/ui/assets.rs12
-rw-r--r--ui/src/node_card.rs4
3 files changed, 16 insertions, 16 deletions
diff --git a/common/src/routes.rs b/common/src/routes.rs
index 3d92b6e..cdccf9d 100644
--- a/common/src/routes.rs
+++ b/common/src/routes.rs
@@ -20,8 +20,8 @@ pub fn u_node_slug_player(node: &str) -> String {
pub fn u_node_slug_player_time(node: &str, time: f64) -> String {
format!("/n/{node}/player?t={time}")
}
-pub fn u_node_image(node: &str, slot: PictureSlot, width: usize) -> String {
- format!("/n/{node}/image/{slot}?width={width}")
+pub fn u_node_image(node: &str, slot: PictureSlot, size: usize) -> String {
+ format!("/n/{node}/image/{slot}?size={size}")
}
pub fn u_node_slug_watched(node: &str, state: ApiWatchedState) -> String {
format!("/n/{node}/watched?state={state}")
@@ -30,12 +30,12 @@ pub fn u_node_slug_person_asset(
node: &str,
group: CreditCategory,
index: usize,
- width: usize,
+ size: usize,
) -> String {
- format!("/n/{node}/person/{index}/asset?group={group}&width={width}")
+ format!("/n/{node}/person/{index}/asset?group={group}&size={size}")
}
-pub fn u_node_slug_thumbnail(node: &str, time: f64, width: usize) -> String {
- format!("/n/{node}/thumbnail?t={time}&width={width}")
+pub fn u_node_slug_thumbnail(node: &str, time: f64, size: usize) -> String {
+ format!("/n/{node}/thumbnail?t={time}&size={size}")
}
pub fn u_node_slug_update_rating(node: &str) -> String {
format!("/n/{node}/update_rating")
@@ -101,6 +101,6 @@ pub fn u_stats() -> String {
pub fn u_search() -> String {
"/search".to_owned()
}
-pub fn u_asset(token: &str, width: usize) -> String {
- format!("/asset/{token}?width={width}")
+pub fn u_asset(token: &str, size: usize) -> String {
+ format!("/asset/{token}?size={size}")
}
diff --git a/server/src/ui/assets.rs b/server/src/ui/assets.rs
index 6bc92ef..494638c 100644
--- a/server/src/ui/assets.rs
+++ b/server/src/ui/assets.rs
@@ -4,14 +4,14 @@
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
use super::error::MyResult;
-use crate::helper::{cache::CacheControlImage, A};
-use anyhow::{anyhow, Context};
-use jellycommon::{api::NodeFilterSort, Asset, NodeID, PictureSlot};
+use crate::helper::{A, cache::CacheControlImage};
+use anyhow::{Context, anyhow};
+use jellycommon::{Asset, NodeID, PictureSlot, api::NodeFilterSort};
use jellylogic::{assets::get_node_thumbnail, node::get_node, session::Session};
use rocket::{get, http::ContentType, response::Redirect};
use std::str::FromStr;
-pub const AVIF_QUALITY: u32 = 50;
+pub const AVIF_QUALITY: u32 = 70;
pub const AVIF_SPEED: u8 = 5;
#[get("/image/<key..>?<size>")]
@@ -22,13 +22,13 @@ pub async fn r_image(
) -> MyResult<(ContentType, CacheControlImage)> {
let size = size.unwrap_or(2048);
- if !key.0 .0.ends_with(".image") {
+ if !key.0.0.ends_with(".image") {
Err(anyhow!("request to non-image"))?
}
// fit the resolution into a finite set so the maximum cache is finite too.
let width = 2usize.pow(size.clamp(128, 2048).ilog2());
- let encoded = jellytranscoder::image::transcode(&key.0 .0, AVIF_QUALITY, AVIF_SPEED, width)
+ let encoded = jellytranscoder::image::transcode(&key.0.0, AVIF_QUALITY, AVIF_SPEED, width)
.context("transcoding asset")?;
Ok((ContentType::AVIF, CacheControlImage(encoded)))
diff --git a/ui/src/node_card.rs b/ui/src/node_card.rs
index dfcd37c..35c286c 100644
--- a/ui/src/node_card.rs
+++ b/ui/src/node_card.rs
@@ -17,7 +17,7 @@ markup::define! {
div[class=cls] {
.poster {
a[href=u_node_slug(&node.slug)] {
- img[src=u_node_image(&node.slug, PictureSlot::Cover, 1024), loading="lazy"];
+ img[src=u_node_image(&node.slug, PictureSlot::Cover, 512), loading="lazy"];
}
.cardhover.item {
@if node.media.is_some() {
@@ -42,7 +42,7 @@ markup::define! {
div[class="node card widecard poster"] {
div[class=&format!("poster {}", aspect_class(node.kind))] {
a[href=u_node_slug(&node.slug)] {
- img[src=u_node_image(&node.slug, PictureSlot::Cover, 1024), loading="lazy"];
+ img[src=u_node_image(&node.slug, PictureSlot::Cover, 512), loading="lazy"];
}
.cardhover.item {
@if node.media.is_some() {