more fix
This commit is contained in:
parent
451d388833
commit
47bfde132c
5 changed files with 10 additions and 4 deletions
|
|
@ -29,7 +29,7 @@ pub async fn new_instance(
|
||||||
.signed_fetch_actor(&system_user)
|
.signed_fetch_actor(&system_user)
|
||||||
.app_data(database)
|
.app_data(database)
|
||||||
.url_verifier(Box::new(MyUrlVerifier()))
|
.url_verifier(Box::new(MyUrlVerifier()))
|
||||||
.debug(false)
|
.debug(true)
|
||||||
.build()
|
.build()
|
||||||
.await?;
|
.await?;
|
||||||
Ok(config)
|
Ok(config)
|
||||||
|
|
|
||||||
|
|
@ -136,8 +136,8 @@ impl SendActivityTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn build_tasks<'a, Activity, Datatype, ActorType>(
|
pub(crate) async fn build_tasks<Activity, Datatype, ActorType>(
|
||||||
activity: &'a Activity,
|
activity: &Activity,
|
||||||
actor: &ActorType,
|
actor: &ActorType,
|
||||||
inboxes: Vec<Url>,
|
inboxes: Vec<Url>,
|
||||||
data: &Data<Datatype>,
|
data: &Data<Datatype>,
|
||||||
|
|
|
||||||
|
|
@ -360,6 +360,7 @@ const _IMPL_DIESEL_NEW_TYPE_FOR_OBJECT_ID: () = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Shared test code
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[allow(clippy::unwrap_used)]
|
#[allow(clippy::unwrap_used)]
|
||||||
pub mod tests {
|
pub mod tests {
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,12 @@ where
|
||||||
.splitn(2, '@')
|
.splitn(2, '@')
|
||||||
.collect_tuple()
|
.collect_tuple()
|
||||||
.ok_or(WebFingerError::WrongFormat.into_crate_error())?;
|
.ok_or(WebFingerError::WrongFormat.into_crate_error())?;
|
||||||
if !DOMAIN_REGEX.is_match(domain) {
|
|
||||||
|
// For production mode make sure that domain doesnt contain any port or path.
|
||||||
|
if !data.config.debug && !DOMAIN_REGEX.is_match(domain) {
|
||||||
return Err(Error::UrlVerificationError("Invalid characters in domain").into());
|
return Err(Error::UrlVerificationError("Invalid characters in domain").into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let protocol = if data.config.debug { "http" } else { "https" };
|
let protocol = if data.config.debug { "http" } else { "https" };
|
||||||
let fetch_url =
|
let fetch_url =
|
||||||
format!("{protocol}://{domain}/.well-known/webfinger?resource=acct:{identifier}");
|
format!("{protocol}://{domain}/.well-known/webfinger?resource=acct:{identifier}");
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,7 @@ pub(crate) fn verify_body_hash(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Shared test code
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[allow(clippy::unwrap_used)]
|
#[allow(clippy::unwrap_used)]
|
||||||
pub mod test {
|
pub mod test {
|
||||||
|
|
@ -378,6 +379,7 @@ pub mod test {
|
||||||
assert_eq!(invalid, Err(Error::ActivityBodyDigestInvalid));
|
assert_eq!(invalid, Err(Error::ActivityBodyDigestInvalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return hardcoded keypair
|
||||||
pub fn test_keypair() -> Keypair {
|
pub fn test_keypair() -> Keypair {
|
||||||
let rsa = RsaPrivateKey::from_pkcs1_pem(PRIVATE_KEY).unwrap();
|
let rsa = RsaPrivateKey::from_pkcs1_pem(PRIVATE_KEY).unwrap();
|
||||||
let pkey = RsaPublicKey::from(&rsa);
|
let pkey = RsaPublicKey::from(&rsa);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue