mirror of https://gitlab.com/bashrc2/epicyon
Unblock button on profile after search
parent
b44cc575ba
commit
c20df95b54
39
daemon.py
39
daemon.py
|
@ -3503,6 +3503,42 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.onion_domain,
|
self.server.onion_domain,
|
||||||
self.server.i2p_domain)
|
self.server.i2p_domain)
|
||||||
|
|
||||||
|
if '&submitUnblock=' in follow_confirm_params:
|
||||||
|
blocking_actor = \
|
||||||
|
urllib.parse.unquote_plus(follow_confirm_params)
|
||||||
|
blocking_actor = blocking_actor.split('actor=')[1]
|
||||||
|
if '&' in blocking_actor:
|
||||||
|
blocking_actor = blocking_actor.split('&')[0]
|
||||||
|
blocking_nickname = get_nickname_from_actor(blocking_actor)
|
||||||
|
if not blocking_nickname:
|
||||||
|
if calling_domain.endswith('.onion') and onion_domain:
|
||||||
|
origin_path_str = 'http://' + onion_domain + users_path
|
||||||
|
elif (calling_domain.endswith('.i2p') and i2p_domain):
|
||||||
|
origin_path_str = 'http://' + i2p_domain + users_path
|
||||||
|
print('WARN: unable to find blocked nickname in ' +
|
||||||
|
blocking_actor)
|
||||||
|
self._redirect_headers(origin_path_str,
|
||||||
|
cookie, calling_domain)
|
||||||
|
self.server.postreq_busy = False
|
||||||
|
return
|
||||||
|
blocking_domain, blocking_port = \
|
||||||
|
get_domain_from_actor(blocking_actor)
|
||||||
|
blocking_domain_full = \
|
||||||
|
get_full_domain(blocking_domain, blocking_port)
|
||||||
|
if follower_nickname == blocking_nickname and \
|
||||||
|
blocking_domain == domain and \
|
||||||
|
blocking_port == port:
|
||||||
|
if debug:
|
||||||
|
print('You cannot unblock yourself!')
|
||||||
|
else:
|
||||||
|
if debug:
|
||||||
|
print(follower_nickname + ' stops blocking ' +
|
||||||
|
blocking_actor)
|
||||||
|
remove_block(base_dir,
|
||||||
|
follower_nickname, domain,
|
||||||
|
blocking_nickname, blocking_domain_full)
|
||||||
|
|
||||||
if calling_domain.endswith('.onion') and onion_domain:
|
if calling_domain.endswith('.onion') and onion_domain:
|
||||||
origin_path_str = 'http://' + onion_domain + users_path
|
origin_path_str = 'http://' + onion_domain + users_path
|
||||||
elif (calling_domain.endswith('.i2p') and i2p_domain):
|
elif (calling_domain.endswith('.i2p') and i2p_domain):
|
||||||
|
@ -20864,6 +20900,7 @@ def run_daemon(preferred_podcast_formats: [],
|
||||||
'snoozeButton': 's',
|
'snoozeButton': 's',
|
||||||
'reportButton': '[',
|
'reportButton': '[',
|
||||||
'viewButton': 'v',
|
'viewButton': 'v',
|
||||||
|
'unblockButton': 'u',
|
||||||
'enterPetname': 'p',
|
'enterPetname': 'p',
|
||||||
'enterNotes': 'n',
|
'enterNotes': 'n',
|
||||||
'menuTimeline': 't',
|
'menuTimeline': 't',
|
||||||
|
@ -20881,7 +20918,7 @@ def run_daemon(preferred_podcast_formats: [],
|
||||||
'menuShares': 'h',
|
'menuShares': 'h',
|
||||||
'menuWanted': 'w',
|
'menuWanted': 'w',
|
||||||
'menuBlogs': 'b',
|
'menuBlogs': 'b',
|
||||||
'menuNewswire': 'u',
|
'menuNewswire': '#',
|
||||||
'menuLinks': 'l',
|
'menuLinks': 'l',
|
||||||
'menuMedia': 'm',
|
'menuMedia': 'm',
|
||||||
'menuModeration': 'o',
|
'menuModeration': 'o',
|
||||||
|
|
|
@ -74,6 +74,7 @@ from blog import get_blog_address
|
||||||
from webapp_post import individual_post_as_html
|
from webapp_post import individual_post_as_html
|
||||||
from webapp_timeline import html_individual_share
|
from webapp_timeline import html_individual_share
|
||||||
from blocking import get_cw_list_variable
|
from blocking import get_cw_list_variable
|
||||||
|
from blocking import is_blocked
|
||||||
from content import bold_reading_string
|
from content import bold_reading_string
|
||||||
|
|
||||||
THEME_FORMATS = '.zip, .gz'
|
THEME_FORMATS = '.zip, .gz'
|
||||||
|
@ -307,6 +308,9 @@ def html_profile_after_search(css_cache: {},
|
||||||
# don't follow yourself!
|
# don't follow yourself!
|
||||||
follow_is_permitted = False
|
follow_is_permitted = False
|
||||||
|
|
||||||
|
blocked = \
|
||||||
|
is_blocked(base_dir, nickname, domain, search_nickname, search_domain)
|
||||||
|
|
||||||
if follow_is_permitted:
|
if follow_is_permitted:
|
||||||
follow_str = 'Follow'
|
follow_str = 'Follow'
|
||||||
if is_group:
|
if is_group:
|
||||||
|
@ -316,15 +320,24 @@ def html_profile_after_search(css_cache: {},
|
||||||
'<div class="container">\n' + \
|
'<div class="container">\n' + \
|
||||||
' <form method="POST" action="' + \
|
' <form method="POST" action="' + \
|
||||||
back_url + '/followconfirm">\n' + \
|
back_url + '/followconfirm">\n' + \
|
||||||
' <center>\n' + \
|
' <center>\n'
|
||||||
|
profile_str += \
|
||||||
' <input type="hidden" name="actor" value="' + \
|
' <input type="hidden" name="actor" value="' + \
|
||||||
person_url + '">\n' + \
|
person_url + '">\n' + \
|
||||||
' <button type="submit" class="button" name="submitYes" ' + \
|
' <button type="submit" class="button" name="submitYes" ' + \
|
||||||
'accesskey="' + access_keys['followButton'] + '">' + \
|
'accesskey="' + access_keys['followButton'] + '">' + \
|
||||||
translate[follow_str] + '</button>\n' + \
|
translate[follow_str] + '</button>\n'
|
||||||
|
profile_str += \
|
||||||
' <button type="submit" class="button" name="submitView" ' + \
|
' <button type="submit" class="button" name="submitView" ' + \
|
||||||
'accesskey="' + access_keys['viewButton'] + '">' + \
|
'accesskey="' + access_keys['viewButton'] + '">' + \
|
||||||
translate['View'] + '</button>\n' + \
|
translate['View'] + '</button>\n'
|
||||||
|
if blocked:
|
||||||
|
profile_str += \
|
||||||
|
' <button type="submit" ' + \
|
||||||
|
'class="button" name="submitUnblock" ' + \
|
||||||
|
'accesskey="' + access_keys['unblockButton'] + '">' + \
|
||||||
|
translate['Unblock'] + '</button>\n'
|
||||||
|
profile_str += \
|
||||||
' </center>\n' + \
|
' </center>\n' + \
|
||||||
' </form>\n' + \
|
' </form>\n' + \
|
||||||
'</div>\n'
|
'</div>\n'
|
||||||
|
|
Loading…
Reference in New Issue