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