| 
									
										
										
										
											2024-03-04 13:35:26 +00:00
										 |  |  | __filename__ = "daemon_get_links.py" | 
					
						
							|  |  |  | __author__ = "Bob Mottram" | 
					
						
							|  |  |  | __license__ = "AGPL3+" | 
					
						
							|  |  |  | __version__ = "1.5.0" | 
					
						
							|  |  |  | __maintainer__ = "Bob Mottram" | 
					
						
							|  |  |  | __email__ = "bob@libreserver.org" | 
					
						
							|  |  |  | __status__ = "Production" | 
					
						
							| 
									
										
										
										
											2024-03-23 15:11:05 +00:00
										 |  |  | __module_group__ = "Core GET" | 
					
						
							| 
									
										
										
										
											2024-03-04 13:35:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | from webapp_column_left import html_edit_links | 
					
						
							|  |  |  | from httpheaders import set_headers | 
					
						
							|  |  |  | from httpcodes import write2 | 
					
						
							|  |  |  | from httpcodes import http_404 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def edit_links2(self, calling_domain: str, path: str, | 
					
						
							|  |  |  |                 translate: {}, base_dir: str, | 
					
						
							| 
									
										
										
										
											2024-04-10 09:23:49 +00:00
										 |  |  |                 domain: str, cookie: str, theme: str, | 
					
						
							|  |  |  |                 access_keys: {}, key_shortcuts: {}, | 
					
						
							|  |  |  |                 default_timeline: str) -> bool: | 
					
						
							| 
									
										
										
										
											2024-03-04 13:35:26 +00:00
										 |  |  |     """Show the links from the left column
 | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     if '/users/' in path and path.endswith('/editlinks'): | 
					
						
							|  |  |  |         nickname = path.split('/users/')[1] | 
					
						
							|  |  |  |         if '/' in nickname: | 
					
						
							|  |  |  |             nickname = nickname.split('/')[0] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-10 09:23:49 +00:00
										 |  |  |         if key_shortcuts.get(nickname): | 
					
						
							|  |  |  |             access_keys = key_shortcuts[nickname] | 
					
						
							| 
									
										
										
										
											2024-03-04 13:35:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         msg = html_edit_links(translate, | 
					
						
							|  |  |  |                               base_dir, | 
					
						
							|  |  |  |                               path, domain, | 
					
						
							| 
									
										
										
										
											2024-04-10 09:23:49 +00:00
										 |  |  |                               default_timeline, | 
					
						
							| 
									
										
										
										
											2024-03-04 13:35:26 +00:00
										 |  |  |                               theme, access_keys) | 
					
						
							|  |  |  |         if msg: | 
					
						
							|  |  |  |             msg = msg.encode('utf-8') | 
					
						
							|  |  |  |             msglen = len(msg) | 
					
						
							|  |  |  |             set_headers(self, 'text/html', msglen, | 
					
						
							|  |  |  |                         cookie, calling_domain, False) | 
					
						
							|  |  |  |             write2(self, msg) | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             http_404(self, 106) | 
					
						
							|  |  |  |         return True | 
					
						
							|  |  |  |     return False |