cleanup-request-rs
Felix Ableitner 2023-10-26 13:25:47 +02:00
parent 9b40d74cce
commit 95025adaca
4 changed files with 5 additions and 7 deletions

View File

@ -40,12 +40,7 @@ pub fn config(
) )
// This has optional query params: /image/{filename}?format=jpg&thumbnail=256 // This has optional query params: /image/{filename}?format=jpg&thumbnail=256
.service(web::resource("/pictrs/image/{filename}").route(web::get().to(full_res))) .service(web::resource("/pictrs/image/{filename}").route(web::get().to(full_res)))
.service(web::resource("/pictrs/image/delete/{token}/{filename}").route(web::get().to(delete))) .service(web::resource("/pictrs/image/delete/{token}/{filename}").route(web::get().to(delete)));
.service(
web::scope("/api/v3")
.wrap(rate_limit.message())
.route("image_proxy", web::post().to(image_proxy)),
);
} }
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]

View File

@ -77,7 +77,7 @@ services:
init: true init: true
pictrs: pictrs:
image: asonix/pictrs:0.4.0-beta.19 image: asonix/pictrs:0.5.0-alpha.20
# this needs to match the pictrs url in lemmy.hjson # this needs to match the pictrs url in lemmy.hjson
hostname: pictrs hostname: pictrs
# we can set options to pictrs like this, here we set max. image size and forced format for conversion # we can set options to pictrs like this, here we set max. image size and forced format for conversion

View File

@ -22,6 +22,7 @@
url: "http://pictrs:8080/" url: "http://pictrs:8080/"
# api_key: "API_KEY" # api_key: "API_KEY"
cache_remote_images: true cache_remote_images: true
image_proxy: true
} }
#opentelemetry_url: "http://otel:4137" #opentelemetry_url: "http://otel:4137"

View File

@ -124,11 +124,13 @@ use lemmy_apub::api::{
search::search, search::search,
user_settings_backup::{export_settings, import_settings}, user_settings_backup::{export_settings, import_settings},
}; };
use lemmy_routes::images::image_proxy;
use lemmy_utils::rate_limit::RateLimitCell; use lemmy_utils::rate_limit::RateLimitCell;
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimitCell) { pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimitCell) {
cfg.service( cfg.service(
web::scope("/api/v3") web::scope("/api/v3")
.route("/image_proxy", web::get().to(image_proxy))
// Site // Site
.service( .service(
web::scope("/site") web::scope("/site")