add: allow supporters to upload gif avatars/banners

This commit is contained in:
trisua 2025-05-04 16:19:34 -04:00
parent cf38022597
commit e727de9c63
10 changed files with 231 additions and 52 deletions

View file

@ -6,7 +6,7 @@ use tetratto_core::model::{ApiReturn, Error, permissions::FinePermission};
use crate::{
State,
avif::{Image, save_avif_buffer},
image::{Image, save_buffer},
get_user_from_token,
routes::api::v1::auth::images::{MAXIUMUM_FILE_SIZE, read_image},
};
@ -146,7 +146,7 @@ pub async fn upload_avatar_request(
bytes.push(byte);
}
match save_avif_buffer(&path, bytes) {
match save_buffer(&path, bytes, image::ImageFormat::Avif) {
Ok(_) => Json(ApiReturn {
ok: true,
message: "Avatar uploaded. It might take a bit to update".to_string(),
@ -201,7 +201,7 @@ pub async fn upload_banner_request(
bytes.push(byte);
}
match save_avif_buffer(&path, bytes) {
match save_buffer(&path, bytes, image::ImageFormat::Avif) {
Ok(_) => Json(ApiReturn {
ok: true,
message: "Banner uploaded. It might take a bit to update".to_string(),