Start Möglichkeiten und Apassungen an die neuen Domains

This commit is contained in:
Daniel Nagel 2026-01-06 17:52:48 +01:00
parent 83d3569f45
commit 900bc56c13
6 changed files with 86 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

21
START_Linux.sh Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
PORT=8000
BASE="http://localhost:${PORT}"
python3 server.py &
SERVER_PID=$!
cleanup() {
kill "$SERVER_PID" 2>/dev/null || true
}
trap cleanup EXIT
sleep 0.5
# Default-Browser öffnen (meist Tabs)
xdg-open "${BASE}/index.html" >/dev/null 2>&1 || true
xdg-open "${BASE}/spieler.html" >/dev/null 2>&1 || true
wait "$SERVER_PID"

14
START_Win.ps1 Normal file
View File

@ -0,0 +1,14 @@
$Port = 8000
$Base = "http://localhost:$Port"
# Server starten
$server = Start-Process -PassThru -NoNewWindow python "server.py"
Start-Sleep -Milliseconds 500
# Öffnet im Standardbrowser
Start-Process "$Base/index.html"
Start-Process "$Base/spieler.html"
Write-Host "Server läuft (PID $($server.Id)). Zum Beenden: Fenster schließen oder Prozess killen."
Wait-Process -Id $server.Id

View File

@ -54,7 +54,7 @@
<canvas id="mapCanvas"></canvas> <canvas id="mapCanvas"></canvas>
<iframe id="worldmap-iframe" <iframe id="worldmap-iframe"
src="https://map.arenos.danielnagel.at" src="https://map.arenos.online"
style="display: none; position: absolute; top: 0; left: 0; width: 100%; height: calc(100% - 130px); z-index: 8000; border: none;"> style="display: none; position: absolute; top: 0; left: 0; width: 100%; height: calc(100% - 130px); z-index: 8000; border: none;">
</iframe> </iframe>

49
server.py Normal file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env python3
import json
import os
from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
from urllib.parse import urlparse, unquote
MAPS_DIR = "maps"
ALLOWED_EXT = {".png", ".jpg", ".jpeg", ".webp", ".gif"}
class Handler(SimpleHTTPRequestHandler):
def do_GET(self):
parsed = urlparse(self.path)
# API: list maps (used by index.html)
if parsed.path == "/list-maps":
self._handle_list_maps()
return
# Convenience: "/" -> "/index.html"
if parsed.path == "/":
self.path = "/index.html"
super().do_GET()
def _handle_list_maps(self):
maps = []
if os.path.isdir(MAPS_DIR):
for name in sorted(os.listdir(MAPS_DIR)):
p = os.path.join(MAPS_DIR, name)
ext = os.path.splitext(name)[1].lower()
if os.path.isfile(p) and ext in ALLOWED_EXT:
maps.append(f"{MAPS_DIR}/{name}")
data = json.dumps(maps).encode("utf-8")
self.send_response(200)
self.send_header("Content-Type", "application/json; charset=utf-8")
self.send_header("Content-Length", str(len(data)))
self.end_headers()
self.wfile.write(data)
def main():
host = "0.0.0.0"
port = 8000
httpd = ThreadingHTTPServer((host, port), Handler)
print(f"Serving on http://{host}:{port}")
httpd.serve_forever()
if __name__ == "__main__":
main()

View File

@ -26,7 +26,7 @@
<script src="slave.js"></script> <script src="slave.js"></script>
<iframe id="worldmap-iframe" <iframe id="worldmap-iframe"
src="https://map.arenos.danielnagel.at" src="https://map.arenos.online"
style="display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 9000; border: none;"> style="display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 9000; border: none;">
</iframe> </iframe>