mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-25 22:10:20 +00:00
Upgrading deps, running clippy fix on nightly 1.55.0 (#1638)
* Upgrading deps, running clippy fix on nightly 1.55.0 * Running clippy --fix * Trying to fix transform * Trying to fix another transform * Upgrading http-signature-normalization-actix * Fix app_data * Fix pictrs uploading * Fix unwrap
This commit is contained in:
parent
f54209c451
commit
9840f5c1c1
22 changed files with 912 additions and 1231 deletions
1706
Cargo.lock
generated
1706
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
32
Cargo.toml
32
Cargo.toml
|
@ -40,25 +40,25 @@ lemmy_db_views_actor = { path = "./crates/db_views_actor" }
|
|||
lemmy_api_common = { path = "crates/api_common" }
|
||||
lemmy_websocket = { path = "./crates/websocket" }
|
||||
lemmy_routes = { path = "./crates/routes" }
|
||||
diesel = "1.4.5"
|
||||
diesel = "1.4.7"
|
||||
diesel_migrations = "1.4.0"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
actix = "0.10.0"
|
||||
actix-web = { version = "3.3.2", default-features = false, features = ["rustls"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
actix = "0.12.0"
|
||||
actix-web = { version = "4.0.0-beta.8", default-features = false, features = ["rustls"] }
|
||||
log = "0.4.14"
|
||||
env_logger = "0.8.2"
|
||||
strum = "0.20.0"
|
||||
url = { version = "2.2.1", features = ["serde"] }
|
||||
openssl = "0.10.32"
|
||||
http-signature-normalization-actix = { version = "0.4.1", default-features = false, features = ["sha-2"] }
|
||||
tokio = "0.3.6"
|
||||
anyhow = "1.0.38"
|
||||
reqwest = { version = "0.10.10", features = ["json"] }
|
||||
activitystreams = "0.7.0-alpha.10"
|
||||
actix-rt = { version = "1.1.1", default-features = false }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
clokwerk = "0.3.4"
|
||||
env_logger = "0.8.4"
|
||||
strum = "0.21.0"
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
openssl = "0.10.35"
|
||||
http-signature-normalization-actix = { version = "0.5.0-beta.6", default-features = false, features = ["sha-2"] }
|
||||
tokio = { version = "1.8.0", features = ["sync"] }
|
||||
anyhow = "1.0.41"
|
||||
reqwest = { version = "0.11.4", features = ["json"] }
|
||||
activitystreams = "0.7.0-alpha.11"
|
||||
actix-rt = { version = "2.2.0", default-features = false }
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
clokwerk = "0.3.5"
|
||||
|
||||
[dev-dependencies.cargo-husky]
|
||||
version = "1.5.0"
|
||||
|
|
|
@ -18,33 +18,33 @@ lemmy_db_views_moderator = { path = "../db_views_moderator" }
|
|||
lemmy_db_views_actor = { path = "../db_views_actor" }
|
||||
lemmy_api_common = { path = "../api_common" }
|
||||
lemmy_websocket = { path = "../websocket" }
|
||||
diesel = "1.4.5"
|
||||
bcrypt = "0.9.0"
|
||||
diesel = "1.4.7"
|
||||
bcrypt = "0.10.0"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
actix = "0.10.0"
|
||||
actix-web = { version = "3.3.2", default-features = false }
|
||||
actix-rt = { version = "1.1.1", default-features = false }
|
||||
awc = { version = "2.0.3", default-features = false }
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
actix = "0.12.0"
|
||||
actix-web = { version = "4.0.0-beta.8", default-features = false }
|
||||
actix-rt = { version = "2.2.0", default-features = false }
|
||||
awc = { version = "3.0.0-beta.7", default-features = false }
|
||||
log = "0.4.14"
|
||||
rand = "0.8.3"
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.1"
|
||||
rand = "0.8.4"
|
||||
strum = "0.21.0"
|
||||
strum_macros = "0.21.1"
|
||||
lazy_static = "1.4.0"
|
||||
url = { version = "2.2.1", features = ["serde"] }
|
||||
openssl = "0.10.32"
|
||||
http = "0.2.3"
|
||||
http-signature-normalization-actix = { version = "0.4.1", default-features = false, features = ["sha-2"] }
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
openssl = "0.10.35"
|
||||
http = "0.2.4"
|
||||
http-signature-normalization-actix = { version = "0.5.0-beta.6", default-features = false, features = ["sha-2"] }
|
||||
base64 = "0.13.0"
|
||||
tokio = "0.3.6"
|
||||
futures = "0.3.12"
|
||||
itertools = "0.10.0"
|
||||
tokio = "1.8.0"
|
||||
futures = "0.3.15"
|
||||
itertools = "0.10.1"
|
||||
uuid = { version = "0.8.2", features = ["serde", "v4"] }
|
||||
sha2 = "0.9.3"
|
||||
async-trait = "0.1.42"
|
||||
sha2 = "0.9.5"
|
||||
async-trait = "0.1.50"
|
||||
captcha = "0.0.8"
|
||||
anyhow = "1.0.38"
|
||||
anyhow = "1.0.41"
|
||||
thiserror = "1.0.26"
|
||||
background-jobs = "0.8.0"
|
||||
reqwest = { version = "0.10.10", features = ["json"] }
|
||||
background-jobs = "0.9.0"
|
||||
reqwest = { version = "0.11.4", features = ["json"] }
|
||||
|
|
|
@ -15,10 +15,10 @@ lemmy_db_views_moderator = { path = "../db_views_moderator" }
|
|||
lemmy_db_views_actor = { path = "../db_views_actor" }
|
||||
lemmy_db_schema = { path = "../db_schema" }
|
||||
lemmy_utils = { path = "../utils" }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
log = "0.4.14"
|
||||
diesel = "1.4.5"
|
||||
actix-web = "3.3.2"
|
||||
diesel = "1.4.7"
|
||||
actix-web = "4.0.0-beta.8"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
url = "2.2.1"
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
url = "2.2.2"
|
||||
|
|
|
@ -73,11 +73,11 @@ where
|
|||
let res = actix_web::web::block(move || {
|
||||
let conn = pool.get()?;
|
||||
let res = (f)(&conn);
|
||||
Ok(res) as Result<_, LemmyError>
|
||||
Ok(res) as Result<T, LemmyError>
|
||||
})
|
||||
.await?;
|
||||
|
||||
Ok(res)
|
||||
res
|
||||
}
|
||||
|
||||
pub async fn send_local_notifs(
|
||||
|
|
|
@ -13,32 +13,32 @@ lemmy_db_views_moderator = { path = "../db_views_moderator" }
|
|||
lemmy_db_views_actor = { path = "../db_views_actor" }
|
||||
lemmy_api_common = { path = "../api_common" }
|
||||
lemmy_websocket = { path = "../websocket" }
|
||||
diesel = "1.4.5"
|
||||
bcrypt = "0.9.0"
|
||||
diesel = "1.4.7"
|
||||
bcrypt = "0.10.0"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
actix = "0.10.0"
|
||||
actix-web = { version = "3.3.2", default-features = false }
|
||||
actix-rt = { version = "1.1.1", default-features = false }
|
||||
awc = { version = "2.0.3", default-features = false }
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
actix = "0.12.0"
|
||||
actix-web = { version = "4.0.0-beta.8", default-features = false }
|
||||
actix-rt = { version = "2.2.0", default-features = false }
|
||||
awc = { version = "3.0.0-beta.7", default-features = false }
|
||||
log = "0.4.14"
|
||||
rand = "0.8.3"
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.1"
|
||||
rand = "0.8.4"
|
||||
strum = "0.21.0"
|
||||
strum_macros = "0.21.1"
|
||||
lazy_static = "1.4.0"
|
||||
url = { version = "2.2.1", features = ["serde"] }
|
||||
openssl = "0.10.32"
|
||||
http = "0.2.3"
|
||||
http-signature-normalization-actix = { version = "0.4.1", default-features = false, features = ["sha-2"] }
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
openssl = "0.10.35"
|
||||
http = "0.2.4"
|
||||
http-signature-normalization-actix = { version = "0.5.0-beta.6", default-features = false, features = ["sha-2"] }
|
||||
base64 = "0.13.0"
|
||||
tokio = "0.3.6"
|
||||
futures = "0.3.12"
|
||||
itertools = "0.10.0"
|
||||
tokio = "1.8.0"
|
||||
futures = "0.3.15"
|
||||
itertools = "0.10.1"
|
||||
uuid = { version = "0.8.2", features = ["serde", "v4"] }
|
||||
sha2 = "0.9.3"
|
||||
async-trait = "0.1.42"
|
||||
anyhow = "1.0.38"
|
||||
sha2 = "0.9.5"
|
||||
async-trait = "0.1.50"
|
||||
anyhow = "1.0.41"
|
||||
thiserror = "1.0.26"
|
||||
background-jobs = "0.8.0"
|
||||
reqwest = { version = "0.10.10", features = ["json"] }
|
||||
background-jobs = "0.9.0"
|
||||
reqwest = { version = "0.11.4", features = ["json"] }
|
||||
|
|
|
@ -16,37 +16,37 @@ lemmy_db_views = { path = "../db_views" }
|
|||
lemmy_db_views_actor = { path = "../db_views_actor" }
|
||||
lemmy_api_common = { path = "../api_common" }
|
||||
lemmy_websocket = { path = "../websocket" }
|
||||
diesel = "1.4.5"
|
||||
diesel = "1.4.7"
|
||||
activitystreams = "0.7.0-alpha.11"
|
||||
activitystreams-ext = "0.1.0-alpha.2"
|
||||
bcrypt = "0.9.0"
|
||||
bcrypt = "0.10.0"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
actix = "0.10.0"
|
||||
actix-web = { version = "3.3.2", default-features = false }
|
||||
actix-rt = { version = "1.1.1", default-features = false }
|
||||
awc = { version = "2.0.3", default-features = false }
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
actix = "0.12.0"
|
||||
actix-web = { version = "4.0.0-beta.8", default-features = false }
|
||||
actix-rt = { version = "2.2.0", default-features = false }
|
||||
awc = { version = "3.0.0-beta.7", default-features = false }
|
||||
log = "0.4.14"
|
||||
rand = "0.8.3"
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.1"
|
||||
rand = "0.8.4"
|
||||
strum = "0.21.0"
|
||||
strum_macros = "0.21.1"
|
||||
lazy_static = "1.4.0"
|
||||
url = { version = "2.2.1", features = ["serde"] }
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
percent-encoding = "2.1.0"
|
||||
openssl = "0.10.32"
|
||||
http = "0.2.3"
|
||||
http-signature-normalization-actix = { version = "0.4.1", default-features = false, features = ["sha-2"] }
|
||||
http-signature-normalization-reqwest = { version = "0.1.3", default-features = false, features = ["sha-2"] }
|
||||
openssl = "0.10.35"
|
||||
http = "0.2.4"
|
||||
http-signature-normalization-actix = { version = "0.5.0-beta.6", default-features = false, features = ["sha-2"] }
|
||||
http-signature-normalization-reqwest = { version = "0.2.0", default-features = false, features = ["sha-2"] }
|
||||
base64 = "0.13.0"
|
||||
tokio = "0.3.6"
|
||||
futures = "0.3.12"
|
||||
itertools = "0.10.0"
|
||||
tokio = "1.8.0"
|
||||
futures = "0.3.15"
|
||||
itertools = "0.10.1"
|
||||
uuid = { version = "0.8.2", features = ["serde", "v4"] }
|
||||
sha2 = "0.9.3"
|
||||
async-trait = "0.1.42"
|
||||
anyhow = "1.0.38"
|
||||
sha2 = "0.9.5"
|
||||
async-trait = "0.1.50"
|
||||
anyhow = "1.0.41"
|
||||
thiserror = "1.0.26"
|
||||
background-jobs = "0.8.0"
|
||||
reqwest = { version = "0.10.10", features = ["json"] }
|
||||
backtrace = "0.3.56"
|
||||
background-jobs = "0.9.0"
|
||||
reqwest = { version = "0.11.4", features = ["json"] }
|
||||
backtrace = "0.3.60"
|
||||
|
|
|
@ -12,34 +12,34 @@ lemmy_db_views = { path = "../db_views" }
|
|||
lemmy_db_views_actor = { path = "../db_views_actor" }
|
||||
lemmy_api_common = { path = "../api_common" }
|
||||
lemmy_websocket = { path = "../websocket" }
|
||||
diesel = "1.4.5"
|
||||
diesel = "1.4.7"
|
||||
activitystreams = "0.7.0-alpha.11"
|
||||
activitystreams-ext = "0.1.0-alpha.2"
|
||||
bcrypt = "0.9.0"
|
||||
bcrypt = "0.10.0"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
actix = "0.10.0"
|
||||
actix-web = { version = "3.3.2", default-features = false }
|
||||
actix-rt = { version = "1.1.1", default-features = false }
|
||||
awc = { version = "2.0.3", default-features = false }
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
actix = "0.12.0"
|
||||
actix-web = { version = "4.0.0-beta.8", default-features = false }
|
||||
actix-rt = { version = "2.2.0", default-features = false }
|
||||
awc = { version = "3.0.0-beta.7", default-features = false }
|
||||
log = "0.4.14"
|
||||
rand = "0.8.3"
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.1"
|
||||
url = { version = "2.2.1", features = ["serde"] }
|
||||
rand = "0.8.4"
|
||||
strum = "0.21.0"
|
||||
strum_macros = "0.21.1"
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
percent-encoding = "2.1.0"
|
||||
openssl = "0.10.32"
|
||||
http = "0.2.3"
|
||||
http-signature-normalization-actix = { version = "0.4.1", default-features = false, features = ["sha-2"] }
|
||||
http-signature-normalization-reqwest = { version = "0.1.3", default-features = false, features = ["sha-2"] }
|
||||
openssl = "0.10.35"
|
||||
http = "0.2.4"
|
||||
http-signature-normalization-actix = { version = "0.5.0-beta.6", default-features = false, features = ["sha-2"] }
|
||||
http-signature-normalization-reqwest = { version = "0.2.0", default-features = false, features = ["sha-2"] }
|
||||
base64 = "0.13.0"
|
||||
tokio = "0.3.6"
|
||||
futures = "0.3.12"
|
||||
itertools = "0.10.0"
|
||||
sha2 = "0.9.3"
|
||||
async-trait = "0.1.42"
|
||||
anyhow = "1.0.38"
|
||||
thiserror = "1.0.23"
|
||||
backtrace = "0.3.56"
|
||||
tokio = "1.8.0"
|
||||
futures = "0.3.15"
|
||||
itertools = "0.10.1"
|
||||
sha2 = "0.9.5"
|
||||
async-trait = "0.1.50"
|
||||
anyhow = "1.0.41"
|
||||
thiserror = "1.0.26"
|
||||
backtrace = "0.3.60"
|
||||
|
||||
|
|
|
@ -11,19 +11,19 @@ doctest = false
|
|||
[dependencies]
|
||||
lemmy_utils = { path = "../utils" }
|
||||
lemmy_db_schema = { path = "../db_schema" }
|
||||
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
diesel = { version = "1.4.7", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
diesel_migrations = "1.4.0"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.1"
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
strum = "0.21.0"
|
||||
strum_macros = "0.21.1"
|
||||
log = "0.4.14"
|
||||
sha2 = "0.9.3"
|
||||
url = { version = "2.2.1", features = ["serde"] }
|
||||
sha2 = "0.9.5"
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
lazy_static = "1.4.0"
|
||||
regex = "1.4.3"
|
||||
bcrypt = "0.9.0"
|
||||
regex = "1.5.4"
|
||||
bcrypt = "0.10.0"
|
||||
|
||||
[dev-dependencies]
|
||||
serial_test = "0.5.1"
|
|
@ -7,10 +7,10 @@ edition = "2018"
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
diesel = { version = "1.4.7", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
log = "0.4.14"
|
||||
url = { version = "2.2.1", features = ["serde"] }
|
||||
diesel-derive-newtype = "0.1"
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
diesel-derive-newtype = "0.1.2"
|
||||
|
|
|
@ -9,10 +9,10 @@ doctest = false
|
|||
[dependencies]
|
||||
lemmy_db_queries = { path = "../db_queries" }
|
||||
lemmy_db_schema = { path = "../db_schema" }
|
||||
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
diesel = { version = "1.4.7", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
log = "0.4.14"
|
||||
url = "2.2.1"
|
||||
url = "2.2.2"
|
||||
|
||||
[dev-dependencies]
|
||||
serial_test = "0.5.1"
|
|
@ -9,5 +9,5 @@ doctest = false
|
|||
[dependencies]
|
||||
lemmy_db_queries = { path = "../db_queries" }
|
||||
lemmy_db_schema = { path = "../db_schema" }
|
||||
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
diesel = { version = "1.4.7", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
|
|
|
@ -9,5 +9,5 @@ doctest = false
|
|||
[dependencies]
|
||||
lemmy_db_queries = { path = "../db_queries" }
|
||||
lemmy_db_schema = { path = "../db_schema" }
|
||||
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
diesel = { version = "1.4.7", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
|
|
|
@ -14,17 +14,17 @@ lemmy_db_views = { path = "../db_views" }
|
|||
lemmy_db_views_actor = { path = "../db_views_actor" }
|
||||
lemmy_db_schema = { path = "../db_schema" }
|
||||
lemmy_api_common = { path = "../api_common" }
|
||||
diesel = "1.4.5"
|
||||
actix = "0.10.0"
|
||||
actix-web = { version = "3.3.2", default-features = false, features = ["rustls"] }
|
||||
actix-web-actors = { version = "3.0.0", default-features = false }
|
||||
sha2 = "0.9.3"
|
||||
diesel = "1.4.7"
|
||||
actix = "0.12.0"
|
||||
actix-web = { version = "4.0.0-beta.8", default-features = false, features = ["rustls"] }
|
||||
actix-web-actors = { version = "4.0.0-beta.6", default-features = false }
|
||||
sha2 = "0.9.5"
|
||||
log = "0.4.14"
|
||||
anyhow = "1.0.38"
|
||||
anyhow = "1.0.41"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
rss = "1.10.0"
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
awc = { version = "2.0.3", default-features = false }
|
||||
url = { version = "2.2.1", features = ["serde"] }
|
||||
strum = "0.20.0"
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
awc = { version = "3.0.0-beta.7", default-features = false }
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
strum = "0.21.0"
|
||||
lazy_static = "1.4.0"
|
||||
|
|
|
@ -124,12 +124,15 @@ async fn get_feed_data(
|
|||
}
|
||||
|
||||
async fn get_feed(
|
||||
web::Path((req_type, param)): web::Path<(String, String)>,
|
||||
req: HttpRequest,
|
||||
info: web::Query<Params>,
|
||||
context: web::Data<LemmyContext>,
|
||||
) -> Result<HttpResponse, Error> {
|
||||
let sort_type = get_sort_type(info).map_err(ErrorBadRequest)?;
|
||||
|
||||
let req_type: String = req.match_info().get("type").unwrap_or("none").parse()?;
|
||||
let param: String = req.match_info().get("name").unwrap_or("none").parse()?;
|
||||
|
||||
let request_type = match req_type.as_str() {
|
||||
"u" => RequestType::User,
|
||||
"c" => RequestType::Community,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use actix::clock::Duration;
|
||||
use actix_web::{body::BodyStream, http::StatusCode, *};
|
||||
use actix_web::{body::BodyStream, http::StatusCode, web::Data, *};
|
||||
use awc::Client;
|
||||
use lemmy_utils::{claims::Claims, rate_limit::RateLimit, settings::structs::Settings};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
|
||||
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
||||
let client = Client::builder()
|
||||
|
@ -11,7 +11,7 @@ pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
|||
.finish();
|
||||
|
||||
cfg
|
||||
.data(client)
|
||||
.app_data(Data::new(client))
|
||||
.service(
|
||||
web::resource("/pictrs/image")
|
||||
.wrap(rate_limit.image())
|
||||
|
@ -60,12 +60,15 @@ async fn upload(
|
|||
);
|
||||
|
||||
if let Some(addr) = req.head().peer_addr {
|
||||
client_req = client_req.header("X-Forwarded-For", addr.to_string())
|
||||
client_req = client_req.insert_header(("X-Forwarded-For", addr.to_string()))
|
||||
};
|
||||
|
||||
let mut res = client_req.send_stream(body).await?;
|
||||
let mut res = client_req
|
||||
.send_stream(body)
|
||||
.await
|
||||
.map_err(error::ErrorBadRequest)?;
|
||||
|
||||
let images = res.json::<Images>().await?;
|
||||
let images = res.json::<Images>().await.map_err(error::ErrorBadRequest)?;
|
||||
|
||||
Ok(HttpResponse::build(res.status()).json(images))
|
||||
}
|
||||
|
@ -109,10 +112,14 @@ async fn image(
|
|||
let mut client_req = client.request_from(url, req.head());
|
||||
|
||||
if let Some(addr) = req.head().peer_addr {
|
||||
client_req = client_req.header("X-Forwarded-For", addr.to_string())
|
||||
client_req = client_req.insert_header(("X-Forwarded-For", addr.to_string()))
|
||||
};
|
||||
|
||||
let res = client_req.no_decompress().send().await?;
|
||||
let res = client_req
|
||||
.no_decompress()
|
||||
.send()
|
||||
.await
|
||||
.map_err(error::ErrorBadRequest)?;
|
||||
|
||||
if res.status() == StatusCode::NOT_FOUND {
|
||||
return Ok(HttpResponse::NotFound().finish());
|
||||
|
@ -121,7 +128,7 @@ async fn image(
|
|||
let mut client_res = HttpResponse::build(res.status());
|
||||
|
||||
for (name, value) in res.headers().iter().filter(|(h, _)| *h != "connection") {
|
||||
client_res.header(name.clone(), value.clone());
|
||||
client_res.insert_header((name.clone(), value.clone()));
|
||||
}
|
||||
|
||||
Ok(client_res.body(BodyStream::new(res)))
|
||||
|
@ -144,10 +151,14 @@ async fn delete(
|
|||
let mut client_req = client.request_from(url, req.head());
|
||||
|
||||
if let Some(addr) = req.head().peer_addr {
|
||||
client_req = client_req.header("X-Forwarded-For", addr.to_string())
|
||||
client_req = client_req.insert_header(("X-Forwarded-For", addr.to_string()))
|
||||
};
|
||||
|
||||
let res = client_req.no_decompress().send().await?;
|
||||
let res = client_req
|
||||
.no_decompress()
|
||||
.send()
|
||||
.await
|
||||
.map_err(error::ErrorBadRequest)?;
|
||||
|
||||
Ok(HttpResponse::build(res.status()).body(BodyStream::new(res)))
|
||||
}
|
||||
|
|
|
@ -9,31 +9,31 @@ path = "src/lib.rs"
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
regex = "1.4.3"
|
||||
regex = "1.5.4"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
lettre = "0.10.0-alpha.5"
|
||||
lettre = "0.10.0-rc.3"
|
||||
log = "0.4.14"
|
||||
itertools = "0.10.0"
|
||||
rand = "0.8.3"
|
||||
itertools = "0.10.1"
|
||||
rand = "0.8.4"
|
||||
percent-encoding = "2.1.0"
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
thiserror = "1.0.26"
|
||||
comrak = { version = "0.9.0", default-features = false }
|
||||
comrak = { version = "0.10.1", default-features = false }
|
||||
lazy_static = "1.4.0"
|
||||
openssl = "0.10.32"
|
||||
url = { version = "2.2.1", features = ["serde"] }
|
||||
actix-web = { version = "3.3.2", default-features = false, features = ["rustls"] }
|
||||
actix-rt = { version = "1.1.1", default-features = false }
|
||||
anyhow = "1.0.38"
|
||||
reqwest = { version = "0.10.10", features = ["json"] }
|
||||
tokio = { version = "0.3.6", features = ["sync"] }
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.1"
|
||||
futures = "0.3.12"
|
||||
diesel = "1.4.5"
|
||||
http = "0.2.3"
|
||||
openssl = "0.10.35"
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
actix-web = { version = "4.0.0-beta.8", default-features = false, features = ["rustls"] }
|
||||
actix-rt = { version = "2.2.0", default-features = false }
|
||||
anyhow = "1.0.41"
|
||||
reqwest = { version = "0.11.4", features = ["json"] }
|
||||
tokio = { version = "1.8.0", features = ["sync"] }
|
||||
strum = "0.21.0"
|
||||
strum_macros = "0.21.1"
|
||||
futures = "0.3.15"
|
||||
diesel = "1.4.7"
|
||||
http = "0.2.4"
|
||||
jsonwebtoken = "7.2.0"
|
||||
deser-hjson = "0.1.12"
|
||||
deser-hjson = "1.0.1"
|
||||
merge = "0.1.0"
|
||||
envy = "0.4.2"
|
||||
|
|
|
@ -49,21 +49,13 @@ pub fn send_email(
|
|||
MultiPart::alternative()
|
||||
.singlepart(
|
||||
SinglePart::builder()
|
||||
.header(header::ContentType(
|
||||
"text/plain; charset=utf8"
|
||||
.parse()
|
||||
.expect("email could not parse header"),
|
||||
))
|
||||
.header(header::ContentType::TEXT_PLAIN)
|
||||
.body(html.to_string()),
|
||||
)
|
||||
.multipart(
|
||||
MultiPart::related().singlepart(
|
||||
SinglePart::builder()
|
||||
.header(header::ContentType(
|
||||
"text/html; charset=utf8"
|
||||
.parse()
|
||||
.expect("email could not parse header"),
|
||||
))
|
||||
.header(header::ContentType::TEXT_HTML)
|
||||
.body(html.to_string()),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -154,12 +154,11 @@ impl RateLimited {
|
|||
}
|
||||
}
|
||||
|
||||
impl<S> Transform<S> for RateLimited
|
||||
impl<S> Transform<S, ServiceRequest> for RateLimited
|
||||
where
|
||||
S: Service<Request = ServiceRequest, Response = ServiceResponse, Error = actix_web::Error>,
|
||||
S: Service<ServiceRequest, Response = ServiceResponse, Error = actix_web::Error>,
|
||||
S::Future: 'static,
|
||||
{
|
||||
type Request = S::Request;
|
||||
type Response = S::Response;
|
||||
type Error = actix_web::Error;
|
||||
type InitError = ();
|
||||
|
@ -176,21 +175,20 @@ where
|
|||
|
||||
type FutResult<T, E> = dyn Future<Output = Result<T, E>>;
|
||||
|
||||
impl<S> Service for RateLimitedMiddleware<S>
|
||||
impl<S> Service<ServiceRequest> for RateLimitedMiddleware<S>
|
||||
where
|
||||
S: Service<Request = ServiceRequest, Response = ServiceResponse, Error = actix_web::Error>,
|
||||
S: Service<ServiceRequest, Response = ServiceResponse, Error = actix_web::Error>,
|
||||
S::Future: 'static,
|
||||
{
|
||||
type Request = S::Request;
|
||||
type Response = S::Response;
|
||||
type Error = actix_web::Error;
|
||||
type Future = Pin<Box<FutResult<Self::Response, Self::Error>>>;
|
||||
|
||||
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
self.service.poll_ready(cx)
|
||||
}
|
||||
|
||||
fn call(&mut self, req: S::Request) -> Self::Future {
|
||||
fn call(&self, req: ServiceRequest) -> Self::Future {
|
||||
let ip_addr = get_ip(&req.connection_info());
|
||||
|
||||
let fut = self
|
||||
|
|
|
@ -13,18 +13,18 @@ lemmy_utils = { path = "../utils" }
|
|||
lemmy_api_common = { path = "../api_common" }
|
||||
lemmy_db_queries = { path = "../db_queries" }
|
||||
lemmy_db_schema = { path = "../db_schema" }
|
||||
reqwest = { version = "0.10.10", features = ["json"] }
|
||||
reqwest = { version = "0.11.4", features = ["json"] }
|
||||
log = "0.4.14"
|
||||
rand = "0.8.3"
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
serde_json = { version = "1.0.61", features = ["preserve_order"] }
|
||||
actix = "0.10.0"
|
||||
anyhow = "1.0.38"
|
||||
diesel = "1.4.5"
|
||||
background-jobs = "0.8.0"
|
||||
tokio = "0.3.6"
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.1"
|
||||
rand = "0.8.4"
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||
actix = "0.12.0"
|
||||
anyhow = "1.0.41"
|
||||
diesel = "1.4.7"
|
||||
background-jobs = "0.9.0"
|
||||
tokio = "1.8.0"
|
||||
strum = "0.21.0"
|
||||
strum_macros = "0.21.1"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
actix-web = { version = "3.3.2", default-features = false, features = ["rustls"] }
|
||||
actix-web-actors = { version = "3.0.0", default-features = false }
|
||||
actix-web = { version = "4.0.0-beta.8", default-features = false, features = ["rustls"] }
|
||||
actix-web-actors = { version = "4.0.0-beta.6", default-features = false }
|
||||
|
|
|
@ -29,6 +29,7 @@ use serde::Serialize;
|
|||
use serde_json::Value;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
future::Future,
|
||||
str::FromStr,
|
||||
};
|
||||
use tokio::macros::support::Pin;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
extern crate diesel_migrations;
|
||||
|
||||
use actix::prelude::*;
|
||||
use actix_web::*;
|
||||
use actix_web::{web::Data, *};
|
||||
use diesel::{
|
||||
r2d2::{ConnectionManager, Pool},
|
||||
PgConnection,
|
||||
|
@ -88,7 +88,7 @@ async fn main() -> Result<(), LemmyError> {
|
|||
let rate_limiter = rate_limiter.clone();
|
||||
App::new()
|
||||
.wrap(middleware::Logger::default())
|
||||
.data(context)
|
||||
.app_data(Data::new(context))
|
||||
// The routes
|
||||
.configure(|cfg| api_routes::config(cfg, &rate_limiter))
|
||||
.configure(lemmy_apub_receive::routes::config)
|
||||
|
|
Loading…
Reference in a new issue