This commit is contained in:
parent
349403d9fe
commit
02d40bee51
|
@ -3,7 +3,7 @@ use aws_config::BehaviorVersion;
|
||||||
use aws_sdk_s3::{config::Credentials, Client as S3Client};
|
use aws_sdk_s3::{config::Credentials, Client as S3Client};
|
||||||
use redis::{aio::MultiplexedConnection, AsyncCommands, Client as RedisClient};
|
use redis::{aio::MultiplexedConnection, AsyncCommands, Client as RedisClient};
|
||||||
use std::env;
|
use std::env;
|
||||||
use log::warn;
|
use log::info;
|
||||||
use crate::s3_utils::get_s3_filelist;
|
use crate::s3_utils::get_s3_filelist;
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ impl AppState {
|
||||||
|
|
||||||
/// Кэширует список файлов из Storj S3 в Redis.
|
/// Кэширует список файлов из Storj S3 в Redis.
|
||||||
pub async fn cache_filelist(&self) {
|
pub async fn cache_filelist(&self) {
|
||||||
warn!("caching AWS filelist...");
|
info!("caching AWS filelist...");
|
||||||
let mut redis = self.redis.clone();
|
let mut redis = self.redis.clone();
|
||||||
|
|
||||||
// Запрашиваем список файлов из Storj S3
|
// Запрашиваем список файлов из Storj S3
|
||||||
|
@ -103,7 +103,7 @@ impl AppState {
|
||||||
.expect(&format!("Failed to cache file {} in Redis", filename));
|
.expect(&format!("Failed to cache file {} in Redis", filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
warn!("cached {} files", filelist.len());
|
info!("cached {} files", filelist.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Получает путь из ключа (имени файла) в Redis.
|
/// Получает путь из ключа (имени файла) в Redis.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use actix_web::error::ErrorNotFound;
|
use actix_web::error::ErrorNotFound;
|
||||||
use actix_web::{error::ErrorInternalServerError, web, HttpRequest, HttpResponse, Result};
|
use actix_web::{error::ErrorInternalServerError, web, HttpRequest, HttpResponse, Result};
|
||||||
use log::{error, warn};
|
use log::{error, info};
|
||||||
|
|
||||||
use crate::app_state::AppState;
|
use crate::app_state::AppState;
|
||||||
use crate::handlers::serve_file::serve_file;
|
use crate::handlers::serve_file::serve_file;
|
||||||
|
@ -13,7 +13,7 @@ pub async fn proxy_handler(
|
||||||
requested_res: web::Path<String>,
|
requested_res: web::Path<String>,
|
||||||
state: web::Data<AppState>,
|
state: web::Data<AppState>,
|
||||||
) -> Result<HttpResponse, actix_web::Error> {
|
) -> Result<HttpResponse, actix_web::Error> {
|
||||||
warn!("\t>>>\tGET {}", requested_res);
|
info!("\t>>>\tGET {}", requested_res);
|
||||||
let normalized_path = if requested_res.ends_with("/webp") {
|
let normalized_path = if requested_res.ends_with("/webp") {
|
||||||
requested_res.replace("/webp", "")
|
requested_res.replace("/webp", "")
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,13 +22,13 @@ pub async fn proxy_handler(
|
||||||
|
|
||||||
// парсим GET запрос
|
// парсим GET запрос
|
||||||
let (base_filename, requested_width, extension) = parse_file_path(&normalized_path);
|
let (base_filename, requested_width, extension) = parse_file_path(&normalized_path);
|
||||||
warn!("detected file extension: {}", extension);
|
info!("detected file extension: {}", extension);
|
||||||
warn!("base_filename: {}", base_filename);
|
info!("base_filename: {}", base_filename);
|
||||||
warn!("requested width: {}", requested_width);
|
info!("requested width: {}", requested_width);
|
||||||
let ext = extension.as_str().to_lowercase();
|
let ext = extension.as_str().to_lowercase();
|
||||||
warn!("normalized to lowercase: {}", ext);
|
info!("normalized to lowercase: {}", ext);
|
||||||
let filekey = format!("{}.{}", base_filename, &ext);
|
let filekey = format!("{}.{}", base_filename, &ext);
|
||||||
warn!("filekey: {}", filekey);
|
info!("filekey: {}", filekey);
|
||||||
let content_type = match ext.as_str() {
|
let content_type = match ext.as_str() {
|
||||||
"jpg" | "jpeg" => "image/jpeg",
|
"jpg" | "jpeg" => "image/jpeg",
|
||||||
"png" => "image/png",
|
"png" => "image/png",
|
||||||
|
@ -47,7 +47,7 @@ pub async fn proxy_handler(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
warn!("content_type: {}", content_type);
|
info!("content_type: {}", content_type);
|
||||||
|
|
||||||
let shout_id = match req.query_string().contains("s=") {
|
let shout_id = match req.query_string().contains("s=") {
|
||||||
true => req
|
true => req
|
||||||
|
@ -61,16 +61,16 @@ pub async fn proxy_handler(
|
||||||
|
|
||||||
return match state.get_path(&filekey).await {
|
return match state.get_path(&filekey).await {
|
||||||
Ok(Some(stored_path)) => {
|
Ok(Some(stored_path)) => {
|
||||||
warn!("stored_path: {}", stored_path);
|
info!("stored_path: {}", stored_path);
|
||||||
// Проверяем, существует ли файл в Storj
|
// Проверяем, существует ли файл в Storj
|
||||||
if check_file_exists(&state.storj_client, &state.bucket, &stored_path).await? {
|
if check_file_exists(&state.storj_client, &state.bucket, &stored_path).await? {
|
||||||
if content_type.starts_with("image") {
|
if content_type.starts_with("image") {
|
||||||
if requested_width == 0 {
|
if requested_width == 0 {
|
||||||
return serve_file(&stored_path, &state, shout_id).await;
|
return serve_file(&stored_path, &state, shout_id).await;
|
||||||
}
|
}
|
||||||
warn!("base_filename: {}", base_filename);
|
info!("base_filename: {}", base_filename);
|
||||||
warn!("requested width: {}", requested_width);
|
info!("requested width: {}", requested_width);
|
||||||
warn!("extension: {}", extension);
|
info!("extension: {}", extension);
|
||||||
// Получаем оригинальное изображение для проверки размера
|
// Получаем оригинальное изображение для проверки размера
|
||||||
let original_key = format!("{}.{}", base_filename, extension);
|
let original_key = format!("{}.{}", base_filename, extension);
|
||||||
if let Ok(original_data) =
|
if let Ok(original_data) =
|
||||||
|
@ -79,7 +79,7 @@ pub async fn proxy_handler(
|
||||||
if let Ok(img) = image::load_from_memory(&original_data) {
|
if let Ok(img) = image::load_from_memory(&original_data) {
|
||||||
// Если запрошенная ширина больше оригинала, возвращаем оригинал
|
// Если запрошенная ширина больше оригинала, возвращаем оригинал
|
||||||
if requested_width >= img.width() {
|
if requested_width >= img.width() {
|
||||||
warn!(
|
info!(
|
||||||
"requested width {} >= original width {}, serving original",
|
"requested width {} >= original width {}, serving original",
|
||||||
requested_width,
|
requested_width,
|
||||||
img.width()
|
img.width()
|
||||||
|
@ -89,7 +89,7 @@ pub async fn proxy_handler(
|
||||||
|
|
||||||
// Находим ближайшую поддерживаемую ширину
|
// Находим ближайшую поддерживаемую ширину
|
||||||
let target_width = find_closest_width(requested_width);
|
let target_width = find_closest_width(requested_width);
|
||||||
warn!("normalized requested width {} to closest supported width {}", requested_width, target_width);
|
info!("normalized requested width {} to closest supported width {}", requested_width, target_width);
|
||||||
|
|
||||||
// Проверяем/генерируем миниатюру
|
// Проверяем/генерируем миниатюру
|
||||||
let thumb_filename =
|
let thumb_filename =
|
||||||
|
@ -103,7 +103,7 @@ pub async fn proxy_handler(
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
warn!("serve existed thumb file: {}", thumb_filename);
|
info!("serve existed thumb file: {}", thumb_filename);
|
||||||
return serve_file(&thumb_filename, &state, shout_id).await;
|
return serve_file(&thumb_filename, &state, shout_id).await;
|
||||||
}
|
}
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
|
@ -115,8 +115,8 @@ pub async fn proxy_handler(
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
warn!("generate new thumb files: {}", stored_path);
|
info!("generate new thumb files: {}", stored_path);
|
||||||
warn!("{} bytes", filedata.len());
|
info!("{} bytes", filedata.len());
|
||||||
|
|
||||||
// Генерируем миниатюру и сохраняем
|
// Генерируем миниатюру и сохраняем
|
||||||
if let Ok(_) = thumbdata_save(
|
if let Ok(_) = thumbdata_save(
|
||||||
|
@ -127,7 +127,7 @@ pub async fn proxy_handler(
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
warn!("serve new thumb file: {}", thumb_filename);
|
info!("serve new thumb file: {}", thumb_filename);
|
||||||
return serve_file(&thumb_filename, &state, shout_id)
|
return serve_file(&thumb_filename, &state, shout_id)
|
||||||
.await;
|
.await;
|
||||||
} else {
|
} else {
|
||||||
|
@ -154,13 +154,13 @@ pub async fn proxy_handler(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Если файл не изображение, продолжаем обработку
|
// Если файл не изображение, продолжаем обработку
|
||||||
warn!("file is not an image");
|
info!("file is not an image");
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to download what stored_path keeping in aws
|
// we need to download what stored_path keeping in aws
|
||||||
return match load_file_from_s3(&state.aws_client, &state.bucket, &stored_path).await {
|
return match load_file_from_s3(&state.aws_client, &state.bucket, &stored_path).await {
|
||||||
Ok(filedata) => {
|
Ok(filedata) => {
|
||||||
warn!("download stored_path from aws: {:?}", stored_path);
|
info!("download stored_path from aws: {:?}", stored_path);
|
||||||
if let Err(e) = upload_to_s3(
|
if let Err(e) = upload_to_s3(
|
||||||
&state.storj_client,
|
&state.storj_client,
|
||||||
&state.bucket,
|
&state.bucket,
|
||||||
|
@ -172,7 +172,7 @@ pub async fn proxy_handler(
|
||||||
{
|
{
|
||||||
error!("cannot upload to storj: {}", e);
|
error!("cannot upload to storj: {}", e);
|
||||||
} else {
|
} else {
|
||||||
warn!("file {} uploaded to storj", filekey);
|
info!("file {} uploaded to storj", filekey);
|
||||||
state.set_path(&filekey, &filekey).await;
|
state.set_path(&filekey, &filekey).await;
|
||||||
}
|
}
|
||||||
let _ = thumbdata_save(
|
let _ = thumbdata_save(
|
||||||
|
@ -192,7 +192,7 @@ pub async fn proxy_handler(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
warn!("cannot find stored path for: {}", filekey);
|
info!("cannot find stored path for: {}", filekey);
|
||||||
let ct_parts = content_type.split("/").collect::<Vec<&str>>();
|
let ct_parts = content_type.split("/").collect::<Vec<&str>>();
|
||||||
let filepath = format!("production/{}/{}.{}", ct_parts[0], base_filename, extension); // NOTE: original ext
|
let filepath = format!("production/{}/{}.{}", ct_parts[0], base_filename, extension); // NOTE: original ext
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ pub async fn proxy_handler(
|
||||||
check_file_exists(&state.storj_client, &state.bucket, &filepath).await?;
|
check_file_exists(&state.storj_client, &state.bucket, &filepath).await?;
|
||||||
|
|
||||||
if exists_in_storj {
|
if exists_in_storj {
|
||||||
warn!(
|
info!(
|
||||||
"file {} exists in storj, try to generate thumbnails",
|
"file {} exists in storj, try to generate thumbnails",
|
||||||
filepath
|
filepath
|
||||||
);
|
);
|
||||||
|
@ -221,7 +221,7 @@ pub async fn proxy_handler(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn!("file {} does not exist in storj", filepath);
|
info!("file {} does not exist in storj", filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
let exists_in_aws =
|
let exists_in_aws =
|
||||||
|
@ -245,9 +245,9 @@ pub async fn proxy_handler(
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
warn!("cannot upload to storj: {}", e);
|
info!("cannot upload to storj: {}", e);
|
||||||
} else {
|
} else {
|
||||||
warn!("file {} uploaded to storj", filekey);
|
info!("file {} uploaded to storj", filekey);
|
||||||
state.set_path(&filekey, &filepath).await;
|
state.set_path(&filekey, &filepath).await;
|
||||||
}
|
}
|
||||||
Ok(HttpResponse::Ok().content_type(content_type).body(filedata))
|
Ok(HttpResponse::Ok().content_type(content_type).body(filedata))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use actix_multipart::Multipart;
|
use actix_multipart::Multipart;
|
||||||
use actix_web::{web, HttpRequest, HttpResponse, Result};
|
use actix_web::{web, HttpRequest, HttpResponse, Result};
|
||||||
use log::warn;
|
use log::info;
|
||||||
|
|
||||||
use crate::app_state::AppState;
|
use crate::app_state::AppState;
|
||||||
use crate::auth::{get_id_by_token, user_added_file};
|
use crate::auth::{get_id_by_token, user_added_file};
|
||||||
|
@ -69,9 +69,9 @@ pub async fn upload_handler(
|
||||||
&content_type,
|
&content_type,
|
||||||
)
|
)
|
||||||
.await {
|
.await {
|
||||||
warn!("cannot upload to storj: {}", e);
|
info!("cannot upload to storj: {}", e);
|
||||||
} else {
|
} else {
|
||||||
warn!("file {} uploaded to storj", body);
|
info!("file {} uploaded to storj", body);
|
||||||
// Сохраняем информацию о загруженном файле для пользователя
|
// Сохраняем информацию о загруженном файле для пользователя
|
||||||
user_added_file(&mut state.redis.clone(), &user_id, &body).await?;
|
user_added_file(&mut state.redis.clone(), &user_id, &body).await?;
|
||||||
state.set_path(&body, &body).await;
|
state.set_path(&body, &body).await;
|
||||||
|
|
|
@ -9,7 +9,7 @@ mod overlay;
|
||||||
use actix_web::{middleware::Logger, web, App, HttpServer};
|
use actix_web::{middleware::Logger, web, App, HttpServer};
|
||||||
use app_state::AppState;
|
use app_state::AppState;
|
||||||
use handlers::{proxy_handler, upload_handler};
|
use handlers::{proxy_handler, upload_handler};
|
||||||
use log::warn;
|
use log::info;
|
||||||
use tokio::task::spawn_blocking;
|
use tokio::task::spawn_blocking;
|
||||||
use std::env;
|
use std::env;
|
||||||
use env_logger;
|
use env_logger;
|
||||||
|
@ -17,7 +17,7 @@ use env_logger;
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
warn!("Started");
|
info!("Started");
|
||||||
|
|
||||||
let port = env::var("PORT").unwrap_or_else(|_| "8080".to_string());
|
let port = env::var("PORT").unwrap_or_else(|_| "8080".to_string());
|
||||||
let addr = format!("0.0.0.0:{}", port);
|
let addr = format!("0.0.0.0:{}", port);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{error::Error, io::Cursor};
|
use std::{error::Error, io::Cursor};
|
||||||
use actix_web::web::Bytes;
|
use actix_web::web::Bytes;
|
||||||
use log::warn;
|
use log::info;
|
||||||
use image::Rgba;
|
use image::Rgba;
|
||||||
use imageproc::drawing::{draw_text_mut, draw_filled_rect_mut};
|
use imageproc::drawing::{draw_text_mut, draw_filled_rect_mut};
|
||||||
use imageproc::rect::Rect;
|
use imageproc::rect::Rect;
|
||||||
|
@ -86,7 +86,7 @@ pub async fn generate_overlay<'a>(shout_id: &'a str, filedata: Bytes) -> Result<
|
||||||
Ok(Bytes::from(buffer))
|
Ok(Bytes::from(buffer))
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("Error getting shout: {}", e);
|
info!("Error getting shout: {}", e);
|
||||||
Ok(filedata)
|
Ok(filedata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use actix_web::error::ErrorInternalServerError;
|
use actix_web::error::ErrorInternalServerError;
|
||||||
use image::{imageops::FilterType, DynamicImage, ImageFormat};
|
use image::{imageops::FilterType, DynamicImage, ImageFormat};
|
||||||
use log::{warn, error};
|
use log::{info, error};
|
||||||
use std::{collections::HashMap, io::Cursor};
|
use std::{collections::HashMap, io::Cursor};
|
||||||
|
|
||||||
use crate::{app_state::AppState, s3_utils::upload_to_s3};
|
use crate::{app_state::AppState, s3_utils::upload_to_s3};
|
||||||
|
@ -69,13 +69,13 @@ pub async fn generate_thumbnails(
|
||||||
|
|
||||||
// Генерируем миниатюры только для размеров меньше оригинала
|
// Генерируем миниатюры только для размеров меньше оригинала
|
||||||
for &width in THUMB_WIDTHS.iter().filter(|&&w| w < original_width) {
|
for &width in THUMB_WIDTHS.iter().filter(|&&w| w < original_width) {
|
||||||
warn!("[THUMB] Generating thumbnail width: {}", width);
|
info!("[THUMB] Generating thumbnail width: {}", width);
|
||||||
let thumbnail = image.resize(width, u32::MAX, FilterType::Lanczos3);
|
let thumbnail = image.resize(width, u32::MAX, FilterType::Lanczos3);
|
||||||
let mut buffer = Vec::new();
|
let mut buffer = Vec::new();
|
||||||
|
|
||||||
match thumbnail.write_to(&mut Cursor::new(&mut buffer), format) {
|
match thumbnail.write_to(&mut Cursor::new(&mut buffer), format) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
warn!("[THUMB] Successfully generated thumbnail: {}x{}", width, thumbnail.height());
|
info!("[THUMB] Successfully generated thumbnail: {}x{}", width, thumbnail.height());
|
||||||
thumbnails.insert(width, buffer);
|
thumbnails.insert(width, buffer);
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -86,9 +86,9 @@ pub async fn generate_thumbnails(
|
||||||
}
|
}
|
||||||
|
|
||||||
if thumbnails.is_empty() {
|
if thumbnails.is_empty() {
|
||||||
warn!("[THUMB] No thumbnails generated, image width: {}", original_width);
|
info!("[THUMB] No thumbnails generated, image width: {}", original_width);
|
||||||
} else {
|
} else {
|
||||||
warn!("[THUMB] Generated {} thumbnails", thumbnails.len());
|
info!("[THUMB] Generated {} thumbnails", thumbnails.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(thumbnails)
|
Ok(thumbnails)
|
||||||
|
@ -121,17 +121,17 @@ pub async fn thumbdata_save(
|
||||||
content_type: String,
|
content_type: String,
|
||||||
) -> Result<(), actix_web::Error> {
|
) -> Result<(), actix_web::Error> {
|
||||||
if content_type.starts_with("image") {
|
if content_type.starts_with("image") {
|
||||||
warn!("[THUMB] Processing image: {}", original_filename);
|
info!("[THUMB] Processing image: {}", original_filename);
|
||||||
let (base_filename, _, extension) = parse_file_path(&original_filename);
|
let (base_filename, _, extension) = parse_file_path(&original_filename);
|
||||||
warn!("[THUMB] Parsed: base={}, ext={}", base_filename, extension);
|
info!("[THUMB] Parsed: base={}, ext={}", base_filename, extension);
|
||||||
|
|
||||||
let ext = extension.to_lowercase();
|
let ext = extension.to_lowercase();
|
||||||
let filename = format!("{}.{}", base_filename, ext);
|
let filename = format!("{}.{}", base_filename, ext);
|
||||||
warn!("[THUMB] Normalized filename: {}", filename);
|
info!("[THUMB] Normalized filename: {}", filename);
|
||||||
|
|
||||||
let img = match image::load_from_memory(&original_data) {
|
let img = match image::load_from_memory(&original_data) {
|
||||||
Ok(img) => {
|
Ok(img) => {
|
||||||
warn!("[THUMB] Successfully loaded image from memory, size: {}x{}",
|
info!("[THUMB] Successfully loaded image from memory, size: {}x{}",
|
||||||
img.width(), img.height());
|
img.width(), img.height());
|
||||||
img
|
img
|
||||||
},
|
},
|
||||||
|
@ -143,7 +143,7 @@ pub async fn thumbdata_save(
|
||||||
|
|
||||||
let format = match determine_image_format(&ext) {
|
let format = match determine_image_format(&ext) {
|
||||||
Ok(f) => {
|
Ok(f) => {
|
||||||
warn!("[THUMB] Using format: {:?}", f);
|
info!("[THUMB] Using format: {:?}", f);
|
||||||
f
|
f
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -154,11 +154,11 @@ pub async fn thumbdata_save(
|
||||||
|
|
||||||
match generate_thumbnails(&img, format).await {
|
match generate_thumbnails(&img, format).await {
|
||||||
Ok(thumbnails_bytes) => {
|
Ok(thumbnails_bytes) => {
|
||||||
warn!("[THUMB] Generated {} thumbnails", thumbnails_bytes.len());
|
info!("[THUMB] Generated {} thumbnails", thumbnails_bytes.len());
|
||||||
|
|
||||||
for (thumb_width, thumbnail) in thumbnails_bytes {
|
for (thumb_width, thumbnail) in thumbnails_bytes {
|
||||||
let thumb_filename = format!("{}_{}.{}", base_filename, thumb_width, ext);
|
let thumb_filename = format!("{}_{}.{}", base_filename, thumb_width, ext);
|
||||||
warn!("[THUMB] Saving thumbnail: {}", thumb_filename);
|
info!("[THUMB] Saving thumbnail: {}", thumb_filename);
|
||||||
|
|
||||||
match upload_to_s3(
|
match upload_to_s3(
|
||||||
&state.storj_client,
|
&state.storj_client,
|
||||||
|
@ -168,10 +168,10 @@ pub async fn thumbdata_save(
|
||||||
&content_type,
|
&content_type,
|
||||||
).await {
|
).await {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
warn!("[THUMB] Successfully saved thumbnail: {}", thumb_filename);
|
info!("[THUMB] Successfully saved thumbnail: {}", thumb_filename);
|
||||||
// Сохраняем путь к миниатюре в Redis
|
// Сохраняем путь к миниатюре в Redis
|
||||||
state.set_path(&thumb_filename, &thumb_filename).await;
|
state.set_path(&thumb_filename, &thumb_filename).await;
|
||||||
warn!("[THUMB] Cached path in Redis: {}", thumb_filename);
|
info!("[THUMB] Cached path in Redis: {}", thumb_filename);
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("[THUMB] Failed to save thumbnail {}: {}", thumb_filename, e);
|
error!("[THUMB] Failed to save thumbnail {}: {}", thumb_filename, e);
|
||||||
|
@ -186,7 +186,7 @@ pub async fn thumbdata_save(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn!("[THUMB] Skipping non-image content type: {}", content_type);
|
info!("[THUMB] Skipping non-image content type: {}", content_type);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user