this should work. added some icons and some more

This commit is contained in:
2025-09-23 09:57:44 +02:00
parent b668eb3d77
commit 32fc4dc119
14 changed files with 290 additions and 185 deletions

View File

@@ -6,6 +6,8 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
import mimetypes
from jsmin import jsmin # pip install jsmin
from log.Logger import *
logger = Logger()
import PyPost
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
@@ -82,7 +84,7 @@ class MyHandler(BaseHTTPRequestHandler):
try:
content = jsmin(content.decode("utf-8")).encode("utf-8")
except Exception as e:
print(f"Error minifying JS file {file_path}: {e}")
logger.log_error(f"Error minifying JS file {file_path}: {e}")
self.send_response(200)
self.send_header("Content-type", mime_type)
@@ -100,11 +102,15 @@ def run_pypost():
subprocess.run([sys.executable, script])
if __name__ == "__main__":
threading.Thread(target=run_pypost, daemon=True).start()
print("Started PyPost.py in background watcher thread.")
try:
threading.Thread(target=run_pypost, daemon=True).start()
logger.log_debug("Started PyPost.py in background watcher thread.")
server_address = ("localhost", 8000)
httpd = HTTPServer(server_address, MyHandler)
print("Serving on http://localhost:8000")
httpd.serve_forever()
server_address = ("localhost", 8000)
httpd = HTTPServer(server_address, MyHandler)
logger.log_info(f"Serving on http://{server_address[0]}:{server_address[1]}")
httpd.serve_forever()
except (Exception, KeyboardInterrupt) as e:
logger.log_info(f"Shutting down server.\n Reason: {e}")
httpd.server_close()