Add support for dereferencing objects through bearcaps (#14683)
This commit is contained in:
parent
ce8f33dd2f
commit
52157fdcba
4 changed files with 166 additions and 14 deletions
|
@ -71,7 +71,15 @@ class ActivityPub::Activity
|
|||
end
|
||||
|
||||
def object_uri
|
||||
@object_uri ||= value_or_id(@object)
|
||||
@object_uri ||= begin
|
||||
str = value_or_id(@object)
|
||||
|
||||
if str.start_with?('bear:')
|
||||
Addressable::URI.parse(str).query_values['u']
|
||||
else
|
||||
str
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def unsupported_object_type?
|
||||
|
@ -159,12 +167,10 @@ class ActivityPub::Activity
|
|||
|
||||
def dereference_object!
|
||||
return unless @object.is_a?(String)
|
||||
return if invalid_origin?(@object)
|
||||
|
||||
object = fetch_resource(@object, true, signed_fetch_account)
|
||||
return unless object.present? && object.is_a?(Hash) && supported_context?(object)
|
||||
dereferencer = ActivityPub::Dereferencer.new(@object, permitted_origin: @account.uri, signature_account: signed_fetch_account)
|
||||
|
||||
@object = object
|
||||
@object = dereferencer.object unless dereferencer.object.nil?
|
||||
end
|
||||
|
||||
def signed_fetch_account
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue