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.onion_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: | ||||
|             origin_path_str = 'http://' + onion_domain + users_path | ||||
|         elif (calling_domain.endswith('.i2p') and i2p_domain): | ||||
|  | @ -20864,6 +20900,7 @@ def run_daemon(preferred_podcast_formats: [], | |||
|         'snoozeButton': 's', | ||||
|         'reportButton': '[', | ||||
|         'viewButton': 'v', | ||||
|         'unblockButton': 'u', | ||||
|         'enterPetname': 'p', | ||||
|         'enterNotes': 'n', | ||||
|         'menuTimeline': 't', | ||||
|  | @ -20881,7 +20918,7 @@ def run_daemon(preferred_podcast_formats: [], | |||
|         'menuShares': 'h', | ||||
|         'menuWanted': 'w', | ||||
|         'menuBlogs': 'b', | ||||
|         'menuNewswire': 'u', | ||||
|         'menuNewswire': '#', | ||||
|         'menuLinks': 'l', | ||||
|         'menuMedia': 'm', | ||||
|         'menuModeration': 'o', | ||||
|  |  | |||
|  | @ -74,6 +74,7 @@ from blog import get_blog_address | |||
| from webapp_post import individual_post_as_html | ||||
| from webapp_timeline import html_individual_share | ||||
| from blocking import get_cw_list_variable | ||||
| from blocking import is_blocked | ||||
| from content import bold_reading_string | ||||
| 
 | ||||
| THEME_FORMATS = '.zip, .gz' | ||||
|  | @ -307,6 +308,9 @@ def html_profile_after_search(css_cache: {}, | |||
|         # don't follow yourself! | ||||
|         follow_is_permitted = False | ||||
| 
 | ||||
|     blocked = \ | ||||
|         is_blocked(base_dir, nickname, domain, search_nickname, search_domain) | ||||
| 
 | ||||
|     if follow_is_permitted: | ||||
|         follow_str = 'Follow' | ||||
|         if is_group: | ||||
|  | @ -316,15 +320,24 @@ def html_profile_after_search(css_cache: {}, | |||
|             '<div class="container">\n' + \ | ||||
|             '  <form method="POST" action="' + \ | ||||
|             back_url + '/followconfirm">\n' + \ | ||||
|             '    <center>\n' + \ | ||||
|             '    <center>\n' | ||||
|         profile_str += \ | ||||
|             '      <input type="hidden" name="actor" value="' + \ | ||||
|             person_url + '">\n' + \ | ||||
|             '      <button type="submit" class="button" name="submitYes" ' + \ | ||||
|             'accesskey="' + access_keys['followButton'] + '">' + \ | ||||
|             translate[follow_str] + '</button>\n' + \ | ||||
|             translate[follow_str] + '</button>\n' | ||||
|         profile_str += \ | ||||
|             '      <button type="submit" class="button" name="submitView" ' + \ | ||||
|             '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' + \ | ||||
|             '  </form>\n' + \ | ||||
|             '</div>\n' | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue