From 1f065385a0acc61a068fb23f2b53c8f082f74dba Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 7 Sep 2020 16:51:02 -0500 Subject: [PATCH] Update deps --- Cargo.lock | 34 ++++++++++++++++++---------------- Cargo.toml | 6 +++--- src/apub.rs | 2 +- src/config.rs | 2 +- src/data/actor.rs | 2 +- src/data/media.rs | 2 +- src/data/node.rs | 2 +- src/data/state.rs | 2 +- src/db.rs | 2 +- src/error.rs | 2 +- src/jobs/apub/announce.rs | 2 +- src/jobs/apub/follow.rs | 2 +- src/jobs/apub/forward.rs | 2 +- src/jobs/apub/mod.rs | 2 +- src/jobs/deliver.rs | 2 +- src/jobs/deliver_many.rs | 2 +- src/jobs/instance.rs | 2 +- src/jobs/nodeinfo.rs | 2 +- src/middleware/verifier.rs | 2 +- src/notify.rs | 2 +- src/requests.rs | 37 ++++++++----------------------------- src/routes/actor.rs | 2 +- src/routes/inbox.rs | 2 +- templates/admin.rs.html | 2 +- templates/info.rs.html | 2 +- templates/instance.rs.html | 2 +- 26 files changed, 52 insertions(+), 71 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 666c91a..a29648b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,19 +1,10 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] -name = "activitystreams-ext" -version = "0.1.0" -source = "git+https://git.asonix.dog/asonix/activitystreams-ext?branch=main#9acc466c7cb550ada31b669a1c47ea088f1c8471" -dependencies = [ - "activitystreams-new", - "serde 1.0.115", - "serde_json", -] - -[[package]] -name = "activitystreams-new" -version = "0.1.0" -source = "git+https://git.asonix.dog/asonix/activitystreams-sketch?branch=main#857d5167dfa13054dd0d21d3d54f8147eea0d546" +name = "activitystreams" +version = "0.7.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261b423734cca2a170d7a76936f1f0f9e6c6fc297d36cfc5ea6aa15f9017f996" dependencies = [ "chrono", "mime", @@ -23,6 +14,17 @@ dependencies = [ "url", ] +[[package]] +name = "activitystreams-ext" +version = "0.1.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb8e19a0810cc25df3535061a08b7d8f8a734d309ea4411c57a9767e4a2ffa0e" +dependencies = [ + "activitystreams", + "serde 1.0.115", + "serde_json", +] + [[package]] name = "actix-codec" version = "0.2.0" @@ -1172,9 +1174,9 @@ dependencies = [ [[package]] name = "http-signature-normalization-actix" -version = "0.4.0-alpha.2" +version = "0.4.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131fc982391a6b37847888b568cbe0e9cd302f1b0015f4f6f4a50234bebd049c" +checksum = "b44149de8286e9a07aeb72f4dee198530c0fb95df77f36b11138a748788f5603" dependencies = [ "actix-http", "actix-web", @@ -1948,8 +1950,8 @@ checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" name = "relay" version = "0.1.0" dependencies = [ + "activitystreams", "activitystreams-ext", - "activitystreams-new", "actix-rt", "actix-web", "actix-webfinger", diff --git a/Cargo.toml b/Cargo.toml index a1115f2..80b0890 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,8 @@ anyhow = "1.0" actix-rt = "1.1.1" actix-web = { version = "3.0.0-beta.1", features = ["rustls"] } actix-webfinger = "0.3.0-alpha.6" -activitystreams-new = { git = "https://git.asonix.dog/asonix/activitystreams-sketch", branch = "main" } -activitystreams-ext = { git = "https://git.asonix.dog/asonix/activitystreams-ext", branch = "main" } +activitystreams = "0.7.0-alpha.4" +activitystreams-ext = "0.1.0-alpha.2" ammonia = "3.1.0" async-mutex = "1.0.1" async-trait = "0.1.24" @@ -31,7 +31,7 @@ deadpool-postgres = "0.5.5" dotenv = "0.15.0" env_logger = "0.7.1" futures = "0.3.4" -http-signature-normalization-actix = { version = "0.4.0-alpha.1", default-features = false, features = ["sha-2"] } +http-signature-normalization-actix = { version = "0.4.0-alpha.3", default-features = false, features = ["sha-2"] } log = "0.4" lru = "0.6.0" mime = "0.3.16" diff --git a/src/apub.rs b/src/apub.rs index 09b8f19..644527c 100644 --- a/src/apub.rs +++ b/src/apub.rs @@ -1,5 +1,5 @@ use activitystreams_ext::{Ext1, UnparsedExtension}; -use activitystreams_new::{ +use activitystreams::{ activity::ActorAndObject, actor::{Actor, ApActor}, unparsed::UnparsedMutExt, diff --git a/src/config.rs b/src/config.rs index 75dd5e3..160ad56 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,5 @@ use crate::{data::ActorCache, error::MyError, middleware::MyVerify, requests::Requests}; -use activitystreams_new::{uri, url::Url}; +use activitystreams::{uri, url::Url}; use config::Environment; use http_signature_normalization_actix::prelude::{VerifyDigest, VerifySignature}; use sha2::{Digest, Sha256}; diff --git a/src/data/actor.rs b/src/data/actor.rs index 1ca841b..48cb67a 100644 --- a/src/data/actor.rs +++ b/src/data/actor.rs @@ -1,5 +1,5 @@ use crate::{apub::AcceptedActors, db::Db, error::MyError, requests::Requests}; -use activitystreams_new::{prelude::*, uri, url::Url}; +use activitystreams::{prelude::*, uri, url::Url}; use log::error; use std::{collections::HashSet, sync::Arc, time::Duration}; use tokio::sync::RwLock; diff --git a/src/data/media.rs b/src/data/media.rs index 998654c..1fe838b 100644 --- a/src/data/media.rs +++ b/src/data/media.rs @@ -1,5 +1,5 @@ use crate::{db::Db, error::MyError}; -use activitystreams_new::url::Url; +use activitystreams::url::Url; use async_mutex::Mutex; use bytes::Bytes; use futures::join; diff --git a/src/data/node.rs b/src/data/node.rs index 82beda0..9742d58 100644 --- a/src/data/node.rs +++ b/src/data/node.rs @@ -1,5 +1,5 @@ use crate::{db::Db, error::MyError}; -use activitystreams_new::{uri, url::Url}; +use activitystreams::{uri, url::Url}; use log::{debug, error}; use std::{ collections::{HashMap, HashSet}, diff --git a/src/data/state.rs b/src/data/state.rs index 6387bb1..3563b70 100644 --- a/src/data/state.rs +++ b/src/data/state.rs @@ -5,7 +5,7 @@ use crate::{ error::MyError, requests::Requests, }; -use activitystreams_new::url::Url; +use activitystreams::url::Url; use actix_rt::{ spawn, time::{interval_at, Instant}, diff --git a/src/db.rs b/src/db.rs index 2544e1c..2d866ea 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1,5 +1,5 @@ use crate::error::MyError; -use activitystreams_new::url::Url; +use activitystreams::url::Url; use deadpool_postgres::{Manager, Pool}; use log::{info, warn}; use rsa::RSAPrivateKey; diff --git a/src/error.rs b/src/error.rs index 356d94f..1217eaf 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,4 @@ -use activitystreams_new::{error::DomainError, url::ParseError}; +use activitystreams::{error::DomainError, url::ParseError}; use actix_web::{ error::{BlockingError, ResponseError}, http::StatusCode, diff --git a/src/jobs/apub/announce.rs b/src/jobs/apub/announce.rs index 2a3a602..dc19bbe 100644 --- a/src/jobs/apub/announce.rs +++ b/src/jobs/apub/announce.rs @@ -7,7 +7,7 @@ use crate::{ DeliverMany, JobState, }, }; -use activitystreams_new::{activity::Announce as AsAnnounce, url::Url}; +use activitystreams::{activity::Announce as AsAnnounce, url::Url}; use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; diff --git a/src/jobs/apub/follow.rs b/src/jobs/apub/follow.rs index 4e8f497..8af768b 100644 --- a/src/jobs/apub/follow.rs +++ b/src/jobs/apub/follow.rs @@ -5,7 +5,7 @@ use crate::{ error::MyError, jobs::{apub::prepare_activity, Deliver, JobState}, }; -use activitystreams_new::{ +use activitystreams::{ activity::{Accept as AsAccept, Follow as AsFollow}, prelude::*, url::Url, diff --git a/src/jobs/apub/forward.rs b/src/jobs/apub/forward.rs index b22e860..a8e4c29 100644 --- a/src/jobs/apub/forward.rs +++ b/src/jobs/apub/forward.rs @@ -4,7 +4,7 @@ use crate::{ error::MyError, jobs::{apub::get_inboxes, DeliverMany, JobState}, }; -use activitystreams_new::prelude::*; +use activitystreams::prelude::*; use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; diff --git a/src/jobs/apub/mod.rs b/src/jobs/apub/mod.rs index 7bea12d..9829cb2 100644 --- a/src/jobs/apub/mod.rs +++ b/src/jobs/apub/mod.rs @@ -3,7 +3,7 @@ use crate::{ data::{Actor, State}, error::MyError, }; -use activitystreams_new::{ +use activitystreams::{ activity::{Follow as AsFollow, Undo as AsUndo}, context, prelude::*, diff --git a/src/jobs/deliver.rs b/src/jobs/deliver.rs index 3850021..bdb83ce 100644 --- a/src/jobs/deliver.rs +++ b/src/jobs/deliver.rs @@ -1,5 +1,5 @@ use crate::{error::MyError, jobs::JobState}; -use activitystreams_new::url::Url; +use activitystreams::url::Url; use anyhow::Error; use background_jobs::{ActixJob, Backoff}; use std::{future::Future, pin::Pin}; diff --git a/src/jobs/deliver_many.rs b/src/jobs/deliver_many.rs index f35729d..d6b411b 100644 --- a/src/jobs/deliver_many.rs +++ b/src/jobs/deliver_many.rs @@ -2,7 +2,7 @@ use crate::{ error::MyError, jobs::{Deliver, JobState}, }; -use activitystreams_new::url::Url; +use activitystreams::url::Url; use anyhow::Error; use background_jobs::ActixJob; use futures::future::{ready, Ready}; diff --git a/src/jobs/instance.rs b/src/jobs/instance.rs index dcc0e7d..08ebbaa 100644 --- a/src/jobs/instance.rs +++ b/src/jobs/instance.rs @@ -2,7 +2,7 @@ use crate::{ config::UrlKind, jobs::{cache_media::CacheMedia, JobState}, }; -use activitystreams_new::url::Url; +use activitystreams::url::Url; use anyhow::Error; use background_jobs::ActixJob; use futures::join; diff --git a/src/jobs/nodeinfo.rs b/src/jobs/nodeinfo.rs index 661a793..48b340d 100644 --- a/src/jobs/nodeinfo.rs +++ b/src/jobs/nodeinfo.rs @@ -1,5 +1,5 @@ use crate::jobs::JobState; -use activitystreams_new::url::Url; +use activitystreams::url::Url; use anyhow::Error; use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; diff --git a/src/middleware/verifier.rs b/src/middleware/verifier.rs index 3c5128e..b140518 100644 --- a/src/middleware/verifier.rs +++ b/src/middleware/verifier.rs @@ -1,5 +1,5 @@ use crate::{data::ActorCache, error::MyError, requests::Requests}; -use activitystreams_new::uri; +use activitystreams::uri; use actix_web::web; use http_signature_normalization_actix::{prelude::*, verify::DeprecatedAlgorithm}; use log::error; diff --git a/src/notify.rs b/src/notify.rs index 389a9a4..69ba5ef 100644 --- a/src/notify.rs +++ b/src/notify.rs @@ -3,7 +3,7 @@ use crate::{ db::listen, jobs::{JobServer, QueryInstance, QueryNodeinfo}, }; -use activitystreams_new::url::Url; +use activitystreams::url::Url; use actix_rt::{spawn, time::delay_for}; use futures::stream::{poll_fn, StreamExt}; use log::{debug, error, warn}; diff --git a/src/requests.rs b/src/requests.rs index cbc2da6..319e5c2 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -1,5 +1,5 @@ use crate::error::MyError; -use activitystreams_new::url::Url; +use activitystreams::url::Url; use actix_web::{client::Client, http::header::Date}; use bytes::Bytes; use http_signature_normalization_actix::prelude::*; @@ -37,7 +37,7 @@ impl Requests { key_id, user_agent, private_key, - config: Config::default().dont_use_created_field(), + config: Config::default().dont_use_created_field().set_host_header(), } } @@ -77,15 +77,8 @@ impl Requests { let signer = self.signer(); let client: Client = self.client.borrow().clone(); - let req = client.get(url); - let host = req - .get_uri() - .host() - .ok_or(MyError::Host(url.to_string()))? - .to_string(); - debug!("Host: {}", host); - let res = req - .header("Host", host) + let res = client + .get(url) .header("Accept", accept) .set(Date(SystemTime::now().into())) .signature( @@ -130,15 +123,8 @@ impl Requests { let signer = self.signer(); let client: Client = self.client.borrow().clone(); - let req = client.get(url); - let host = req - .get_uri() - .host() - .ok_or(MyError::Host(url.to_string()))? - .to_string(); - debug!("Host: {}", host); - let res = req - .header("Host", host) + let res = client + .get(url) .header("Accept", "*/*") .set(Date(SystemTime::now().into())) .signature( @@ -198,15 +184,8 @@ impl Requests { let item_string = serde_json::to_string(item)?; let client: Client = self.client.borrow().clone(); - let req = client.post(inbox.as_str()); - let host = req - .get_uri() - .host() - .ok_or(MyError::Host(inbox.to_string()))? - .to_string(); - debug!("Host: {}", host); - let res = req - .header("Host", host) + let res = client + .post(inbox.as_str()) .header("Accept", "application/activity+json") .header("Content-Type", "application/activity+json") .set(Date(SystemTime::now().into())) diff --git a/src/routes/actor.rs b/src/routes/actor.rs index 2944dc1..ff6b1d8 100644 --- a/src/routes/actor.rs +++ b/src/routes/actor.rs @@ -6,7 +6,7 @@ use crate::{ routes::ok, }; use activitystreams_ext::Ext1; -use activitystreams_new::{ +use activitystreams::{ actor::{ApActor, Application, Endpoints}, context, prelude::*, diff --git a/src/routes/inbox.rs b/src/routes/inbox.rs index 79ecf29..4e51bf0 100644 --- a/src/routes/inbox.rs +++ b/src/routes/inbox.rs @@ -8,7 +8,7 @@ use crate::{ requests::Requests, routes::accepted, }; -use activitystreams_new::{ +use activitystreams::{ activity, base::AnyBase, prelude::*, primitives::OneOrMany, public, url::Url, }; use actix_web::{web, HttpResponse}; diff --git a/templates/admin.rs.html b/templates/admin.rs.html index 983d65e..af54435 100644 --- a/templates/admin.rs.html +++ b/templates/admin.rs.html @@ -1,5 +1,5 @@ @use crate::data::Contact; -@use activitystreams_new::url::Url; +@use activitystreams::url::Url; @(contact: &Contact, base: &Url) diff --git a/templates/info.rs.html b/templates/info.rs.html index 0231ff6..5606ba6 100644 --- a/templates/info.rs.html +++ b/templates/info.rs.html @@ -1,5 +1,5 @@ @use crate::data::Info; -@use activitystreams_new::url::Url; +@use activitystreams::url::Url; @(info: &Info, base: &Url) diff --git a/templates/instance.rs.html b/templates/instance.rs.html index 513ce6b..5529577 100644 --- a/templates/instance.rs.html +++ b/templates/instance.rs.html @@ -1,5 +1,5 @@ @use crate::{data::{Contact, Instance}, templates::admin}; -@use activitystreams_new::url::Url; +@use activitystreams::url::Url; @(instance: &Instance, software: Option<&str>, contact: Option<&Contact>, base: &Url)