Use 'uri' in a few places
This commit is contained in:
		
							parent
							
								
									55eb002ccd
								
							
						
					
					
						commit
						1bb098d42b
					
				
					 5 changed files with 11 additions and 12 deletions
				
			
		
							
								
								
									
										2
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							|  | @ -39,7 +39,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "activitystreams-new" | ||||
| version = "0.1.0" | ||||
| source = "git+https://git.asonix.dog/asonix/activitystreams-sketch#05a2bdc98d5595b0a74fd79b7e1b19f382ad3139" | ||||
| source = "git+https://git.asonix.dog/asonix/activitystreams-sketch#99c7e9aa5596eda846a1ebd5978ca72d11d4c08a" | ||||
| dependencies = [ | ||||
|  "activitystreams", | ||||
|  "serde 1.0.111", | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| use crate::{data::ActorCache, error::MyError, middleware::MyVerify, requests::Requests}; | ||||
| use activitystreams_new::primitives::XsdAnyUri; | ||||
| use activitystreams_new::{primitives::XsdAnyUri, uri}; | ||||
| use config::Environment; | ||||
| use http_signature_normalization_actix::prelude::{VerifyDigest, VerifySignature}; | ||||
| use sha2::{Digest, Sha256}; | ||||
|  | @ -68,7 +68,7 @@ impl Config { | |||
|         let config: ParsedConfig = config.try_into()?; | ||||
| 
 | ||||
|         let scheme = if config.https { "https" } else { "http" }; | ||||
|         let base_uri = format!("{}://{}", scheme, config.hostname).parse()?; | ||||
|         let base_uri = uri!(format!("{}://{}", scheme, config.hostname)); | ||||
| 
 | ||||
|         Ok(Config { | ||||
|             hostname: config.hostname, | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| use crate::{apub::AcceptedActors, db::Db, error::MyError, requests::Requests}; | ||||
| use activitystreams_new::{prelude::*, primitives::XsdAnyUri}; | ||||
| use activitystreams_new::{prelude::*, primitives::XsdAnyUri, uri}; | ||||
| use log::error; | ||||
| use std::{collections::HashSet, sync::Arc, time::Duration}; | ||||
| use tokio::sync::RwLock; | ||||
|  | @ -204,9 +204,9 @@ impl ActorCache { | |||
| 
 | ||||
|         Ok(Some(Actor { | ||||
|             id: id.clone(), | ||||
|             inbox: inbox.parse()?, | ||||
|             inbox: uri!(inbox), | ||||
|             public_key: row.try_get(1)?, | ||||
|             public_key_id: public_key_id.parse()?, | ||||
|             public_key_id: uri!(public_key_id), | ||||
|         })) | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| use crate::{db::Db, error::MyError}; | ||||
| use activitystreams_new::primitives::XsdAnyUri; | ||||
| use activitystreams_new::{primitives::XsdAnyUri, uri}; | ||||
| use log::{debug, error}; | ||||
| use std::{ | ||||
|     collections::{HashMap, HashSet}, | ||||
|  | @ -140,9 +140,8 @@ impl NodeCache { | |||
|         }; | ||||
| 
 | ||||
|         let listener: String = row.try_get(0)?; | ||||
|         let listener: XsdAnyUri = listener.parse()?; | ||||
| 
 | ||||
|         self.nodes.write().await.remove(&listener); | ||||
|         self.nodes.write().await.remove(&uri!(listener)); | ||||
| 
 | ||||
|         Ok(()) | ||||
|     } | ||||
|  | @ -170,7 +169,7 @@ impl NodeCache { | |||
|         }; | ||||
| 
 | ||||
|         let listener: String = row.try_get(0)?; | ||||
|         let listener: XsdAnyUri = listener.parse()?; | ||||
|         let listener = uri!(listener); | ||||
|         let info: Option<Json<Info>> = row.try_get(1)?; | ||||
|         let instance: Option<Json<Instance>> = row.try_get(2)?; | ||||
|         let contact: Option<Json<Contact>> = row.try_get(3)?; | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| use crate::{data::ActorCache, error::MyError, requests::Requests}; | ||||
| use activitystreams_new::primitives::XsdAnyUri; | ||||
| use activitystreams_new::uri; | ||||
| use actix_web::web; | ||||
| use http_signature_normalization_actix::{prelude::*, verify::DeprecatedAlgorithm}; | ||||
| use log::error; | ||||
|  | @ -19,7 +19,7 @@ impl MyVerify { | |||
|         signature: String, | ||||
|         signing_string: String, | ||||
|     ) -> Result<bool, MyError> { | ||||
|         let mut uri: XsdAnyUri = key_id.parse()?; | ||||
|         let mut uri = uri!(key_id); | ||||
|         uri.as_url_mut().set_fragment(None); | ||||
|         let actor = self.1.get(&uri, &self.0).await?; | ||||
|         let was_cached = actor.is_cached(); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue