mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
7e690f35a4
commit
21df473662
199
daemon.py
199
daemon.py
|
@ -500,7 +500,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
def handle_error(self, request, client_address):
|
def handle_error(self, request, client_address):
|
||||||
print('ERROR: http server error: ' + str(request) + ', ' +
|
print('ERROR: http server error: ' + str(request) + ', ' +
|
||||||
str(client_address))
|
str(client_address))
|
||||||
pass
|
|
||||||
|
|
||||||
def _send_reply_to_question(self, nickname: str, message_id: str,
|
def _send_reply_to_question(self, nickname: str, message_id: str,
|
||||||
answer: str,
|
answer: str,
|
||||||
|
@ -2439,10 +2438,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
def _key_shortcuts(self, path: str,
|
def _key_shortcuts(self, calling_domain: str, cookie: str,
|
||||||
calling_domain: str, cookie: str,
|
|
||||||
base_dir: str, http_prefix: str, nickname: str,
|
base_dir: str, http_prefix: str, nickname: str,
|
||||||
domain: str, domain_full: str, port: int,
|
domain: str, domain_full: str,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
debug: bool, access_keys: {},
|
debug: bool, access_keys: {},
|
||||||
default_timeline: str) -> None:
|
default_timeline: str) -> None:
|
||||||
|
@ -2529,12 +2527,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
def _theme_designer_edit(self, path: str,
|
def _theme_designer_edit(self, calling_domain: str, cookie: str,
|
||||||
calling_domain: str, cookie: str,
|
|
||||||
base_dir: str, http_prefix: str, nickname: str,
|
base_dir: str, http_prefix: str, nickname: str,
|
||||||
domain: str, domain_full: str, port: int,
|
domain: str, domain_full: str,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str, debug: bool,
|
||||||
debug: bool, access_keys: {},
|
|
||||||
default_timeline: str, theme_name: str,
|
default_timeline: str, theme_name: str,
|
||||||
allow_local_network_access: bool,
|
allow_local_network_access: bool,
|
||||||
system_language: str,
|
system_language: str,
|
||||||
|
@ -3347,8 +3343,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _unfollow_confirm(self, calling_domain: str, cookie: str,
|
def _unfollow_confirm(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str, http_prefix: str,
|
||||||
base_dir: str, http_prefix: str,
|
|
||||||
domain: str, domain_full: str, port: int,
|
domain: str, domain_full: str, port: int,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
debug: bool,
|
debug: bool,
|
||||||
|
@ -3430,8 +3425,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
}
|
}
|
||||||
path_users_section = path.split('/users/')[1]
|
path_users_section = path.split('/users/')[1]
|
||||||
self.post_to_nickname = path_users_section.split('/')[0]
|
self.post_to_nickname = path_users_section.split('/')[0]
|
||||||
group_account = has_group_type(self.server.base_dir,
|
group_account = has_group_type(base_dir, following_actor,
|
||||||
following_actor,
|
|
||||||
self.server.person_cache)
|
self.server.person_cache)
|
||||||
unfollow_account(self.server.base_dir, self.post_to_nickname,
|
unfollow_account(self.server.base_dir, self.post_to_nickname,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
@ -3448,8 +3442,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _follow_confirm(self, calling_domain: str, cookie: str,
|
def _follow_confirm(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str, http_prefix: str,
|
||||||
base_dir: str, http_prefix: str,
|
|
||||||
domain: str, domain_full: str, port: int,
|
domain: str, domain_full: str, port: int,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
debug: bool,
|
debug: bool,
|
||||||
|
@ -3621,8 +3614,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _block_confirm(self, calling_domain: str, cookie: str,
|
def _block_confirm(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str, http_prefix: str,
|
||||||
base_dir: str, http_prefix: str,
|
|
||||||
domain: str, domain_full: str, port: int,
|
domain: str, domain_full: str, port: int,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
debug: bool,
|
debug: bool,
|
||||||
|
@ -3711,8 +3703,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _unblock_confirm(self, calling_domain: str, cookie: str,
|
def _unblock_confirm(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str, http_prefix: str,
|
||||||
base_dir: str, http_prefix: str,
|
|
||||||
domain: str, domain_full: str, port: int,
|
domain: str, domain_full: str, port: int,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
debug: bool) -> None:
|
debug: bool) -> None:
|
||||||
|
@ -3805,8 +3796,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
domain: str, domain_full: str,
|
domain: str, domain_full: str,
|
||||||
port: int, search_for_emoji: bool,
|
port: int, search_for_emoji: bool,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
getreq_start_time, getreq_timings: {},
|
getreq_start_time, debug: bool,
|
||||||
debug: bool,
|
|
||||||
curr_session, proxy_type: str) -> None:
|
curr_session, proxy_type: str) -> None:
|
||||||
"""Receive a search query
|
"""Receive a search query
|
||||||
"""
|
"""
|
||||||
|
@ -4338,11 +4328,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _receive_vote(self, calling_domain: str, cookie: str,
|
def _receive_vote(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, http_prefix: str, domain_full: str,
|
||||||
base_dir: str, http_prefix: str,
|
onion_domain: str, i2p_domain: str, debug: bool,
|
||||||
domain: str, domain_full: str,
|
|
||||||
onion_domain: str, i2p_domain: str,
|
|
||||||
debug: bool,
|
|
||||||
curr_session, proxy_type: str) -> None:
|
curr_session, proxy_type: str) -> None:
|
||||||
"""Receive a vote via POST
|
"""Receive a vote via POST
|
||||||
"""
|
"""
|
||||||
|
@ -4425,13 +4412,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
def _receive_image(self, length: int,
|
def _receive_image(self, length: int, path: str, base_dir: str,
|
||||||
calling_domain: str, cookie: str,
|
domain: str, debug: bool) -> None:
|
||||||
authorized: bool, path: str,
|
|
||||||
base_dir: str, http_prefix: str,
|
|
||||||
domain: str, domain_full: str,
|
|
||||||
onion_domain: str, i2p_domain: str,
|
|
||||||
debug: bool) -> None:
|
|
||||||
"""Receives an image via POST
|
"""Receives an image via POST
|
||||||
"""
|
"""
|
||||||
if not self.outbox_authenticated:
|
if not self.outbox_authenticated:
|
||||||
|
@ -4491,8 +4473,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
def _remove_share(self, calling_domain: str, cookie: str,
|
def _remove_share(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
authorized: bool, path: str,
|
||||||
base_dir: str, http_prefix: str,
|
base_dir: str, http_prefix: str,
|
||||||
domain: str, domain_full: str,
|
domain_full: str, onion_domain: str, i2p_domain: str,
|
||||||
onion_domain: str, i2p_domain: str,
|
|
||||||
debug: bool) -> None:
|
debug: bool) -> None:
|
||||||
"""Removes a shared item
|
"""Removes a shared item
|
||||||
"""
|
"""
|
||||||
|
@ -4564,8 +4545,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
def _remove_wanted(self, calling_domain: str, cookie: str,
|
def _remove_wanted(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
authorized: bool, path: str,
|
||||||
base_dir: str, http_prefix: str,
|
base_dir: str, http_prefix: str,
|
||||||
domain: str, domain_full: str,
|
domain_full: str, onion_domain: str, i2p_domain: str,
|
||||||
onion_domain: str, i2p_domain: str,
|
|
||||||
debug: bool) -> None:
|
debug: bool) -> None:
|
||||||
"""Removes a wanted item
|
"""Removes a wanted item
|
||||||
"""
|
"""
|
||||||
|
@ -4635,8 +4615,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _receive_remove_post(self, calling_domain: str, cookie: str,
|
def _receive_remove_post(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str, http_prefix: str,
|
||||||
base_dir: str, http_prefix: str,
|
|
||||||
domain: str, domain_full: str,
|
domain: str, domain_full: str,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
debug: bool,
|
debug: bool,
|
||||||
|
@ -4743,10 +4722,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _links_update(self, calling_domain: str, cookie: str,
|
def _links_update(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str, debug: bool,
|
||||||
base_dir: str, http_prefix: str,
|
|
||||||
domain: str, domain_full: str,
|
|
||||||
onion_domain: str, i2p_domain: str, debug: bool,
|
|
||||||
default_timeline: str,
|
default_timeline: str,
|
||||||
allow_local_network_access: bool) -> None:
|
allow_local_network_access: bool) -> None:
|
||||||
"""Updates the left links column of the timeline
|
"""Updates the left links column of the timeline
|
||||||
|
@ -4890,12 +4866,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _set_hashtag_category(self, calling_domain: str, cookie: str,
|
def _set_hashtag_category(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str,
|
||||||
base_dir: str, http_prefix: str,
|
domain: str, debug: bool) -> None:
|
||||||
domain: str, domain_full: str,
|
|
||||||
onion_domain: str, i2p_domain: str, debug: bool,
|
|
||||||
default_timeline: str,
|
|
||||||
allow_local_network_access: bool) -> None:
|
|
||||||
"""On the screen after selecting a hashtag from the swarm, this sets
|
"""On the screen after selecting a hashtag from the swarm, this sets
|
||||||
the category for that tag
|
the category for that tag
|
||||||
"""
|
"""
|
||||||
|
@ -4993,10 +4965,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _newswire_update(self, calling_domain: str, cookie: str,
|
def _newswire_update(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str,
|
||||||
base_dir: str, http_prefix: str,
|
domain: str, debug: bool,
|
||||||
domain: str, domain_full: str,
|
|
||||||
onion_domain: str, i2p_domain: str, debug: bool,
|
|
||||||
default_timeline: str) -> None:
|
default_timeline: str) -> None:
|
||||||
"""Updates the right newswire column of the timeline
|
"""Updates the right newswire column of the timeline
|
||||||
"""
|
"""
|
||||||
|
@ -5153,11 +5123,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _citations_update(self, calling_domain: str, cookie: str,
|
def _citations_update(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str,
|
||||||
base_dir: str, http_prefix: str,
|
domain: str, debug: bool,
|
||||||
domain: str, domain_full: str,
|
|
||||||
onion_domain: str, i2p_domain: str, debug: bool,
|
|
||||||
default_timeline: str,
|
|
||||||
newswire: {}) -> None:
|
newswire: {}) -> None:
|
||||||
"""Updates the citations for a blog post after hitting
|
"""Updates the citations for a blog post after hitting
|
||||||
update button on the citations screen
|
update button on the citations screen
|
||||||
|
@ -5247,11 +5214,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _news_post_edit(self, calling_domain: str, cookie: str,
|
def _news_post_edit(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str,
|
||||||
base_dir: str, http_prefix: str,
|
domain: str, debug: bool) -> None:
|
||||||
domain: str, domain_full: str,
|
|
||||||
onion_domain: str, i2p_domain: str, debug: bool,
|
|
||||||
default_timeline: str) -> None:
|
|
||||||
"""edits a news post after receiving POST
|
"""edits a news post after receiving POST
|
||||||
"""
|
"""
|
||||||
users_path = path.replace('/newseditdata', '')
|
users_path = path.replace('/newseditdata', '')
|
||||||
|
@ -5384,8 +5348,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
def _profile_edit(self, calling_domain: str, cookie: str,
|
def _profile_edit(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
path: str, base_dir: str, http_prefix: str,
|
||||||
base_dir: str, http_prefix: str,
|
|
||||||
domain: str, domain_full: str,
|
domain: str, domain_full: str,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
debug: bool, allow_local_network_access: bool,
|
debug: bool, allow_local_network_access: bool,
|
||||||
|
@ -5884,9 +5847,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if fields.get('customSubmitText'):
|
if fields.get('customSubmitText'):
|
||||||
if fields['customSubmitText'] != \
|
if fields['customSubmitText'] != \
|
||||||
curr_custom_submit_text:
|
curr_custom_submit_text:
|
||||||
customText = fields['customSubmitText']
|
custom_text = fields['customSubmitText']
|
||||||
set_config_param(base_dir, 'customSubmitText',
|
set_config_param(base_dir, 'customSubmitText',
|
||||||
customText)
|
custom_text)
|
||||||
else:
|
else:
|
||||||
if curr_custom_submit_text:
|
if curr_custom_submit_text:
|
||||||
set_config_param(base_dir, 'customSubmitText',
|
set_config_param(base_dir, 'customSubmitText',
|
||||||
|
@ -7305,7 +7268,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
save_json(actor_json, actor_filename)
|
save_json(actor_json, actor_filename)
|
||||||
webfinger_update(base_dir,
|
webfinger_update(base_dir,
|
||||||
nickname, domain,
|
nickname, domain,
|
||||||
onion_domain,
|
onion_domain, i2p_domain,
|
||||||
self.server.cached_webfingers)
|
self.server.cached_webfingers)
|
||||||
# also copy to the actors cache and
|
# also copy to the actors cache and
|
||||||
# person_cache in memory
|
# person_cache in memory
|
||||||
|
@ -7597,8 +7560,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
None, calling_domain, False)
|
None, calling_domain, False)
|
||||||
self._write(msg)
|
self._write(msg)
|
||||||
|
|
||||||
def _get_exported_theme(self, calling_domain: str, path: str,
|
def _get_exported_theme(self, path: str, base_dir: str, domain_full: str,
|
||||||
base_dir: str, domain_full: str,
|
|
||||||
debug: bool) -> None:
|
debug: bool) -> None:
|
||||||
"""Returns an exported theme zip file
|
"""Returns an exported theme zip file
|
||||||
"""
|
"""
|
||||||
|
@ -7684,8 +7646,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
print('font not found: ' + path + ' ' + calling_domain)
|
print('font not found: ' + path + ' ' + calling_domain)
|
||||||
self._404()
|
self._404()
|
||||||
|
|
||||||
def _get_rss2feed(self, authorized: bool,
|
def _get_rss2feed(self, calling_domain: str, path: str,
|
||||||
calling_domain: str, path: str,
|
|
||||||
base_dir: str, http_prefix: str,
|
base_dir: str, http_prefix: str,
|
||||||
domain: str, port: int, proxy_type: str,
|
domain: str, port: int, proxy_type: str,
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
|
@ -7734,8 +7695,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
path + ' ' + calling_domain)
|
path + ' ' + calling_domain)
|
||||||
self._404()
|
self._404()
|
||||||
|
|
||||||
def _get_rss2site(self, authorized: bool,
|
def _get_rss2site(self, calling_domain: str, path: str,
|
||||||
calling_domain: str, path: str,
|
|
||||||
base_dir: str, http_prefix: str,
|
base_dir: str, http_prefix: str,
|
||||||
domain_full: str, port: int, proxy_type: str,
|
domain_full: str, port: int, proxy_type: str,
|
||||||
translate: {},
|
translate: {},
|
||||||
|
@ -7792,8 +7752,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
path + ' ' + calling_domain)
|
path + ' ' + calling_domain)
|
||||||
self._404()
|
self._404()
|
||||||
|
|
||||||
def _get_newswire_feed(self, authorized: bool,
|
def _get_newswire_feed(self, calling_domain: str, path: str,
|
||||||
calling_domain: str, path: str,
|
|
||||||
base_dir: str, http_prefix: str,
|
base_dir: str, http_prefix: str,
|
||||||
domain: str, port: int, proxy_type: str,
|
domain: str, port: int, proxy_type: str,
|
||||||
getreq_start_time,
|
getreq_start_time,
|
||||||
|
@ -15595,7 +15554,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
|
|
||||||
if authorized and '/exports/' in self.path:
|
if authorized and '/exports/' in self.path:
|
||||||
self._get_exported_theme(calling_domain, self.path,
|
self._get_exported_theme(self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.domain_full,
|
self.server.domain_full,
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
|
@ -15641,8 +15600,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.path == '/newswire.xml':
|
if self.path == '/newswire.xml':
|
||||||
self._get_newswire_feed(authorized,
|
self._get_newswire_feed(calling_domain, self.path,
|
||||||
calling_domain, self.path,
|
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
@ -15657,8 +15615,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if self.path.startswith('/blog/') and \
|
if self.path.startswith('/blog/') and \
|
||||||
self.path.endswith('/rss.xml'):
|
self.path.endswith('/rss.xml'):
|
||||||
if not self.path == '/blog/rss.xml':
|
if not self.path == '/blog/rss.xml':
|
||||||
self._get_rss2feed(authorized,
|
self._get_rss2feed(calling_domain, self.path,
|
||||||
calling_domain, self.path,
|
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
@ -15668,8 +15625,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.debug,
|
self.server.debug,
|
||||||
curr_session)
|
curr_session)
|
||||||
else:
|
else:
|
||||||
self._get_rss2site(authorized,
|
self._get_rss2site(calling_domain, self.path,
|
||||||
calling_domain, self.path,
|
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain_full,
|
self.server.domain_full,
|
||||||
|
@ -19966,23 +19922,17 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
if authorized and self.path.endswith('/sethashtagcategory'):
|
if authorized and self.path.endswith('/sethashtagcategory'):
|
||||||
self._set_hashtag_category(calling_domain, cookie,
|
self._set_hashtag_category(calling_domain, cookie,
|
||||||
authorized, self.path,
|
self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.domain_full,
|
self.server.debug)
|
||||||
self.server.onion_domain,
|
|
||||||
self.server.i2p_domain,
|
|
||||||
self.server.debug,
|
|
||||||
self.server.default_timeline,
|
|
||||||
self.server.allow_local_network_access)
|
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
# update of profile/avatar from web interface,
|
# update of profile/avatar from web interface,
|
||||||
# after selecting Edit button then Submit
|
# after selecting Edit button then Submit
|
||||||
if authorized and self.path.endswith('/profiledata'):
|
if authorized and self.path.endswith('/profiledata'):
|
||||||
self._profile_edit(calling_domain, cookie, authorized, self.path,
|
self._profile_edit(calling_domain, cookie, self.path,
|
||||||
self.server.base_dir, self.server.http_prefix,
|
self.server.base_dir, self.server.http_prefix,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.domain_full,
|
self.server.domain_full,
|
||||||
|
@ -19997,12 +19947,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
|
|
||||||
if authorized and self.path.endswith('/linksdata'):
|
if authorized and self.path.endswith('/linksdata'):
|
||||||
self._links_update(calling_domain, cookie, authorized, self.path,
|
self._links_update(calling_domain, cookie, self.path,
|
||||||
self.server.base_dir, self.server.http_prefix,
|
self.server.base_dir, self.server.debug,
|
||||||
self.server.domain,
|
|
||||||
self.server.domain_full,
|
|
||||||
self.server.onion_domain,
|
|
||||||
self.server.i2p_domain, self.server.debug,
|
|
||||||
self.server.default_timeline,
|
self.server.default_timeline,
|
||||||
self.server.allow_local_network_access)
|
self.server.allow_local_network_access)
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
@ -20010,39 +19956,28 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
if authorized and self.path.endswith('/newswiredata'):
|
if authorized and self.path.endswith('/newswiredata'):
|
||||||
self._newswire_update(calling_domain, cookie,
|
self._newswire_update(calling_domain, cookie,
|
||||||
authorized, self.path,
|
self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.domain, self.server.debug,
|
||||||
self.server.domain,
|
|
||||||
self.server.domain_full,
|
|
||||||
self.server.onion_domain,
|
|
||||||
self.server.i2p_domain, self.server.debug,
|
|
||||||
self.server.default_timeline)
|
self.server.default_timeline)
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
if authorized and self.path.endswith('/citationsdata'):
|
if authorized and self.path.endswith('/citationsdata'):
|
||||||
self._citations_update(calling_domain, cookie,
|
self._citations_update(calling_domain, cookie,
|
||||||
authorized, self.path,
|
self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.domain_full,
|
self.server.debug,
|
||||||
self.server.onion_domain,
|
|
||||||
self.server.i2p_domain, self.server.debug,
|
|
||||||
self.server.default_timeline,
|
|
||||||
self.server.newswire)
|
self.server.newswire)
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
if authorized and self.path.endswith('/newseditdata'):
|
if authorized and self.path.endswith('/newseditdata'):
|
||||||
self._news_post_edit(calling_domain, cookie, authorized, self.path,
|
self._news_post_edit(calling_domain, cookie, self.path,
|
||||||
self.server.base_dir, self.server.http_prefix,
|
self.server.base_dir,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.domain_full,
|
self.server.debug)
|
||||||
self.server.onion_domain,
|
|
||||||
self.server.i2p_domain, self.server.debug,
|
|
||||||
self.server.default_timeline)
|
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -20123,10 +20058,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if self.path.endswith('/question') or \
|
if self.path.endswith('/question') or \
|
||||||
'/question?page=' in self.path:
|
'/question?page=' in self.path:
|
||||||
self._receive_vote(calling_domain, cookie,
|
self._receive_vote(calling_domain, cookie,
|
||||||
authorized, self.path,
|
self.path,
|
||||||
self.server.base_dir,
|
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
|
||||||
self.server.domain_full,
|
self.server.domain_full,
|
||||||
self.server.onion_domain,
|
self.server.onion_domain,
|
||||||
self.server.i2p_domain,
|
self.server.i2p_domain,
|
||||||
|
@ -20142,7 +20075,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
authorized, self.path,
|
authorized, self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
|
||||||
self.server.domain_full,
|
self.server.domain_full,
|
||||||
self.server.onion_domain,
|
self.server.onion_domain,
|
||||||
self.server.i2p_domain,
|
self.server.i2p_domain,
|
||||||
|
@ -20156,7 +20088,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
authorized, self.path,
|
authorized, self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
|
||||||
self.server.domain_full,
|
self.server.domain_full,
|
||||||
self.server.onion_domain,
|
self.server.onion_domain,
|
||||||
self.server.i2p_domain,
|
self.server.i2p_domain,
|
||||||
|
@ -20178,7 +20109,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
if self.path.endswith('/rmpost'):
|
if self.path.endswith('/rmpost'):
|
||||||
self._receive_remove_post(calling_domain, cookie,
|
self._receive_remove_post(calling_domain, cookie,
|
||||||
authorized, self.path,
|
self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
@ -20197,7 +20128,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# decision to follow in the web interface is confirmed
|
# decision to follow in the web interface is confirmed
|
||||||
if self.path.endswith('/followconfirm'):
|
if self.path.endswith('/followconfirm'):
|
||||||
self._follow_confirm(calling_domain, cookie,
|
self._follow_confirm(calling_domain, cookie,
|
||||||
authorized, self.path,
|
self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
@ -20218,7 +20149,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# decision to unfollow in the web interface is confirmed
|
# decision to unfollow in the web interface is confirmed
|
||||||
if self.path.endswith('/unfollowconfirm'):
|
if self.path.endswith('/unfollowconfirm'):
|
||||||
self._unfollow_confirm(calling_domain, cookie,
|
self._unfollow_confirm(calling_domain, cookie,
|
||||||
authorized, self.path,
|
self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
@ -20238,7 +20169,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# decision to unblock in the web interface is confirmed
|
# decision to unblock in the web interface is confirmed
|
||||||
if self.path.endswith('/unblockconfirm'):
|
if self.path.endswith('/unblockconfirm'):
|
||||||
self._unblock_confirm(calling_domain, cookie,
|
self._unblock_confirm(calling_domain, cookie,
|
||||||
authorized, self.path,
|
self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
@ -20257,7 +20188,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# decision to block in the web interface is confirmed
|
# decision to block in the web interface is confirmed
|
||||||
if self.path.endswith('/blockconfirm'):
|
if self.path.endswith('/blockconfirm'):
|
||||||
self._block_confirm(calling_domain, cookie,
|
self._block_confirm(calling_domain, cookie,
|
||||||
authorized, self.path,
|
self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
@ -20305,14 +20236,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.key_shortcuts[nickname] = access_keys.copy()
|
self.server.key_shortcuts[nickname] = access_keys.copy()
|
||||||
access_keys = self.server.key_shortcuts[nickname]
|
access_keys = self.server.key_shortcuts[nickname]
|
||||||
|
|
||||||
self._key_shortcuts(self.path,
|
self._key_shortcuts(calling_domain, cookie,
|
||||||
calling_domain, cookie,
|
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
nickname,
|
nickname,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.domain_full,
|
self.server.domain_full,
|
||||||
self.server.port,
|
|
||||||
self.server.onion_domain,
|
self.server.onion_domain,
|
||||||
self.server.i2p_domain,
|
self.server.i2p_domain,
|
||||||
self.server.debug,
|
self.server.debug,
|
||||||
|
@ -20335,18 +20264,15 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
allow_local_network_access = \
|
allow_local_network_access = \
|
||||||
self.server.allow_local_network_access
|
self.server.allow_local_network_access
|
||||||
|
|
||||||
self._theme_designer_edit(self.path,
|
self._theme_designer_edit(calling_domain, cookie,
|
||||||
calling_domain, cookie,
|
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
nickname,
|
nickname,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.domain_full,
|
self.server.domain_full,
|
||||||
self.server.port,
|
|
||||||
self.server.onion_domain,
|
self.server.onion_domain,
|
||||||
self.server.i2p_domain,
|
self.server.i2p_domain,
|
||||||
self.server.debug,
|
self.server.debug,
|
||||||
access_keys,
|
|
||||||
self.server.default_timeline,
|
self.server.default_timeline,
|
||||||
self.server.theme_name,
|
self.server.theme_name,
|
||||||
allow_local_network_access,
|
allow_local_network_access,
|
||||||
|
@ -20520,14 +20446,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# receive images to the outbox
|
# receive images to the outbox
|
||||||
if self.headers['Content-type'].startswith('image/') and \
|
if self.headers['Content-type'].startswith('image/') and \
|
||||||
users_in_path:
|
users_in_path:
|
||||||
self._receive_image(length, calling_domain, cookie,
|
self._receive_image(length, self.path,
|
||||||
authorized, self.path,
|
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.http_prefix,
|
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.domain_full,
|
|
||||||
self.server.onion_domain,
|
|
||||||
self.server.i2p_domain,
|
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
11
webfinger.py
11
webfinger.py
|
@ -490,7 +490,7 @@ def _webfinger_updateFromProfile(wf_json: {}, actor_json: {}) -> bool:
|
||||||
|
|
||||||
|
|
||||||
def webfinger_update(base_dir: str, nickname: str, domain: str,
|
def webfinger_update(base_dir: str, nickname: str, domain: str,
|
||||||
onion_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
cached_webfingers: {}) -> None:
|
cached_webfingers: {}) -> None:
|
||||||
"""Regenerates stored webfinger
|
"""Regenerates stored webfinger
|
||||||
"""
|
"""
|
||||||
|
@ -505,8 +505,15 @@ def webfinger_update(base_dir: str, nickname: str, domain: str,
|
||||||
if onion_domain in handle:
|
if onion_domain in handle:
|
||||||
handle = handle.replace(onion_domain, domain)
|
handle = handle.replace(onion_domain, domain)
|
||||||
onionify = True
|
onionify = True
|
||||||
|
elif i2p_domain:
|
||||||
|
if i2p_domain in handle:
|
||||||
|
handle = handle.replace(i2p_domain, domain)
|
||||||
|
i2pify = True
|
||||||
if not onionify:
|
if not onionify:
|
||||||
wf_json = load_json(filename)
|
if not i2pify:
|
||||||
|
wf_json = load_json(filename)
|
||||||
|
else:
|
||||||
|
wf_json = load_json_onionify(filename, domain, i2p_domain)
|
||||||
else:
|
else:
|
||||||
wf_json = load_json_onionify(filename, domain, onion_domain)
|
wf_json = load_json_onionify(filename, domain, onion_domain)
|
||||||
if not wf_json:
|
if not wf_json:
|
||||||
|
|
Loading…
Reference in New Issue