diff --git a/web-client/start_server.py b/web-client/start_server.py index 4f1b71e..d54b55e 100755 --- a/web-client/start_server.py +++ b/web-client/start_server.py @@ -60,15 +60,16 @@ class AuthHandler(http.server.SimpleHTTPRequestHandler): self.send_header('Content-type', 'text/html; charset=utf-8') self.end_headers() - self.wfile.write(b''' + html = ''' 401 Unauthorized -

šŸ” Wyoming Satellite — Authentication Required

+

Wyoming Satellite - Authentication Required

Please enter the password to access the Web UI.

- ''') + ''' + self.wfile.write(html.encode('utf-8')) def do_GET(self): """Handle GET requests with authentication.""" @@ -111,45 +112,50 @@ def main(): # Create handler with password Handler = create_auth_handler(args.password) - print(f""" -╔══════════════════════════════════════════════════════════╗ -ā•‘ šŸ›°ļø Wyoming Satellite WebSocket Client Server ā•‘ -╠══════════════════════════════════════════════════════════╣ -ā•‘ Serving: {str(SCRIPT_DIR):<45} ā•‘ -ā•‘ URL: http://localhost:{args.port:<36} ā•‘ -ā•‘ Remote: http://:{args.port:<32} ā•‘ -ā•‘ Password: {'*' * len(args.password):<45} ā•‘ -ā•‘ ā•‘ -ā•‘ Press Ctrl+C to stop ā•‘ -ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• - """) + print(""" ++==========================================================+ +| Wyoming Satellite WebSocket Client Server | ++==========================================================+ +| Serving: {:<53} | +| URL: http://localhost:{:<29} | +| Remote: http://:{:<25} | +| Password: {:<48} | +| | +| Press Ctrl+C to stop | ++==========================================================+ + """.format( + str(SCRIPT_DIR), + args.port, + args.port, + '*' * len(args.password) + )) try: with ReusableTCPServer((args.host, args.port), Handler) as httpd: - print(f"šŸš€ Server started on http://{args.host}:{args.port}") - print("šŸ“– Serving files from:", SCRIPT_DIR) - print(f"šŸ” Password protected ({len(args.password)} characters)") - print("\nāŒØļø Press Ctrl+C to stop\n") + print(f"Server started on http://{args.host}:{args.port}") + print("Serving files from:", SCRIPT_DIR) + print(f"Password protected ({len(args.password)} characters)") + print("\nPress Ctrl+C to stop\n") try: httpd.serve_forever() except KeyboardInterrupt: - print("\nšŸ‘‹ Shutting down gracefully...") + print("\nShutting down gracefully...") # Shutdown in a separate thread to avoid deadlock shutdown_thread = threading.Thread(target=httpd.shutdown) shutdown_thread.start() shutdown_thread.join(timeout=2) httpd.server_close() - print("āœ… Server stopped successfully") + print("Server stopped successfully") except OSError as e: - print(f"\nāŒ Error: Could not bind to port {args.port}") + print(f"\nError: Could not bind to port {args.port}") print(f" {e}") - print("\nšŸ’” Try using a different port:") + print("\nTry using a different port:") print(f" python3 {sys.argv[0]} --port 8081\n") sys.exit(1) except Exception as e: - print(f"\nāŒ Unexpected error: {e}") + print(f"\nUnexpected error: {e}") sys.exit(1)