tolerate fedi servers that present Notes as application/ld+json

This commit is contained in:
jesopo 2020-01-18 14:02:29 +00:00
parent 47f7c7a595
commit a974134472
2 changed files with 3 additions and 1 deletions

View file

@ -79,7 +79,7 @@ class Module(ModuleManager.BaseModule):
type = "Create" type = "Create"
if not url == None: if not url == None:
note_page = ap_utils.activity_request(url) note_page = ap_utils.activity_request(url)
if not note_page.content_type == ap_utils.ACTIVITY_TYPE: if not note_page.content_type in ap_utils.AP_TYPES:
raise utils.EventError("That's not a fediverse URL") raise utils.EventError("That's not a fediverse URL")
note = note_page.json() note = note_page.json()

View file

@ -8,6 +8,8 @@ LD_TYPE = ("application/ld+json; "
JRD_TYPE = "application/jrd+json" JRD_TYPE = "application/jrd+json"
ACTIVITY_TYPE = "application/activity+json" ACTIVITY_TYPE = "application/activity+json"
AP_TYPES = [ACTIVITY_TYPE, "application/ld+json"]
def split_username(s): def split_username(s):
if s[0] == "@": if s[0] == "@":
s = s[1:] s = s[1:]