mirror of
https://git.asonix.dog/asonix/relay.git
synced 2025-11-27 11:00:35 +00:00
Merge pull request 'Updated to (hopefully) support IceShrimp.NET style actors' (#9) from terrencefoxfur/relay:main into main
Reviewed-on: https://git.asonix.dog/asonix/relay/pulls/9 Reviewed-by: asonix <asonix@asonix.dog>
This commit is contained in:
commit
c7ad5576b1
|
|
@ -28,7 +28,7 @@ impl MyVerify {
|
||||||
// receiving an activity from a domain indicates it is probably online
|
// receiving an activity from a domain indicates it is probably online
|
||||||
self.0.reset_breaker(&public_key_id);
|
self.0.reset_breaker(&public_key_id);
|
||||||
|
|
||||||
let actor_id = if let Some(mut actor_id) = self
|
let actor_id = if let Some(actor_id) = self
|
||||||
.2
|
.2
|
||||||
.db
|
.db
|
||||||
.actor_id_from_public_key_id(public_key_id.clone())
|
.actor_id_from_public_key_id(public_key_id.clone())
|
||||||
|
|
@ -38,8 +38,18 @@ impl MyVerify {
|
||||||
return Err(ErrorKind::NotAllowed(key_id).into());
|
return Err(ErrorKind::NotAllowed(key_id).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
actor_id.set_fragment(None);
|
// Try with fully qualified URI first (including fragment), then fallback to fragment-stripped URI
|
||||||
let actor = self.1.get(&actor_id, &self.0).await?;
|
let actor_with_fragment = actor_id.clone();
|
||||||
|
let mut actor_without_fragment = actor_id.clone();
|
||||||
|
actor_without_fragment.set_fragment(None);
|
||||||
|
|
||||||
|
let actor = match self.1.get(&actor_with_fragment, &self.0).await {
|
||||||
|
Ok(actor) => actor,
|
||||||
|
Err(_) => {
|
||||||
|
// Fallback to fragment-stripped URI for backward compatibility
|
||||||
|
self.1.get(&actor_without_fragment, &self.0).await?
|
||||||
|
}
|
||||||
|
};
|
||||||
let was_cached = actor.is_cached();
|
let was_cached = actor.is_cached();
|
||||||
let actor = actor.into_inner();
|
let actor = actor.into_inner();
|
||||||
|
|
||||||
|
|
@ -90,7 +100,18 @@ impl MyVerify {
|
||||||
// Previously we verified the sig from an actor's local cache
|
// Previously we verified the sig from an actor's local cache
|
||||||
//
|
//
|
||||||
// Now we make sure we fetch an updated actor
|
// Now we make sure we fetch an updated actor
|
||||||
let actor = self.1.get_no_cache(&actor_id, &self.0).await?;
|
// Try with fully qualified URI first (including fragment), then fallback to fragment-stripped URI
|
||||||
|
let actor_with_fragment = actor_id.clone();
|
||||||
|
let mut actor_without_fragment = actor_id.clone();
|
||||||
|
actor_without_fragment.set_fragment(None);
|
||||||
|
|
||||||
|
let actor = match self.1.get_no_cache(&actor_with_fragment, &self.0).await {
|
||||||
|
Ok(actor) => actor,
|
||||||
|
Err(_) => {
|
||||||
|
// Fallback to fragment-stripped URI for backward compatibility
|
||||||
|
self.1.get_no_cache(&actor_without_fragment, &self.0).await?
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
do_verify(&self.3, &actor.public_key, signature, signing_string).await?;
|
do_verify(&self.3, &actor.public_key, signature, signing_string).await?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user