Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/mojzis/pronounce.
Something went wrong. Try again.
1234567891011121314151617181920#!/usr/bin/env python3import http.serverimport sslimport osfrom pathlib import Path
# Generate self-signed certificate if it doesn't existcert_file = 'localhost.pem'if not os.path.exists(cert_file): print("Generating self-signed certificate...") os.system(f'openssl req -new -x509 -keyout {cert_file} -out {cert_file} -days 365 -nodes -subj "/CN=localhost"')
PORT = 8000httpd = http.server.HTTPServer(('localhost', PORT), http.server.SimpleHTTPRequestHandler)httpd.socket = ssl.wrap_socket(httpd.socket, certfile=cert_file, server_side=True)
print(f"Serving HTTPS on https://localhost:{PORT}")print("You'll need to click 'Advanced' -> 'Proceed to localhost' in Chrome")httpd.serve_forever()