You've already forked torvalds-GuitarPedal
mirror of
https://github.com/torvalds/GuitarPedal.git
synced 2026-06-25 14:07:56 +00:00
This moves the .gitignore file into the parent directory, and the python web server script into the scripts directory. This is prep-work for exposing the web interface as a 'Progressive Web App', and just making the WebMIDI directory contents be the GitHub Pages thing that can then be used as-is on the phone. So let's just get rid of anything that isn't directly about just that PWA infrastructure. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
26 lines
677 B
Python
Executable File
26 lines
677 B
Python
Executable File
#!/usr/bin/env python3
|
|
import http.server
|
|
import socketserver
|
|
import sys
|
|
|
|
PORT = 8080
|
|
|
|
class Handler(http.server.SimpleHTTPRequestHandler):
|
|
# Optionally add headers for Web MIDI or Cross-Origin policies if needed in future
|
|
def end_headers(self):
|
|
super().end_headers()
|
|
|
|
if len(sys.argv) > 1:
|
|
try:
|
|
PORT = int(sys.argv[1])
|
|
except ValueError:
|
|
pass
|
|
|
|
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
|
print(f"Serving at http://localhost:{PORT}")
|
|
print("Use this URL in your Web-MIDI capable browser (like Chrome).")
|
|
try:
|
|
httpd.serve_forever()
|
|
except KeyboardInterrupt:
|
|
print("\nShutting down server.")
|