#!/usr/bin/env python3
# Minimal HTTPS-capable static server for poc.html.
#
# Web Serial requires a secure context. Either:
#   (a) serve over plain HTTP and launch Chrome with
#       --unsafely-treat-insecure-origin-as-secure=http://localhost:8080
#   (b) or generate a self-signed cert and uncomment the TLS block below.
import http.server
import socketserver
import os

os.chdir(os.path.dirname(os.path.abspath(__file__)))
PORT = 8080

class H(http.server.SimpleHTTPRequestHandler):
    def end_headers(self):
        self.send_header('Cache-Control', 'no-store')
        super().end_headers()

with socketserver.TCPServer(('', PORT), H) as httpd:
    print(f'serving on http://localhost:{PORT}/poc.html')
    httpd.serve_forever()
