24 lines
801 B
Python
Executable File
24 lines
801 B
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2026 Dominic Masters
|
|
#
|
|
# This software is released under the MIT License.
|
|
# https://opensource.org/licenses/MIT
|
|
|
|
import argparse
|
|
import functools
|
|
import http.server
|
|
import os
|
|
|
|
EDITOR_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor")
|
|
|
|
parser = argparse.ArgumentParser(description="Dusk editor tools server")
|
|
parser.add_argument("--host", default="localhost", help="Host to bind to")
|
|
parser.add_argument("--port", type=int, default=3000, help="Port to listen on")
|
|
args = parser.parse_args()
|
|
|
|
handler = functools.partial(http.server.SimpleHTTPRequestHandler, directory=EDITOR_DIR)
|
|
|
|
with http.server.HTTPServer((args.host, args.port), handler) as server:
|
|
print(f"Dusk editor tools: http://{args.host}:{args.port}/")
|
|
server.serve_forever()
|