mirror of
https://github.com/astro/buzzrelay.git
synced 2025-02-17 13:15:13 +00:00
main: let follow accept have a local id
This commit is contained in:
parent
5798e76d6d
commit
1b65939557
3 changed files with 15 additions and 1 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -255,6 +255,7 @@ dependencies = [
|
||||||
"tokio-postgres",
|
"tokio-postgres",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
|
"urlencoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2090,6 +2091,12 @@ dependencies = [
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "urlencoding"
|
||||||
|
version = "2.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf8-cstr"
|
name = "utf8-cstr"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
|
|
|
@ -30,3 +30,4 @@ metrics = "0.20"
|
||||||
metrics-util = "0.14"
|
metrics-util = "0.14"
|
||||||
metrics-exporter-prometheus = "0.11"
|
metrics-exporter-prometheus = "0.11"
|
||||||
deunicode = "1.3"
|
deunicode = "1.3"
|
||||||
|
urlencoding = "2"
|
||||||
|
|
|
@ -174,12 +174,18 @@ async fn post_relay(
|
||||||
let priv_key = state.priv_key.clone();
|
let priv_key = state.priv_key.clone();
|
||||||
let client = state.client.clone();
|
let client = state.client.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
|
let accept_id = format!(
|
||||||
|
"https://{}/activity/accept/{}/{}",
|
||||||
|
state.hostname,
|
||||||
|
urlencoding::encode(&target.uri()),
|
||||||
|
urlencoding::encode(&remote_actor.inbox),
|
||||||
|
);
|
||||||
let accept = activitypub::Action {
|
let accept = activitypub::Action {
|
||||||
jsonld_context: serde_json::Value::String("https://www.w3.org/ns/activitystreams".to_string()),
|
jsonld_context: serde_json::Value::String("https://www.w3.org/ns/activitystreams".to_string()),
|
||||||
action_type: "Accept".to_string(),
|
action_type: "Accept".to_string(),
|
||||||
actor: target.uri(),
|
actor: target.uri(),
|
||||||
to: Some(json!(remote_actor.id.clone())),
|
to: Some(json!(remote_actor.id.clone())),
|
||||||
id: action.id,
|
id: accept_id,
|
||||||
object: Some(endpoint.payload),
|
object: Some(endpoint.payload),
|
||||||
};
|
};
|
||||||
let result = send::send(
|
let result = send::send(
|
||||||
|
|
Loading…
Reference in a new issue