summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorDashie <dashie@sigpipe.me>2020-03-11 19:05:02 +0100
committerDashie <dashie@sigpipe.me>2020-03-11 19:05:02 +0100
commitf1fc51b87a7042eefac3b5c103b428260763931c (patch)
tree33bf54b51c25e0c912ea1db50311f248a550855a /api
parent680765b772ef394e225aa1cada315adef425e0cd (diff)
Hotfix Funkwhale actor discovery
Diffstat (limited to 'api')
-rw-r--r--api/models.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/api/models.py b/api/models.py
index 77642190..d057d6b1 100644
--- a/api/models.py
+++ b/api/models.py
@@ -743,7 +743,14 @@ def create_remote_actor(activity_actor: ap.BaseActivity):
"""
actor = Actor()
actor.preferred_username = activity_actor.preferredUsername
- domain = urlparse(activity_actor.url)
+ # TODO this should be handled better, like with pyld...
+ # handle funkwhale Actor types
+ url = activity_actor.url
+ if isinstance(url, list):
+ url = next(iter(item for item in url if item["type"] == "Link" and item["mediaType"] == "text/html"), None)[
+ "href"
+ ]
+ domain = urlparse(url)
actor.domain = domain.netloc
actor.type = "Person"
actor.name = activity_actor.name