mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Number of books shown on profile screens is a variable
							parent
							
								
									f1220b8497
								
							
						
					
					
						commit
						6f26b46b68
					
				
							
								
								
									
										33
									
								
								daemon.py
								
								
								
								
							
							
						
						
									
										33
									
								
								daemon.py
								
								
								
								
							| 
						 | 
				
			
			@ -3507,7 +3507,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                          self.server.dogwhistles,
 | 
			
		||||
                                          min_images_for_accounts,
 | 
			
		||||
                                          self.server.buy_sites,
 | 
			
		||||
                                          max_shares_on_profile)
 | 
			
		||||
                                          max_shares_on_profile,
 | 
			
		||||
                                          self.server.no_of_books)
 | 
			
		||||
            if profile_str:
 | 
			
		||||
                msg = profile_str.encode('utf-8')
 | 
			
		||||
                msglen = len(msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -5147,7 +5148,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                                  self.server.dogwhistles,
 | 
			
		||||
                                                  min_images_for_accounts,
 | 
			
		||||
                                                  self.server.buy_sites,
 | 
			
		||||
                                                  max_shares_on_profile)
 | 
			
		||||
                                                  max_shares_on_profile,
 | 
			
		||||
                                                  self.server.no_of_books)
 | 
			
		||||
                if profile_str:
 | 
			
		||||
                    msg = profile_str.encode('utf-8')
 | 
			
		||||
                    msglen = len(msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -12625,7 +12627,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                     timezone, bold_reading,
 | 
			
		||||
                                     self.server.buy_sites, None,
 | 
			
		||||
                                     self.server.max_shares_on_profile,
 | 
			
		||||
                                     self.server.sites_unavailable)
 | 
			
		||||
                                     self.server.sites_unavailable,
 | 
			
		||||
                                     self.server.no_of_books)
 | 
			
		||||
                    msg = msg.encode('utf-8')
 | 
			
		||||
                    msglen = len(msg)
 | 
			
		||||
                    self._set_headers('text/html', msglen,
 | 
			
		||||
| 
						 | 
				
			
			@ -12757,7 +12760,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                                 self.server.buy_sites,
 | 
			
		||||
                                                 None,
 | 
			
		||||
                                                 max_shares_on_profile,
 | 
			
		||||
                                                 self.server.sites_unavailable)
 | 
			
		||||
                                                 self.server.sites_unavailable,
 | 
			
		||||
                                                 self.server.no_of_books)
 | 
			
		||||
                                msg = msg.encode('utf-8')
 | 
			
		||||
                                msglen = len(msg)
 | 
			
		||||
                                self._set_headers('text/html', msglen,
 | 
			
		||||
| 
						 | 
				
			
			@ -15408,7 +15412,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                     self.server.buy_sites,
 | 
			
		||||
                                     None,
 | 
			
		||||
                                     self.server.max_shares_on_profile,
 | 
			
		||||
                                     self.server.sites_unavailable)
 | 
			
		||||
                                     self.server.sites_unavailable,
 | 
			
		||||
                                     self.server.no_of_books)
 | 
			
		||||
                    msg = msg.encode('utf-8')
 | 
			
		||||
                    msglen = len(msg)
 | 
			
		||||
                    self._set_headers('text/html', msglen,
 | 
			
		||||
| 
						 | 
				
			
			@ -15561,7 +15566,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                     self.server.buy_sites,
 | 
			
		||||
                                     None,
 | 
			
		||||
                                     max_shares_on_profile,
 | 
			
		||||
                                     sites_unavailable).encode('utf-8')
 | 
			
		||||
                                     sites_unavailable,
 | 
			
		||||
                                     self.server.no_of_books).encode('utf-8')
 | 
			
		||||
                    msglen = len(msg)
 | 
			
		||||
                    self._set_headers('text/html',
 | 
			
		||||
                                      msglen, cookie, calling_domain, False)
 | 
			
		||||
| 
						 | 
				
			
			@ -15713,7 +15719,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                     self.server.buy_sites,
 | 
			
		||||
                                     None,
 | 
			
		||||
                                     max_shares_on_profile,
 | 
			
		||||
                                     sites_unavailable).encode('utf-8')
 | 
			
		||||
                                     sites_unavailable,
 | 
			
		||||
                                     self.server.no_of_books).encode('utf-8')
 | 
			
		||||
                    msglen = len(msg)
 | 
			
		||||
                    self._set_headers('text/html',
 | 
			
		||||
                                      msglen, cookie, calling_domain, False)
 | 
			
		||||
| 
						 | 
				
			
			@ -15863,7 +15870,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                     self.server.buy_sites,
 | 
			
		||||
                                     None,
 | 
			
		||||
                                     max_shares_on_profile,
 | 
			
		||||
                                     sites_unavailable).encode('utf-8')
 | 
			
		||||
                                     sites_unavailable,
 | 
			
		||||
                                     self.server.no_of_books).encode('utf-8')
 | 
			
		||||
                    msglen = len(msg)
 | 
			
		||||
                    self._set_headers('text/html',
 | 
			
		||||
                                      msglen, cookie, calling_domain, False)
 | 
			
		||||
| 
						 | 
				
			
			@ -16015,7 +16023,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                     self.server.buy_sites,
 | 
			
		||||
                                     None,
 | 
			
		||||
                                     max_shares_on_profile,
 | 
			
		||||
                                     sites_unavailable).encode('utf-8')
 | 
			
		||||
                                     sites_unavailable,
 | 
			
		||||
                                     self.server.no_of_books).encode('utf-8')
 | 
			
		||||
                    msglen = len(msg)
 | 
			
		||||
                    self._set_headers('text/html', msglen,
 | 
			
		||||
                                      cookie, calling_domain, False)
 | 
			
		||||
| 
						 | 
				
			
			@ -16197,7 +16206,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                             self.server.buy_sites,
 | 
			
		||||
                             None,
 | 
			
		||||
                             max_shares_on_profile,
 | 
			
		||||
                             sites_unavailable).encode('utf-8')
 | 
			
		||||
                             sites_unavailable,
 | 
			
		||||
                             self.server.no_of_books).encode('utf-8')
 | 
			
		||||
            msglen = len(msg)
 | 
			
		||||
            self._set_headers('text/html', msglen,
 | 
			
		||||
                              cookie, calling_domain, False)
 | 
			
		||||
| 
						 | 
				
			
			@ -24182,6 +24192,9 @@ def run_daemon(public_replies_unlisted: int,
 | 
			
		|||
 | 
			
		||||
    httpd.starting_daemon = True
 | 
			
		||||
 | 
			
		||||
    # number of book events which show on profile screens
 | 
			
		||||
    httpd.no_of_books = 10
 | 
			
		||||
 | 
			
		||||
    # list of websites which are currently down
 | 
			
		||||
    httpd.sites_unavailable = load_unavailable_sites(base_dir)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -208,7 +208,8 @@ def html_profile_after_search(authorized: bool,
 | 
			
		|||
                              bold_reading: bool, dogwhistles: {},
 | 
			
		||||
                              min_images_for_accounts: [],
 | 
			
		||||
                              buy_sites: {},
 | 
			
		||||
                              max_shares_on_profile: int) -> str:
 | 
			
		||||
                              max_shares_on_profile: int,
 | 
			
		||||
                              no_of_books: int) -> str:
 | 
			
		||||
    """Show a profile page after a search for a fediverse address
 | 
			
		||||
    """
 | 
			
		||||
    http = False
 | 
			
		||||
| 
						 | 
				
			
			@ -399,7 +400,7 @@ def html_profile_after_search(authorized: bool,
 | 
			
		|||
                                         website_url, repo_url,
 | 
			
		||||
                                         send_blocks_str,
 | 
			
		||||
                                         authorized,
 | 
			
		||||
                                         person_url)
 | 
			
		||||
                                         person_url, no_of_books)
 | 
			
		||||
 | 
			
		||||
    domain_full = get_full_domain(domain, port)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -583,7 +584,8 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
 | 
			
		|||
                        joined_date: str,
 | 
			
		||||
                        occupation_name: str,
 | 
			
		||||
                        actor_proxied: str,
 | 
			
		||||
                        person_url: str) -> str:
 | 
			
		||||
                        person_url: str,
 | 
			
		||||
                        no_of_books: int) -> str:
 | 
			
		||||
    """The header of the profile screen, containing background
 | 
			
		||||
    image and avatar
 | 
			
		||||
    """
 | 
			
		||||
| 
						 | 
				
			
			@ -713,7 +715,8 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
 | 
			
		|||
        '    </figure>\n\n'
 | 
			
		||||
 | 
			
		||||
    # book events for this actor
 | 
			
		||||
    html_str += html_profile_book_list(base_dir, person_url, 5, translate)
 | 
			
		||||
    html_str += html_profile_book_list(base_dir, person_url, no_of_books,
 | 
			
		||||
                                       translate)
 | 
			
		||||
    return html_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -739,7 +742,8 @@ def _get_profile_header_after_search(base_dir: str,
 | 
			
		|||
                                     repo_url: str,
 | 
			
		||||
                                     send_blocks_str: str,
 | 
			
		||||
                                     authorized: bool,
 | 
			
		||||
                                     person_url: str) -> str:
 | 
			
		||||
                                     person_url: str,
 | 
			
		||||
                                     no_of_books: str) -> str:
 | 
			
		||||
    """The header of a searched for handle, containing background
 | 
			
		||||
    image and avatar
 | 
			
		||||
    """
 | 
			
		||||
| 
						 | 
				
			
			@ -865,7 +869,8 @@ def _get_profile_header_after_search(base_dir: str,
 | 
			
		|||
            _profile_shared_items_list(attached_shared_items,
 | 
			
		||||
                                       translate)
 | 
			
		||||
    # book events for this actor
 | 
			
		||||
    html_str += html_profile_book_list(base_dir, person_url, 5, translate)
 | 
			
		||||
    html_str += html_profile_book_list(base_dir, person_url, no_of_books,
 | 
			
		||||
                                       translate)
 | 
			
		||||
 | 
			
		||||
    return html_str
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -897,7 +902,8 @@ def html_profile(signing_priv_key_pem: str,
 | 
			
		|||
                 buy_sites: {},
 | 
			
		||||
                 actor_proxied: str,
 | 
			
		||||
                 max_shares_on_profile: int,
 | 
			
		||||
                 sites_unavailable: []) -> str:
 | 
			
		||||
                 sites_unavailable: [],
 | 
			
		||||
                 no_of_books: int) -> str:
 | 
			
		||||
    """Show the profile page as html
 | 
			
		||||
    """
 | 
			
		||||
    show_moved_accounts = False
 | 
			
		||||
| 
						 | 
				
			
			@ -1257,7 +1263,8 @@ def html_profile(signing_priv_key_pem: str,
 | 
			
		|||
                            attached_shared_items,
 | 
			
		||||
                            access_keys, joined_date,
 | 
			
		||||
                            occupation_name,
 | 
			
		||||
                            actor_proxied, actor)
 | 
			
		||||
                            actor_proxied, actor,
 | 
			
		||||
                            no_of_books)
 | 
			
		||||
 | 
			
		||||
    # keyboard navigation
 | 
			
		||||
    user_path_str = '/users/' + nickname
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue