Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
26d26644
Commit
26d26644
authored
7 years ago
by
Eugen Rochko
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Require "inbox" to be set on actor to be ActivityPub-ready (#4595)
parent
3c650303
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/resolve_remote_account_service.rb
+11
-5
11 additions, 5 deletions
app/services/resolve_remote_account_service.rb
with
11 additions
and
5 deletions
app/services/resolve_remote_account_service.rb
+
11
−
5
View file @
26d26644
...
...
@@ -79,7 +79,8 @@ class ResolveRemoteAccountService < BaseService
def
activitypub_ready?
!
@webfinger
.
link
(
'self'
).
nil?
&&
[
'application/activity+json'
,
'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
].
include?
(
@webfinger
.
link
(
'self'
).
type
)
[
'application/activity+json'
,
'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
].
include?
(
@webfinger
.
link
(
'self'
).
type
)
&&
actor_json
[
'inbox'
].
present?
end
def
handle_ostatus
...
...
@@ -93,11 +94,9 @@ class ResolveRemoteAccountService < BaseService
end
def
handle_activitypub
json
=
fetch_resource
(
actor_url
)
return
if
actor_json
.
nil?
return
unless
supported_context?
(
json
)
&&
json
[
'type'
]
==
'Person'
@account
=
ActivityPub
::
ProcessAccountService
.
new
.
call
(
@username
,
@domain
,
json
)
@account
=
ActivityPub
::
ProcessAccountService
.
new
.
call
(
@username
,
@domain
,
actor_json
)
rescue
Oj
::
ParseError
nil
end
...
...
@@ -186,6 +185,13 @@ class ResolveRemoteAccountService < BaseService
@atom_body
=
response
.
to_s
end
def
actor_json
return
@actor_json
if
defined?
(
@actor_json
)
json
=
fetch_resource
(
actor_url
)
@actor_json
=
supported_context?
(
json
)
&&
json
[
'type'
]
==
'Person'
?
json
:
nil
end
def
atom
return
@atom
if
defined?
(
@atom
)
@atom
=
Nokogiri
::
XML
(
atom_body
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment