mirror of https://gitlab.com/bashrc2/epicyon
main
commit
0984028d8d
29
daemon.py
29
daemon.py
|
@ -4080,6 +4080,35 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.postreq_busy = False
|
||||
return
|
||||
|
||||
if '&submitInfo=' in follow_confirm_params:
|
||||
following_actor = \
|
||||
urllib.parse.unquote_plus(follow_confirm_params)
|
||||
following_actor = following_actor.split('actor=')[1]
|
||||
if '&' in following_actor:
|
||||
following_actor = following_actor.split('&')[0]
|
||||
if is_moderator(base_dir, follower_nickname):
|
||||
msg = \
|
||||
html_account_info(self.server.translate,
|
||||
base_dir, http_prefix,
|
||||
follower_nickname,
|
||||
self.server.domain,
|
||||
self.server.port,
|
||||
following_actor,
|
||||
self.server.debug,
|
||||
self.server.system_language,
|
||||
self.server.signing_priv_key_pem)
|
||||
if msg:
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._login_headers('text/html',
|
||||
msglen, calling_domain)
|
||||
self._write(msg)
|
||||
self.server.postreq_busy = False
|
||||
return
|
||||
self._redirect_headers(following_actor, cookie, calling_domain)
|
||||
self.server.postreq_busy = False
|
||||
return
|
||||
|
||||
if '&submitYes=' in follow_confirm_params:
|
||||
following_actor = \
|
||||
urllib.parse.unquote_plus(follow_confirm_params)
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -135,8 +135,19 @@ def _valid_profile_preview_post(post_json_object: {},
|
|||
post_json_object = new_post_json_object
|
||||
if not post_json_object.get('actor'):
|
||||
return False, None
|
||||
if not is_announced_feed_item:
|
||||
if has_object_dict(post_json_object):
|
||||
# convert actor back to id
|
||||
if isinstance(post_json_object['actor'], dict):
|
||||
if post_json_object['actor'].get('id'):
|
||||
post_json_object['actor'] = post_json_object['actor']['id']
|
||||
if has_object_dict(post_json_object):
|
||||
# convert attributedTo actor back to id
|
||||
if post_json_object['object'].get('attributedTo'):
|
||||
if isinstance(post_json_object['object']['attributedTo'],
|
||||
dict):
|
||||
if post_json_object['object']['attributedTo'].get('id'):
|
||||
post_json_object['object']['attributedTo'] = \
|
||||
post_json_object['object']['attributedTo']['id']
|
||||
if not is_announced_feed_item:
|
||||
if post_json_object['actor'] != person_url and \
|
||||
post_json_object['object']['type'] != 'Page':
|
||||
return False, None
|
||||
|
@ -352,6 +363,12 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
|
|||
' <input type="hidden" name="actor" value="' + \
|
||||
person_url + '">\n'
|
||||
if not is_following_actor(base_dir, nickname, domain, person_url):
|
||||
if is_moderator(base_dir, nickname):
|
||||
profile_str += \
|
||||
' <button type="submit" class="button" ' + \
|
||||
'name="submitInfo" ' + \
|
||||
'accesskey="' + access_keys['infoButton'] + '">' + \
|
||||
translate['Info'] + '</button>\n'
|
||||
profile_str += \
|
||||
' <button type="submit" class="button" ' + \
|
||||
'name="submitYes" ' + \
|
||||
|
@ -401,6 +418,9 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
|
|||
show_item, post_json_object = \
|
||||
_valid_profile_preview_post(item, person_url)
|
||||
if not show_item:
|
||||
if debug:
|
||||
print('DEBUG: item not valid in profile posts: ' +
|
||||
str(item))
|
||||
continue
|
||||
|
||||
profile_str += \
|
||||
|
|
|
@ -518,7 +518,7 @@ def html_search(translate: {}, base_dir: str, path: str, domain: str,
|
|||
print('EX: html_search unable to save cached hashtag swarm ' +
|
||||
cached_hashtag_swarm_filename)
|
||||
|
||||
follow_str += ' <p class="hashtagswarm">' + swarm_str + '</p>\n'
|
||||
follow_str += ' <p class="hashtagswarm">' + swarm_str + '</p><br>\n'
|
||||
follow_str += ' </center>\n'
|
||||
follow_str += ' </div>\n'
|
||||
follow_str += '</div>\n'
|
||||
|
|
Loading…
Reference in New Issue