Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mastofe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
normandy
mastofe
Commits
f890d2a7
Unverified
Commit
f890d2a7
authored
Apr 02, 2018
by
Eugen Rochko
Committed by
GitHub
Apr 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support all ActivityPub actor types (#6997)
Fix #6973
parent
33513753
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
6 deletions
+8
-6
app/services/activitypub/fetch_remote_account_service.rb
app/services/activitypub/fetch_remote_account_service.rb
+3
-1
app/services/activitypub/fetch_remote_key_service.rb
app/services/activitypub/fetch_remote_key_service.rb
+2
-2
app/services/fetch_atom_service.rb
app/services/fetch_atom_service.rb
+1
-1
app/services/resolve_account_service.rb
app/services/resolve_account_service.rb
+1
-1
app/services/resolve_url_service.rb
app/services/resolve_url_service.rb
+1
-1
No files found.
app/services/activitypub/fetch_remote_account_service.rb
View file @
f890d2a7
...
...
@@ -3,6 +3,8 @@
class
ActivityPub::FetchRemoteAccountService
<
BaseService
include
JsonLdHelper
SUPPORTED_TYPES
=
%w(Application Group Organization Person Service)
.
freeze
# Should be called when uri has already been checked for locality
# Does a WebFinger roundtrip on each call
def
call
(
uri
,
id:
true
,
prefetched_body:
nil
)
...
...
@@ -54,6 +56,6 @@ class ActivityPub::FetchRemoteAccountService < BaseService
end
def
expected_type?
@json
[
'type'
]
==
'Person'
SUPPORTED_TYPES
.
include?
(
@json
[
'type'
])
end
end
app/services/activitypub/fetch_remote_key_service.rb
View file @
f890d2a7
...
...
@@ -43,7 +43,7 @@ class ActivityPub::FetchRemoteKeyService < BaseService
end
def
person?
@json
[
'type'
]
==
'Person'
ActivityPub
::
FetchRemoteAccountService
::
SUPPORTED_TYPES
.
include?
(
@json
[
'type'
])
end
def
public_key?
...
...
@@ -55,6 +55,6 @@ class ActivityPub::FetchRemoteKeyService < BaseService
end
def
confirmed_owner?
@owner
[
'type'
]
==
'Person'
&&
value_or_id
(
@owner
[
'publicKey'
])
==
@json
[
'id'
]
ActivityPub
::
FetchRemoteAccountService
::
SUPPORTED_TYPES
.
include?
(
@owner
[
'type'
])
&&
value_or_id
(
@owner
[
'publicKey'
])
==
@json
[
'id'
]
end
end
app/services/fetch_atom_service.rb
View file @
f890d2a7
...
...
@@ -42,7 +42,7 @@ class FetchAtomService < BaseService
elsif
[
'application/activity+json'
,
'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
].
include?
(
response
.
mime_type
)
body
=
response
.
body_with_limit
json
=
body_to_json
(
body
)
if
supported_context?
(
json
)
&&
json
[
'type'
]
==
'Person'
&&
json
[
'inbox'
].
present?
if
supported_context?
(
json
)
&&
ActivityPub
::
FetchRemoteAccountService
::
SUPPORTED_TYPES
.
include?
(
json
[
'type'
])
&&
json
[
'inbox'
].
present?
[
json
[
'id'
],
{
prefetched_body:
body
,
id:
true
},
:activitypub
]
elsif
supported_context?
(
json
)
&&
expected_type?
(
json
)
[
json
[
'id'
],
{
prefetched_body:
body
,
id:
true
},
:activitypub
]
...
...
app/services/resolve_account_service.rb
View file @
f890d2a7
...
...
@@ -189,7 +189,7 @@ class ResolveAccountService < BaseService
return
@actor_json
if
defined?
(
@actor_json
)
json
=
fetch_resource
(
actor_url
,
false
)
@actor_json
=
supported_context?
(
json
)
&&
json
[
'type'
]
==
'Person'
?
json
:
nil
@actor_json
=
supported_context?
(
json
)
&&
ActivityPub
::
FetchRemoteAccountService
::
SUPPORTED_TYPES
.
include?
(
json
[
'type'
])
?
json
:
nil
end
def
atom
...
...
app/services/resolve_url_service.rb
View file @
f890d2a7
...
...
@@ -17,7 +17,7 @@ class ResolveURLService < BaseService
def
process_url
case
type
when
'
Person
'
when
'
Application'
,
'Group'
,
'Organization'
,
'Person'
,
'Service
'
FetchRemoteAccountService
.
new
.
call
(
atom_url
,
body
,
protocol
)
when
'Note'
,
'Article'
,
'Image'
,
'Video'
FetchRemoteStatusService
.
new
.
call
(
atom_url
,
body
,
protocol
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment