mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Remove allowed thumbnail sizes for now.
This commit is contained in:
parent
88bd368660
commit
048271f59b
@ -5,8 +5,6 @@ use awc::Client;
|
|||||||
use lemmy_utils::settings::Settings;
|
use lemmy_utils::settings::Settings;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
const THUMBNAIL_SIZES: &[u64] = &[256];
|
|
||||||
|
|
||||||
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
||||||
let client = Client::build()
|
let client = Client::build()
|
||||||
.header("User-Agent", "pict-rs-frontend, v0.1.0")
|
.header("User-Agent", "pict-rs-frontend, v0.1.0")
|
||||||
@ -79,18 +77,14 @@ async fn thumbnail(
|
|||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let (size, file) = parts.into_inner();
|
let (size, file) = parts.into_inner();
|
||||||
|
|
||||||
if THUMBNAIL_SIZES.contains(&size) {
|
let url = format!(
|
||||||
let url = format!(
|
"{}/image/thumbnail{}/{}",
|
||||||
"{}/image/thumbnail{}/{}",
|
Settings::get().pictrs_url,
|
||||||
Settings::get().pictrs_url,
|
size,
|
||||||
size,
|
&file
|
||||||
&file
|
);
|
||||||
);
|
|
||||||
|
|
||||||
return image(url, req, client).await;
|
image(url, req, client).await
|
||||||
}
|
|
||||||
|
|
||||||
Ok(HttpResponse::NotFound().finish())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn image(
|
async fn image(
|
||||||
|
Loading…
Reference in New Issue
Block a user