mirror of https://gitlab.com/bashrc2/epicyon
Nodeinfo version 2.2
parent
8135cd7f6a
commit
c50be1c807
|
@ -806,6 +806,12 @@ def run_daemon(accounts_data_dir: str,
|
|||
if os.path.isfile(hide_announces_filename):
|
||||
httpd.hide_announces = load_json(hide_announces_filename)
|
||||
|
||||
# description of the instance
|
||||
httpd.instance_description = \
|
||||
get_config_param(base_dir, 'instanceDescription')
|
||||
if httpd.instance_description is None:
|
||||
httpd.instance_description = ''
|
||||
|
||||
# number of book events which show on profile screens
|
||||
httpd.no_of_books = no_of_books
|
||||
|
||||
|
|
|
@ -347,7 +347,8 @@ def daemon_http_get(self) -> None:
|
|||
self.server.show_node_info_version,
|
||||
self.server.show_node_info_accounts,
|
||||
self.server.registration,
|
||||
self.server.domain):
|
||||
self.server.domain,
|
||||
self.server.instance_description):
|
||||
return
|
||||
|
||||
fitness_performance(getreq_start_time, self.server.fitness,
|
||||
|
|
|
@ -37,7 +37,8 @@ def get_nodeinfo(self, ua_str: str, calling_domain: str,
|
|||
project_version: str,
|
||||
show_node_info_version: bool,
|
||||
show_node_info_accounts: bool,
|
||||
registration: bool, domain: str) -> bool:
|
||||
registration: bool, domain: str,
|
||||
instance_description: str) -> bool:
|
||||
if path.startswith('/nodeinfo/1.0'):
|
||||
http_400(self)
|
||||
return True
|
||||
|
@ -124,7 +125,8 @@ def get_nodeinfo(self, ua_str: str, calling_domain: str,
|
|||
registration,
|
||||
node_info_version,
|
||||
show_node_info_accounts,
|
||||
domain)
|
||||
domain,
|
||||
instance_description)
|
||||
if info:
|
||||
msg_str = json.dumps(info)
|
||||
msg_str = convert_domains(calling_domain, referer_domain,
|
||||
|
|
|
@ -1954,7 +1954,7 @@ def _profile_post_memorial_accounts(base_dir: str, domain: str,
|
|||
update_memorial_flags(base_dir, person_cache)
|
||||
|
||||
|
||||
def _profile_post_instance_desc(base_dir: str, fields: {}) -> None:
|
||||
def _profile_post_instance_desc(self, base_dir: str, fields: {}) -> None:
|
||||
""" HTTP POST change instance description
|
||||
"""
|
||||
curr_instance_description = \
|
||||
|
@ -1964,10 +1964,13 @@ def _profile_post_instance_desc(base_dir: str, fields: {}) -> None:
|
|||
set_config_param(base_dir,
|
||||
'instanceDescription',
|
||||
fields['instanceDescription'])
|
||||
self.server.instance_description = \
|
||||
fields['instanceDescription']
|
||||
else:
|
||||
if curr_instance_description:
|
||||
set_config_param(base_dir,
|
||||
'instanceDescription', '')
|
||||
self.server.instance_description = ''
|
||||
|
||||
|
||||
def _profile_post_instance_short_desc(base_dir: str, fields: {}) -> None:
|
||||
|
@ -2753,7 +2756,7 @@ def profile_edit(self, calling_domain: str, cookie: str,
|
|||
|
||||
_profile_post_instance_short_desc(base_dir, fields)
|
||||
|
||||
_profile_post_instance_desc(base_dir, fields)
|
||||
_profile_post_instance_desc(self, base_dir, fields)
|
||||
|
||||
_profile_post_memorial_accounts(base_dir, domain,
|
||||
person_cache, fields)
|
||||
|
|
90
metadata.py
90
metadata.py
|
@ -18,10 +18,11 @@ def meta_data_node_info(base_dir: str,
|
|||
terms_of_service_url: str,
|
||||
registration: bool, version: str,
|
||||
show_accounts: bool,
|
||||
domain: str) -> {}:
|
||||
""" /nodeinfo/2.1 endpoint
|
||||
domain: str,
|
||||
instance_description: str) -> {}:
|
||||
""" /nodeinfo/2.2 endpoint
|
||||
Also see https://socialhub.activitypub.rocks/t/
|
||||
https://github.com/jhass/nodeinfo/blob/main/schemas/2.1/example.json
|
||||
https://github.com/jhass/nodeinfo/blob/main/schemas/2.2/example.json
|
||||
fep-f1d5-nodeinfo-in-fediverse-software/1190/4
|
||||
|
||||
Note that there are security considerations with this. If an adversary
|
||||
|
@ -42,54 +43,59 @@ def meta_data_node_info(base_dir: str,
|
|||
local_posts = 1
|
||||
|
||||
nodeinfo = {
|
||||
'openRegistrations': registration,
|
||||
'protocols': ['activitypub'],
|
||||
'services': {
|
||||
'outbound': ['rss2.0']
|
||||
},
|
||||
'software': {
|
||||
'name': 'epicyon',
|
||||
'repository': 'https://gitlab.com/bashrc2/epicyon',
|
||||
'homepage': 'https://gitlab.com/bashrc2/epicyon',
|
||||
'version': version
|
||||
},
|
||||
"version": "2.2",
|
||||
'documents': {
|
||||
'about': about_url,
|
||||
'terms': terms_of_service_url
|
||||
},
|
||||
'usage': {
|
||||
'localPosts': local_posts,
|
||||
'users': {
|
||||
'activeHalfyear': active_accounts_half_year,
|
||||
'activeMonth': active_accounts_monthly,
|
||||
'total': active_accounts
|
||||
"instance": {
|
||||
"name": "Epicyon",
|
||||
"description": instance_description
|
||||
},
|
||||
"software": {
|
||||
"name": "epicyon",
|
||||
"repository": "https://gitlab.com/bashrc2/epicyon",
|
||||
"homepage": "https://gitlab.com/bashrc2/epicyon",
|
||||
"version": version
|
||||
},
|
||||
"protocols": ["activitypub"],
|
||||
"services": {
|
||||
"outbound": ["rss2.0"]
|
||||
},
|
||||
"openRegistrations": registration,
|
||||
"usage": {
|
||||
"localComments": 0,
|
||||
"localPosts": local_posts,
|
||||
"users": {
|
||||
"activeHalfyear": active_accounts_half_year,
|
||||
"activeMonth": active_accounts_monthly,
|
||||
"total": active_accounts
|
||||
}
|
||||
},
|
||||
'metadata': {
|
||||
'accountActivationRequired': False,
|
||||
'features': [
|
||||
'editing',
|
||||
'exposable_reactions'
|
||||
"metadata": {
|
||||
"accountActivationRequired": False,
|
||||
"features": [
|
||||
"editing",
|
||||
"exposable_reactions"
|
||||
],
|
||||
'chat_enabled': False,
|
||||
'federatedTimelineAvailable': False,
|
||||
'federation': {
|
||||
'enabled': True
|
||||
"chat_enabled": False,
|
||||
"federatedTimelineAvailable": False,
|
||||
"federation": {
|
||||
"enabled": True
|
||||
},
|
||||
'suggestions': {
|
||||
'enabled': False
|
||||
"suggestions": {
|
||||
"enabled": False
|
||||
},
|
||||
'invitesEnabled': False,
|
||||
'private': True,
|
||||
'privilegedStaff': True,
|
||||
'nodeName': domain,
|
||||
'mailerEnabled': False,
|
||||
'publicTimelineVisibility': {},
|
||||
'postFormats': ['text/plain', 'text/html', 'text/markdown'],
|
||||
'FEPs': ['c648', '521a', '8fcf', '4ccd', 'c118', 'fffd',
|
||||
'1970', '0837', '7628', '2677']
|
||||
},
|
||||
'version': '2.1'
|
||||
"invitesEnabled": False,
|
||||
"private": True,
|
||||
"privilegedStaff": True,
|
||||
"nodeName": domain,
|
||||
"mailerEnabled": False,
|
||||
"publicTimelineVisibility": {},
|
||||
"postFormats": ["text/plain", "text/html", "text/markdown"],
|
||||
"FEPs": ["c648", "521a", "8fcf", "4ccd", "c118", "fffd",
|
||||
"1970", "0837", "7628", "2677"]
|
||||
}
|
||||
}
|
||||
return nodeinfo
|
||||
|
||||
|
|
Loading…
Reference in New Issue