0
0
Fork 0

Support more variations of ActivityPub keyId in signature (#4630)

- Tries to avoid performing HTTP request if the keyId is an actor URI
- Likewise if the URI is a fragment URI on top of actor URI
- Resolves public key, returns owner if the owner links back to the key
This commit is contained in:
Eugen Rochko 2017-08-21 22:57:34 +02:00 committed by GitHub
parent f391a4673a
commit 72bb3e03fd
8 changed files with 60 additions and 7 deletions

View file

@ -58,7 +58,7 @@ class ActivityPub::Activity
end
def object_uri
@object_uri ||= @object.is_a?(String) ? @object : @object['id']
@object_uri ||= value_or_id(@object)
end
def redis

View file

@ -20,6 +20,6 @@ class ActivityPub::Activity::Accept < ActivityPub::Activity
end
def target_uri
@target_uri ||= @object['actor']
@target_uri ||= value_or_id(@object['actor'])
end
end

View file

@ -20,6 +20,6 @@ class ActivityPub::Activity::Reject < ActivityPub::Activity
end
def target_uri
@target_uri ||= @object['actor']
@target_uri ||= value_or_id(@object['actor'])
end
end

View file

@ -64,6 +64,6 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
end
def target_uri
@target_uri ||= @object['object'].is_a?(String) ? @object['object'] : @object['object']['id']
@target_uri ||= value_or_id(@object['object'])
end
end

View file

@ -93,7 +93,7 @@ class ActivityPub::TagManager
elsif ::TagManager.instance.local_id?(uri)
klass.find_by(id: ::TagManager.instance.unique_tag_to_local_id(uri, klass.to_s))
else
klass.find_by(uri: uri)
klass.find_by(uri: uri.split('#').first)
end
end
end