mirror of https://gitlab.com/bashrc2/epicyon
Include short instance description in nodeinfo
parent
c50be1c807
commit
3eb9a66e7a
|
@ -589,6 +589,8 @@ class EpicyonServer(ThreadingHTTPServer):
|
|||
thrFederatedSharesWatchdog = None
|
||||
thrFederatedBlocksDaemon = None
|
||||
qrcode_scale = 6
|
||||
instance_description = ''
|
||||
instance_description_short = 'Epicyon'
|
||||
|
||||
def handle_error(self, request, client_address):
|
||||
# surpress connection reset errors
|
||||
|
@ -806,6 +808,12 @@ def run_daemon(accounts_data_dir: str,
|
|||
if os.path.isfile(hide_announces_filename):
|
||||
httpd.hide_announces = load_json(hide_announces_filename)
|
||||
|
||||
# short description of the instance
|
||||
httpd.instance_description_short = \
|
||||
get_config_param(base_dir, 'instanceDescriptionShort')
|
||||
if httpd.instance_description_short is None:
|
||||
httpd.instance_description_short = 'Epicyon'
|
||||
|
||||
# description of the instance
|
||||
httpd.instance_description = \
|
||||
get_config_param(base_dir, 'instanceDescription')
|
||||
|
|
|
@ -348,6 +348,7 @@ def daemon_http_get(self) -> None:
|
|||
self.server.show_node_info_accounts,
|
||||
self.server.registration,
|
||||
self.server.domain,
|
||||
self.server.instance_description_short,
|
||||
self.server.instance_description):
|
||||
return
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ def get_nodeinfo(self, ua_str: str, calling_domain: str,
|
|||
show_node_info_version: bool,
|
||||
show_node_info_accounts: bool,
|
||||
registration: bool, domain: str,
|
||||
instance_description_short: str,
|
||||
instance_description: str) -> bool:
|
||||
if path.startswith('/nodeinfo/1.0'):
|
||||
http_400(self)
|
||||
|
@ -126,6 +127,7 @@ def get_nodeinfo(self, ua_str: str, calling_domain: str,
|
|||
node_info_version,
|
||||
show_node_info_accounts,
|
||||
domain,
|
||||
instance_description_short,
|
||||
instance_description)
|
||||
if info:
|
||||
msg_str = json.dumps(info)
|
||||
|
|
|
@ -1973,7 +1973,7 @@ def _profile_post_instance_desc(self, base_dir: str, fields: {}) -> None:
|
|||
self.server.instance_description = ''
|
||||
|
||||
|
||||
def _profile_post_instance_short_desc(base_dir: str, fields: {}) -> None:
|
||||
def _profile_post_instance_short_desc(self, base_dir: str, fields: {}) -> None:
|
||||
""" HTTP POST change instance short description
|
||||
"""
|
||||
curr_instance_description_short = \
|
||||
|
@ -1984,10 +1984,12 @@ def _profile_post_instance_short_desc(base_dir: str, fields: {}) -> None:
|
|||
idesc = fields['instanceDescriptionShort']
|
||||
set_config_param(base_dir,
|
||||
'instanceDescriptionShort', idesc)
|
||||
self.server.instance_description_short = idesc
|
||||
else:
|
||||
if curr_instance_description_short:
|
||||
set_config_param(base_dir,
|
||||
'instanceDescriptionShort', '')
|
||||
self.server.instance_description_short = 'Epicyon'
|
||||
|
||||
|
||||
def _profile_post_content_license(base_dir: str, fields: {}, self) -> None:
|
||||
|
@ -2754,7 +2756,7 @@ def profile_edit(self, calling_domain: str, cookie: str,
|
|||
|
||||
_profile_post_content_license(base_dir, fields, self)
|
||||
|
||||
_profile_post_instance_short_desc(base_dir, fields)
|
||||
_profile_post_instance_short_desc(self, base_dir, fields)
|
||||
|
||||
_profile_post_instance_desc(self, base_dir, fields)
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ def meta_data_node_info(base_dir: str,
|
|||
registration: bool, version: str,
|
||||
show_accounts: bool,
|
||||
domain: str,
|
||||
instance_description_short: str,
|
||||
instance_description: str) -> {}:
|
||||
""" /nodeinfo/2.2 endpoint
|
||||
Also see https://socialhub.activitypub.rocks/t/
|
||||
|
@ -49,7 +50,7 @@ def meta_data_node_info(base_dir: str,
|
|||
'terms': terms_of_service_url
|
||||
},
|
||||
"instance": {
|
||||
"name": "Epicyon",
|
||||
"name": instance_description_short,
|
||||
"description": instance_description
|
||||
},
|
||||
"software": {
|
||||
|
|
Loading…
Reference in New Issue