typing to know what returns and needs to be passed, styling fix
This commit is contained in:
@@ -31,7 +31,7 @@ def get_html_files(directory=HTML_DIR):
|
||||
return html_files
|
||||
|
||||
|
||||
def build_index_page():
|
||||
def build_index_page() -> str:
|
||||
with open(BASE_FILE, "r", encoding="utf-8") as f:
|
||||
base_html = f.read()
|
||||
|
||||
@@ -80,7 +80,7 @@ H2_CANDIDATES = [h for h in hash_list if h != H1]
|
||||
H2 = random.choice(H2_CANDIDATES) if H2_CANDIDATES else H1
|
||||
|
||||
# cahcing was a bad, idea, servertime got stuck. it is now a variable ;)
|
||||
def index_footer():
|
||||
def index_footer() -> str:
|
||||
tor_link = "http://7uhuxits7qfmiagkmpazxvh3rtk6aijs6pbawge3fl77y4xqjixlhkqd.onion/"
|
||||
return f"""
|
||||
<!-- Footer styling doesnt need to work with
|
||||
@@ -107,7 +107,7 @@ def index_footer():
|
||||
</div>
|
||||
"""
|
||||
|
||||
class MyHandler(BaseHTTPRequestHandler):
|
||||
class WebServerHTTPRequestHandler(BaseHTTPRequestHandler):
|
||||
# This is a Helper Function for the POST Endpoints
|
||||
def _parse_post_data(self):
|
||||
"""Parse POST request body"""
|
||||
@@ -331,7 +331,7 @@ if __name__ == "__main__":
|
||||
logger.log_debug("Started PyPost.py in background watcher thread.")
|
||||
|
||||
server_address = ("localhost", 8000)
|
||||
httpd: HTTPServer = HTTPServer(server_address, MyHandler) # type: ignore[arg-type]
|
||||
httpd: HTTPServer = HTTPServer(server_address, WebServerHTTPRequestHandler) # type: ignore[arg-type]
|
||||
logger.log_info(f"Serving on http://{server_address[0]}:{server_address[1]}")
|
||||
httpd.serve_forever()
|
||||
except (Exception, KeyboardInterrupt) as e:
|
||||
|
||||
Reference in New Issue
Block a user