Rename: get_sender07() -> get_sender()
This commit is contained in:
		
							parent
							
								
									7dd56a71e3
								
							
						
					
					
						commit
						15134eed60
					
				@ -364,7 +364,7 @@ pub trait FromId<C>: Sized {
 | 
				
			|||||||
        id: &str,
 | 
					        id: &str,
 | 
				
			||||||
        proxy: Option<reqwest::Proxy>,
 | 
					        proxy: Option<reqwest::Proxy>,
 | 
				
			||||||
    ) -> Result<Self::Object, (Option<serde_json::Value>, Self::Error)> {
 | 
					    ) -> Result<Self::Object, (Option<serde_json::Value>, Self::Error)> {
 | 
				
			||||||
        request::get(id, Self::get_sender07(), proxy)
 | 
					        request::get(id, Self::get_sender(), proxy)
 | 
				
			||||||
            .map_err(|_| (None, InboxError::DerefError))
 | 
					            .map_err(|_| (None, InboxError::DerefError))
 | 
				
			||||||
            .and_then(|mut r| {
 | 
					            .and_then(|mut r| {
 | 
				
			||||||
                let json: serde_json::Value = r
 | 
					                let json: serde_json::Value = r
 | 
				
			||||||
@ -382,7 +382,7 @@ pub trait FromId<C>: Sized {
 | 
				
			|||||||
    /// Tries to find a `Self` with a given ID (`id`), using `ctx` (a database)
 | 
					    /// Tries to find a `Self` with a given ID (`id`), using `ctx` (a database)
 | 
				
			||||||
    fn from_db(ctx: &C, id: &str) -> Result<Self, Self::Error>;
 | 
					    fn from_db(ctx: &C, id: &str) -> Result<Self, Self::Error>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn get_sender07() -> &'static dyn Signer;
 | 
					    fn get_sender() -> &'static dyn Signer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Should be implemented by anything representing an ActivityPub actor.
 | 
					/// Should be implemented by anything representing an ActivityPub actor.
 | 
				
			||||||
@ -614,7 +614,7 @@ mod tests {
 | 
				
			|||||||
            Ok(Self)
 | 
					            Ok(Self)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        fn get_sender07() -> &'static dyn Signer {
 | 
					        fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
            &*MY_SIGNER
 | 
					            &*MY_SIGNER
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -642,7 +642,7 @@ mod tests {
 | 
				
			|||||||
            Ok(Self)
 | 
					            Ok(Self)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        fn get_sender07() -> &'static dyn Signer {
 | 
					        fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
            &*MY_SIGNER
 | 
					            &*MY_SIGNER
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -793,7 +793,7 @@ mod tests {
 | 
				
			|||||||
            Err(())
 | 
					            Err(())
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        fn get_sender07() -> &'static dyn Signer {
 | 
					        fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
            &*MY_SIGNER
 | 
					            &*MY_SIGNER
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -475,7 +475,7 @@ impl FromId<DbConn> for Blog {
 | 
				
			|||||||
        Blog::insert(conn, new_blog)
 | 
					        Blog::insert(conn, new_blog)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn get_sender07() -> &'static dyn sign::Signer {
 | 
					    fn get_sender() -> &'static dyn sign::Signer {
 | 
				
			||||||
        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
					        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -349,7 +349,7 @@ impl FromId<DbConn> for Comment {
 | 
				
			|||||||
        Ok(comm)
 | 
					        Ok(comm)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn get_sender07() -> &'static dyn Signer {
 | 
					    fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
					        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -203,7 +203,7 @@ impl FromId<DbConn> for Follow {
 | 
				
			|||||||
        Follow::accept_follow07(conn, &actor, &target, follow, actor.id, target.id)
 | 
					        Follow::accept_follow07(conn, &actor, &target, follow, actor.id, target.id)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn get_sender07() -> &'static dyn Signer {
 | 
					    fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
					        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -149,7 +149,7 @@ impl FromId<DbConn> for Like {
 | 
				
			|||||||
        Ok(res)
 | 
					        Ok(res)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn get_sender07() -> &'static dyn Signer {
 | 
					    fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
					        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -221,7 +221,7 @@ impl Media {
 | 
				
			|||||||
        // TODO: conditional GET
 | 
					        // TODO: conditional GET
 | 
				
			||||||
        request::get(
 | 
					        request::get(
 | 
				
			||||||
            remote_url.as_str(),
 | 
					            remote_url.as_str(),
 | 
				
			||||||
            User::get_sender07(),
 | 
					            User::get_sender(),
 | 
				
			||||||
            CONFIG.proxy().cloned(),
 | 
					            CONFIG.proxy().cloned(),
 | 
				
			||||||
        )?
 | 
					        )?
 | 
				
			||||||
        .copy_to(&mut dest)?;
 | 
					        .copy_to(&mut dest)?;
 | 
				
			||||||
 | 
				
			|||||||
@ -802,7 +802,7 @@ impl FromId<DbConn> for Post {
 | 
				
			|||||||
        Ok(post)
 | 
					        Ok(post)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn get_sender07() -> &'static dyn Signer {
 | 
					    fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
        Instance::get_local_instance_user().expect("Failed to get local instance user")
 | 
					        Instance::get_local_instance_user().expect("Failed to get local instance user")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -897,7 +897,7 @@ impl FromId<DbConn> for PostUpdate {
 | 
				
			|||||||
        Ok(post_update)
 | 
					        Ok(post_update)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn get_sender07() -> &'static dyn Signer {
 | 
					    fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
					        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -178,7 +178,7 @@ impl FromId<DbConn> for Reshare {
 | 
				
			|||||||
        Ok(res)
 | 
					        Ok(res)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn get_sender07() -> &'static dyn Signer {
 | 
					    fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
					        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -244,7 +244,7 @@ impl User {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn fetch(url: &str) -> Result<CustomPerson> {
 | 
					    fn fetch(url: &str) -> Result<CustomPerson> {
 | 
				
			||||||
        let mut res = get(url, Self::get_sender07(), CONFIG.proxy().cloned())?;
 | 
					        let mut res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?;
 | 
				
			||||||
        let text = &res.text()?;
 | 
					        let text = &res.text()?;
 | 
				
			||||||
        // without this workaround, publicKey is not correctly deserialized
 | 
					        // without this workaround, publicKey is not correctly deserialized
 | 
				
			||||||
        let ap_sign = serde_json::from_str::<ApSignature>(text)?;
 | 
					        let ap_sign = serde_json::from_str::<ApSignature>(text)?;
 | 
				
			||||||
@ -517,7 +517,7 @@ impl User {
 | 
				
			|||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        url: &str,
 | 
					        url: &str,
 | 
				
			||||||
    ) -> Result<(Vec<T>, Option<String>)> {
 | 
					    ) -> Result<(Vec<T>, Option<String>)> {
 | 
				
			||||||
        let mut res = get(url, Self::get_sender07(), CONFIG.proxy().cloned())?;
 | 
					        let mut res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?;
 | 
				
			||||||
        let text = &res.text()?;
 | 
					        let text = &res.text()?;
 | 
				
			||||||
        let json: serde_json::Value = serde_json::from_str(text)?;
 | 
					        let json: serde_json::Value = serde_json::from_str(text)?;
 | 
				
			||||||
        let items = json["items"]
 | 
					        let items = json["items"]
 | 
				
			||||||
@ -534,7 +534,7 @@ impl User {
 | 
				
			|||||||
    pub fn fetch_outbox07<T: Activity + serde::de::DeserializeOwned>(&self) -> Result<Vec<T>> {
 | 
					    pub fn fetch_outbox07<T: Activity + serde::de::DeserializeOwned>(&self) -> Result<Vec<T>> {
 | 
				
			||||||
        let mut res = get(
 | 
					        let mut res = get(
 | 
				
			||||||
            &self.outbox_url[..],
 | 
					            &self.outbox_url[..],
 | 
				
			||||||
            Self::get_sender07(),
 | 
					            Self::get_sender(),
 | 
				
			||||||
            CONFIG.proxy().cloned(),
 | 
					            CONFIG.proxy().cloned(),
 | 
				
			||||||
        )?;
 | 
					        )?;
 | 
				
			||||||
        let text = &res.text()?;
 | 
					        let text = &res.text()?;
 | 
				
			||||||
@ -570,7 +570,7 @@ impl User {
 | 
				
			|||||||
    pub fn fetch_followers_ids(&self) -> Result<Vec<String>> {
 | 
					    pub fn fetch_followers_ids(&self) -> Result<Vec<String>> {
 | 
				
			||||||
        let mut res = get(
 | 
					        let mut res = get(
 | 
				
			||||||
            &self.followers_endpoint[..],
 | 
					            &self.followers_endpoint[..],
 | 
				
			||||||
            Self::get_sender07(),
 | 
					            Self::get_sender(),
 | 
				
			||||||
            CONFIG.proxy().cloned(),
 | 
					            CONFIG.proxy().cloned(),
 | 
				
			||||||
        )?;
 | 
					        )?;
 | 
				
			||||||
        let text = &res.text()?;
 | 
					        let text = &res.text()?;
 | 
				
			||||||
@ -1044,7 +1044,7 @@ impl FromId<DbConn> for User {
 | 
				
			|||||||
        Ok(user)
 | 
					        Ok(user)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn get_sender07() -> &'static dyn Signer {
 | 
					    fn get_sender() -> &'static dyn Signer {
 | 
				
			||||||
        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
					        Instance::get_local_instance_user().expect("Failed to local instance user")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user