Merge remote-tracking branch 'origin/main' into ap07
This commit is contained in:
commit
de4fcaee93
@ -18,6 +18,8 @@
|
|||||||
- Add explanation of sign-up step at sign-up page when email sign-up mode (#1012)
|
- Add explanation of sign-up step at sign-up page when email sign-up mode (#1012)
|
||||||
- Add NOT NULL constraint to email_blocklist table fields (#1016)
|
- Add NOT NULL constraint to email_blocklist table fields (#1016)
|
||||||
- Don't fill empty content when switching rich editor (#1017)
|
- Don't fill empty content when switching rich editor (#1017)
|
||||||
|
- Fix accept header (#1058)
|
||||||
|
- Reuse reqwest client on broadcasting (#1059)
|
||||||
|
|
||||||
## [[0.7.1]] - 2022-01-12
|
## [[0.7.1]] - 2022-01-12
|
||||||
|
|
||||||
|
13
Cargo.lock
generated
13
Cargo.lock
generated
@ -5247,9 +5247,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "validator"
|
name = "validator"
|
||||||
version = "0.14.0"
|
version = "0.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d0f08911ab0fee2c5009580f04615fa868898ee57de10692a45da0c3bcc3e5e"
|
checksum = "f07b0a1390e01c0fc35ebb26b28ced33c9a3808f7f9fbe94d3cc01e233bfeed5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"idna 0.2.3",
|
"idna 0.2.3",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -5259,14 +5259,13 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"url 2.2.2",
|
"url 2.2.2",
|
||||||
"validator_derive",
|
"validator_derive",
|
||||||
"validator_types",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "validator_derive"
|
name = "validator_derive"
|
||||||
version = "0.14.0"
|
version = "0.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d85135714dba11a1bd0b3eb1744169266f1a38977bf4e3ff5e2e1acb8c2b7eee"
|
checksum = "ea7ed5e8cf2b6bdd64a6c4ce851da25388a89327b17b88424ceced6bd5017923"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"if_chain",
|
"if_chain",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -5280,9 +5279,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "validator_types"
|
name = "validator_types"
|
||||||
version = "0.14.0"
|
version = "0.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ded9d97e1d42327632f5f3bae6403c04886e2de3036261ef42deebd931a6a291"
|
checksum = "d2ddf34293296847abfc1493b15c6e2f5d3cd19f57ad7d22673bf4c6278da329"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.37",
|
"proc-macro2 1.0.37",
|
||||||
"syn 1.0.92",
|
"syn 1.0.92",
|
||||||
|
@ -22,7 +22,7 @@ scheduled-thread-pool = "0.2.2"
|
|||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_json = "1.0.80"
|
serde_json = "1.0.80"
|
||||||
shrinkwraprs = "0.3.0"
|
shrinkwraprs = "0.3.0"
|
||||||
validator = { version = "0.14", features = ["derive"] }
|
validator = { version = "0.15", features = ["derive"] }
|
||||||
webfinger = "0.4.1"
|
webfinger = "0.4.1"
|
||||||
tracing = "0.1.34"
|
tracing = "0.1.34"
|
||||||
tracing-subscriber = "0.3.10"
|
tracing-subscriber = "0.3.10"
|
||||||
|
@ -34,8 +34,8 @@ pub const AP_CONTENT_TYPE: &str =
|
|||||||
|
|
||||||
pub fn ap_accept_header() -> Vec<&'static str> {
|
pub fn ap_accept_header() -> Vec<&'static str> {
|
||||||
vec![
|
vec![
|
||||||
"application/ld+json; profile=\"https://w3.org/ns/activitystreams\"",
|
"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"",
|
||||||
"application/ld+json;profile=\"https://w3.org/ns/activitystreams\"",
|
"application/ld+json;profile=\"https://www.w3.org/ns/activitystreams\"",
|
||||||
"application/activity+json",
|
"application/activity+json",
|
||||||
"application/ld+json",
|
"application/ld+json",
|
||||||
]
|
]
|
||||||
@ -97,14 +97,16 @@ impl<'a, 'r> FromRequest<'a, 'r> for ApRequest {
|
|||||||
.map(|header| {
|
.map(|header| {
|
||||||
header
|
header
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(|ct| match ct.trim() {
|
.map(|ct| {
|
||||||
|
match ct.trim() {
|
||||||
// bool for Forward: true if found a valid Content-Type for Plume first (HTML), false otherwise
|
// bool for Forward: true if found a valid Content-Type for Plume first (HTML), false otherwise
|
||||||
"application/ld+json; profile=\"https://w3.org/ns/activitystreams\""
|
"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
|
||||||
| "application/ld+json;profile=\"https://w3.org/ns/activitystreams\""
|
| "application/ld+json;profile=\"https://www.w3.org/ns/activitystreams\""
|
||||||
| "application/activity+json"
|
| "application/activity+json"
|
||||||
| "application/ld+json" => Outcome::Success(ApRequest),
|
| "application/ld+json" => Outcome::Success(ApRequest),
|
||||||
"text/html" => Outcome::Forward(true),
|
"text/html" => Outcome::Forward(true),
|
||||||
_ => Outcome::Forward(false),
|
_ => Outcome::Forward(false),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.fold(Outcome::Forward(false), |out, ct| {
|
.fold(Outcome::Forward(false), |out, ct| {
|
||||||
if out.clone().forwarded().unwrap_or_else(|| out.is_success()) {
|
if out.clone().forwarded().unwrap_or_else(|| out.is_success()) {
|
||||||
@ -141,6 +143,14 @@ where
|
|||||||
.sign(sender)
|
.sign(sender)
|
||||||
.expect("activity_pub::broadcast: signature error");
|
.expect("activity_pub::broadcast: signature error");
|
||||||
|
|
||||||
|
let client = if let Some(proxy) = proxy {
|
||||||
|
ClientBuilder::new().proxy(proxy)
|
||||||
|
} else {
|
||||||
|
ClientBuilder::new()
|
||||||
|
}
|
||||||
|
.connect_timeout(std::time::Duration::from_secs(5))
|
||||||
|
.build()
|
||||||
|
.expect("Can't build client");
|
||||||
let mut rt = tokio::runtime::current_thread::Runtime::new()
|
let mut rt = tokio::runtime::current_thread::Runtime::new()
|
||||||
.expect("Error while initializing tokio runtime for federation");
|
.expect("Error while initializing tokio runtime for federation");
|
||||||
for inbox in boxes {
|
for inbox in boxes {
|
||||||
@ -164,14 +174,7 @@ where
|
|||||||
headers.insert("Host", host_header_value.unwrap());
|
headers.insert("Host", host_header_value.unwrap());
|
||||||
headers.insert("Digest", request::Digest::digest(&body));
|
headers.insert("Digest", request::Digest::digest(&body));
|
||||||
rt.spawn(
|
rt.spawn(
|
||||||
if let Some(proxy) = proxy.clone() {
|
client
|
||||||
ClientBuilder::new().proxy(proxy)
|
|
||||||
} else {
|
|
||||||
ClientBuilder::new()
|
|
||||||
}
|
|
||||||
.connect_timeout(std::time::Duration::from_secs(5))
|
|
||||||
.build()
|
|
||||||
.expect("Can't build client")
|
|
||||||
.post(&inbox)
|
.post(&inbox)
|
||||||
.headers(headers.clone())
|
.headers(headers.clone())
|
||||||
.header(
|
.header(
|
||||||
|
Loading…
Reference in New Issue
Block a user