Feat: Friendica support (#11)

* feat: support PMs

* feat: friendica admins

* fix

* supported software
pull/13/head
Divided by Zer0 2023-06-27 11:06:28 +02:00 committed by GitHub
parent fdb872f7cf
commit cf488eb583
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -2,4 +2,5 @@ FEDISEER_VERSION = "0.5.0"
SUPPORTED_SOFTWARE = [
"lemmy",
"mastodon",
"friendica",
]

View File

@ -23,6 +23,7 @@ def get_admin_for_software(software: str, domain: str):
software_map = {
"lemmy": get_lemmy_admins,
"mastodon": get_mastodon_admins,
"friendica": get_mastodon_admins,
}
if software not in software_map:
return []
@ -41,7 +42,7 @@ def get_nodeinfo(domain):
}
wellknown = requests.get(f"https://{domain}/.well-known/nodeinfo", headers=headers, timeout=3).json()
headers["Sec-Fetch-Site"] = "cross-site"
nodeinfo = requests.get(wellknown['links'][0]['href'], headers=headers, timeout=3).json()
nodeinfo = requests.get(wellknown['links'][-1]['href'], headers=headers, timeout=3).json()
return nodeinfo
except Exception as err:
return None

View File

@ -38,6 +38,7 @@ class ActivityPubPM:
software_map = {
"lemmy": self.send_lemmy_pm,
"mastodon": self.send_mastodon_pm,
"friendica": self.send_mastodon_pm,
"fediseer": self.send_fediseer_pm,
}
return software_map[software](message, username, domain)