Merge branch 'main' into move_views_to_diesel

pull/1329/head
Dessalines 2020-12-05 08:10:25 -06:00
commit 2400a078d7
10 changed files with 669 additions and 628 deletions

963
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -25,32 +25,32 @@ lemmy_db = { path = "./lemmy_db" }
lemmy_structs = { path = "./lemmy_structs" } lemmy_structs = { path = "./lemmy_structs" }
lemmy_rate_limit = { path = "./lemmy_rate_limit" } lemmy_rate_limit = { path = "./lemmy_rate_limit" }
lemmy_websocket = { path = "./lemmy_websocket" } lemmy_websocket = { path = "./lemmy_websocket" }
diesel = "1.4" diesel = "1.4.5"
diesel_migrations = "1.4" diesel_migrations = "1.4.0"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4.19", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0.117", features = ["derive"] }
actix = "0.10" actix = "0.10.0"
actix-web = { version = "3.1", default-features = false, features = ["rustls"] } actix-web = { version = "3.3.2", default-features = false, features = ["rustls"] }
actix-files = { version = "0.4", default-features = false } actix-files = { version = "0.4.1", default-features = false }
actix-web-actors = { version = "3.0", default-features = false } actix-web-actors = { version = "3.0.0", default-features = false }
awc = { version = "2.0", default-features = false } awc = { version = "2.0.3", default-features = false }
log = "0.4" log = "0.4.11"
env_logger = "0.8" env_logger = "0.8.2"
strum = "0.19" strum = "0.20.0"
lazy_static = "1.3" lazy_static = "1.4.0"
rss = "1.9" rss = "1.9.0"
url = { version = "2.1", features = ["serde"] } url = { version = "2.2.0", features = ["serde"] }
openssl = "0.10" openssl = "0.10.30"
http-signature-normalization-actix = { version = "0.4", default-features = false, features = ["sha-2"] } http-signature-normalization-actix = { version = "0.4.1", default-features = false, features = ["sha-2"] }
tokio = "0.3" tokio = "0.3.5"
sha2 = "0.9" sha2 = "0.9.2"
anyhow = "1.0" anyhow = "1.0.34"
reqwest = { version = "0.10", features = ["json"] } reqwest = { version = "0.10.9", features = ["json"] }
activitystreams = "0.7.0-alpha.4" activitystreams = "0.7.0-alpha.8"
actix-rt = { version = "1.1", default-features = false } actix-rt = { version = "1.1.1", default-features = false }
serde_json = { version = "1.0", features = ["preserve_order"]} serde_json = { version = "1.0.60", features = ["preserve_order"] }
[dev-dependencies.cargo-husky] [dev-dependencies.cargo-husky]
version = "1" version = "1.5.0"
default-features = false # Disable features which are enabled by default default-features = false # Disable features which are enabled by default
features = ["precommit-hook", "run-cargo-fmt", "run-cargo-clippy"] features = ["precommit-hook", "run-cargo-fmt", "run-cargo-clippy"]

View File

@ -15,34 +15,34 @@ lemmy_db = { path = "../lemmy_db" }
lemmy_structs = { path = "../lemmy_structs" } lemmy_structs = { path = "../lemmy_structs" }
lemmy_rate_limit = { path = "../lemmy_rate_limit" } lemmy_rate_limit = { path = "../lemmy_rate_limit" }
lemmy_websocket = { path = "../lemmy_websocket" } lemmy_websocket = { path = "../lemmy_websocket" }
diesel = "1.4" diesel = "1.4.5"
bcrypt = "0.8" bcrypt = "0.9.0"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4.19", features = ["serde"] }
serde_json = { version = "1.0", features = ["preserve_order"]} serde_json = { version = "1.0.60", features = ["preserve_order"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0.117", features = ["derive"] }
actix = "0.10" actix = "0.10.0"
actix-web = { version = "3.0", default-features = false } actix-web = { version = "3.3.2", default-features = false }
actix-rt = { version = "1.1", default-features = false } actix-rt = { version = "1.1.1", default-features = false }
awc = { version = "2.0", default-features = false } awc = { version = "2.0.3", default-features = false }
log = "0.4" log = "0.4.11"
rand = "0.7" rand = "0.7.3"
strum = "0.19" strum = "0.20.0"
strum_macros = "0.19" strum_macros = "0.20.1"
jsonwebtoken = "7.0" jsonwebtoken = "7.2.0"
lazy_static = "1.3" lazy_static = "1.4.0"
url = { version = "2.1", features = ["serde"] } url = { version = "2.2.0", features = ["serde"] }
openssl = "0.10" openssl = "0.10.30"
http = "0.2" http = "0.2.1"
http-signature-normalization-actix = { version = "0.4", default-features = false, features = ["sha-2"] } http-signature-normalization-actix = { version = "0.4.1", default-features = false, features = ["sha-2"] }
base64 = "0.13" base64 = "0.13.0"
tokio = "0.3" tokio = "0.3.5"
futures = "0.3" futures = "0.3.8"
itertools = "0.9" itertools = "0.9.0"
uuid = { version = "0.8", features = ["serde", "v4"] } uuid = { version = "0.8.1", features = ["serde", "v4"] }
sha2 = "0.9" sha2 = "0.9.2"
async-trait = "0.1" async-trait = "0.1.42"
captcha = "0.0" captcha = "0.0.8"
anyhow = "1.0" anyhow = "1.0.34"
thiserror = "1.0" thiserror = "1.0.22"
background-jobs = " 0.8" background-jobs = "0.8.0"
reqwest = { version = "0.10", features = ["json"] } reqwest = { version = "0.10.9", features = ["json"] }

View File

@ -13,37 +13,37 @@ lemmy_utils = { path = "../lemmy_utils" }
lemmy_db = { path = "../lemmy_db" } lemmy_db = { path = "../lemmy_db" }
lemmy_structs = { path = "../lemmy_structs" } lemmy_structs = { path = "../lemmy_structs" }
lemmy_websocket = { path = "../lemmy_websocket" } lemmy_websocket = { path = "../lemmy_websocket" }
diesel = "1.4" diesel = "1.4.5"
activitystreams = "0.7.0-alpha.7" activitystreams = "0.7.0-alpha.8"
activitystreams-ext = "0.1.0-alpha.2" activitystreams-ext = "0.1.0-alpha.2"
bcrypt = "0.8" bcrypt = "0.9.0"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4.19", features = ["serde"] }
serde_json = { version = "1.0", features = ["preserve_order"]} serde_json = { version = "1.0.60", features = ["preserve_order"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0.117", features = ["derive"] }
actix = "0.10" actix = "0.10.0"
actix-web = { version = "3.0", default-features = false } actix-web = { version = "3.3.2", default-features = false }
actix-rt = { version = "1.1", default-features = false } actix-rt = { version = "1.1.1", default-features = false }
awc = { version = "2.0", default-features = false } awc = { version = "2.0.3", default-features = false }
log = "0.4" log = "0.4.11"
rand = "0.7" rand = "0.7.3"
strum = "0.19" strum = "0.20.0"
strum_macros = "0.19" strum_macros = "0.20.1"
lazy_static = "1.3" lazy_static = "1.4.0"
url = { version = "2.1", features = ["serde"] } url = { version = "2.2.0", features = ["serde"] }
percent-encoding = "2.1" percent-encoding = "2.1.0"
openssl = "0.10" openssl = "0.10.30"
http = "0.2" http = "0.2.1"
http-signature-normalization-actix = { version = "0.4", default-features = false, features = ["sha-2"] } 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"] } http-signature-normalization-reqwest = { version = "0.1.3", default-features = false, features = ["sha-2"] }
base64 = "0.13" base64 = "0.13.0"
tokio = "0.3" tokio = "0.3.5"
futures = "0.3" futures = "0.3.8"
itertools = "0.9" itertools = "0.9.0"
uuid = { version = "0.8", features = ["serde", "v4"] } uuid = { version = "0.8.1", features = ["serde", "v4"] }
sha2 = "0.9" sha2 = "0.9.2"
async-trait = "0.1" async-trait = "0.1.42"
anyhow = "1.0" anyhow = "1.0.34"
thiserror = "1.0" thiserror = "1.0.22"
background-jobs = " 0.8" background-jobs = "0.8.0"
reqwest = { version = "0.10", features = ["json"] } reqwest = { version = "0.10.9", features = ["json"] }
backtrace = "0.3" backtrace = "0.3.55"

View File

@ -9,15 +9,15 @@ path = "src/lib.rs"
[dependencies] [dependencies]
lemmy_utils = { path = "../lemmy_utils" } lemmy_utils = { path = "../lemmy_utils" }
diesel = { version = "1.4", features = ["postgres","chrono","r2d2","64-column-tables","serde_json"] } diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","64-column-tables","serde_json"] }
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4.19", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0.117", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"]} serde_json = { version = "1.0.60", features = ["preserve_order"] }
strum = "0.19" strum = "0.20.0"
strum_macros = "0.19" strum_macros = "0.20.1"
log = "0.4" log = "0.4.11"
sha2 = "0.9" sha2 = "0.9.2"
bcrypt = "0.8" bcrypt = "0.9.0"
url = { version = "2.1", features = ["serde"] } url = { version = "2.2.0", features = ["serde"] }
lazy_static = "1.3" lazy_static = "1.4.0"
regex = "1.3" regex = "1.4.2"

View File

@ -10,9 +10,9 @@ path = "src/lib.rs"
[dependencies] [dependencies]
lemmy_utils = { path = "../lemmy_utils" } lemmy_utils = { path = "../lemmy_utils" }
tokio = { version = "0.3", features = ["sync"] } tokio = { version = "0.3.5", features = ["sync"] }
strum = "0.19" strum = "0.20.0"
strum_macros = "0.19" strum_macros = "0.20.1"
futures = "0.3.5" futures = "0.3.8"
actix-web = { version = "3.0", default-features = false, features = ["rustls"] } actix-web = { version = "3.3.2", default-features = false, features = ["rustls"] }
log = "0.4" log = "0.4.11"

View File

@ -11,9 +11,9 @@ path = "src/lib.rs"
[dependencies] [dependencies]
lemmy_db = { path = "../lemmy_db" } lemmy_db = { path = "../lemmy_db" }
lemmy_utils = { path = "../lemmy_utils" } lemmy_utils = { path = "../lemmy_utils" }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0.117", features = ["derive"] }
log = "0.4" log = "0.4.11"
diesel = "1.4" diesel = "1.4.5"
actix-web = { version = "3.0" } actix-web = "3.3.2"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4.19", features = ["serde"] }
serde_json = { version = "1.0", features = ["preserve_order"]} serde_json = { version = "1.0.60", features = ["preserve_order"] }

View File

@ -8,22 +8,22 @@ name = "lemmy_utils"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
regex = "1.3" regex = "1.4.2"
config = { version = "0.10", default-features = false, features = ["hjson"] } config = { version = "0.10.1", default-features = false, features = ["hjson"] }
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4.19", features = ["serde"] }
lettre = "0.10.0-alpha.3" lettre = "0.10.0-alpha.4"
log = "0.4" log = "0.4.11"
itertools = "0.9" itertools = "0.9.0"
rand = "0.7" rand = "0.7.3"
percent-encoding = "2.1" percent-encoding = "2.1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0.117", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"]} serde_json = { version = "1.0.60", features = ["preserve_order"] }
thiserror = "1.0" thiserror = "1.0.22"
comrak = { version = "0.8", default-features = false } comrak = { version = "0.9.0", default-features = false }
lazy_static = "1.3" lazy_static = "1.4.0"
openssl = "0.10" openssl = "0.10.30"
url = { version = "2.1", features = ["serde"] } url = { version = "2.2.0", features = ["serde"] }
actix-web = { version = "3.0", default-features = false, features = ["rustls"] } actix-web = { version = "3.3.2", default-features = false, features = ["rustls"] }
actix-rt = { version = "1.1", default-features = false } actix-rt = { version = "1.1.1", default-features = false }
anyhow = "1.0" anyhow = "1.0.34"
reqwest = { version = "0.10", features = ["json"] } reqwest = { version = "0.10.9", features = ["json"] }

View File

@ -13,16 +13,16 @@ lemmy_utils = { path = "../lemmy_utils" }
lemmy_structs = { path = "../lemmy_structs" } lemmy_structs = { path = "../lemmy_structs" }
lemmy_db = { path = "../lemmy_db" } lemmy_db = { path = "../lemmy_db" }
lemmy_rate_limit = { path = "../lemmy_rate_limit" } lemmy_rate_limit = { path = "../lemmy_rate_limit" }
reqwest = { version = "0.10", features = ["json"] } reqwest = { version = "0.10.9", features = ["json"] }
log = "0.4" log = "0.4.11"
rand = "0.7" rand = "0.7.3"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0.117", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"]} serde_json = { version = "1.0.60", features = ["preserve_order"] }
actix = "0.10" actix = "0.10.0"
anyhow = "1.0" anyhow = "1.0.34"
diesel = "1.4" diesel = "1.4.5"
background-jobs = " 0.8" background-jobs = "0.8.0"
tokio = "0.3" tokio = "0.3.5"
strum = "0.19" strum = "0.20.0"
strum_macros = "0.19" strum_macros = "0.20.1"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4.19", features = ["serde"] }

View File

@ -56,13 +56,14 @@ async fn upload(
return Ok(HttpResponse::Unauthorized().finish()); return Ok(HttpResponse::Unauthorized().finish());
}; };
let mut res = client let mut client_req =
.request_from(format!("{}/image", Settings::get().pictrs_url), req.head()) client.request_from(format!("{}/image", Settings::get().pictrs_url), req.head());
.if_some(req.head().peer_addr, |addr, req| {
req.header("X-Forwarded-For", addr.to_string()) if let Some(addr) = req.head().peer_addr {
}) client_req = client_req.header("X-Forwarded-For", addr.to_string())
.send_stream(body) };
.await?;
let mut res = client_req.send_stream(body).await?;
let images = res.json::<Images>().await?; let images = res.json::<Images>().await?;
@ -105,14 +106,13 @@ async fn image(
req: HttpRequest, req: HttpRequest,
client: web::Data<Client>, client: web::Data<Client>,
) -> Result<HttpResponse, Error> { ) -> Result<HttpResponse, Error> {
let res = client let mut client_req = client.request_from(url, req.head());
.request_from(url, req.head())
.if_some(req.head().peer_addr, |addr, req| { if let Some(addr) = req.head().peer_addr {
req.header("X-Forwarded-For", addr.to_string()) client_req = client_req.header("X-Forwarded-For", addr.to_string())
}) };
.no_decompress()
.send() let res = client_req.no_decompress().send().await?;
.await?;
if res.status() == StatusCode::NOT_FOUND { if res.status() == StatusCode::NOT_FOUND {
return Ok(HttpResponse::NotFound().finish()); return Ok(HttpResponse::NotFound().finish());
@ -140,14 +140,14 @@ async fn delete(
&token, &token,
&file &file
); );
let res = client
.request_from(url, req.head()) let mut client_req = client.request_from(url, req.head());
.if_some(req.head().peer_addr, |addr, req| {
req.header("X-Forwarded-For", addr.to_string()) if let Some(addr) = req.head().peer_addr {
}) client_req = client_req.header("X-Forwarded-For", addr.to_string())
.no_decompress() };
.send()
.await?; let res = client_req.no_decompress().send().await?;
Ok(HttpResponse::build(res.status()).body(BodyStream::new(res))) Ok(HttpResponse::build(res.status()).body(BodyStream::new(res)))
} }