From e3153df74ddef8446cea6cd9cb42f159e1816415 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Wed, 2 Mar 2022 18:05:48 +0000 Subject: [PATCH] Remove direct `actix-http` dependency --- Cargo.lock | 1 - crates/routes/Cargo.toml | 3 +-- crates/routes/src/images.rs | 16 +++++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 02ef5b1c7..77e7f01c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2073,7 +2073,6 @@ name = "lemmy_routes" version = "0.16.0-rc.1" dependencies = [ "actix", - "actix-http", "actix-web", "actix-web-actors", "anyhow", diff --git a/crates/routes/Cargo.toml b/crates/routes/Cargo.toml index 4e16e48c3..dace264fc 100644 --- a/crates/routes/Cargo.toml +++ b/crates/routes/Cargo.toml @@ -21,8 +21,7 @@ lemmy_apub = { version = "=0.16.0-rc.1", path = "../apub" } diesel = "1.4.8" actix = "0.13.0" actix-web = { version = "4.0.0", default-features = false, features = ["rustls"] } -actix-web-actors = { version = "4.0.0", default-features = false } -actix-http = "3.0.0" +actix-web-actors = { version = "4.1.0", default-features = false } sha2 = "0.10.0" anyhow = "1.0.51" chrono = { version = "0.4.19", features = ["serde"] } diff --git a/crates/routes/src/images.rs b/crates/routes/src/images.rs index 30a6a378f..fb4ef2613 100644 --- a/crates/routes/src/images.rs +++ b/crates/routes/src/images.rs @@ -1,5 +1,15 @@ -use actix_http::header::{HeaderName, ACCEPT_ENCODING, HOST}; -use actix_web::{body::BodyStream, http::StatusCode, web::Data, *}; +use actix_web::{ + body::BodyStream, + error, + http::{ + header::{HeaderName, ACCEPT_ENCODING, HOST}, + StatusCode, + }, + web, + Error, + HttpRequest, + HttpResponse, +}; use anyhow::anyhow; use futures::stream::{Stream, StreamExt}; use lemmy_utils::{claims::Claims, rate_limit::RateLimit, LemmyError}; @@ -11,7 +21,7 @@ use std::time::Duration; pub fn config(cfg: &mut web::ServiceConfig, client: ClientWithMiddleware, rate_limit: &RateLimit) { cfg - .app_data(Data::new(client)) + .app_data(web::Data::new(client)) .service( web::resource("/pictrs/image") .wrap(rate_limit.image())