Spaces:
Paused
Paused
File size: 1,795 Bytes
f47a95c 135ebc5 f47a95c 135ebc5 f47a95c be47c3c 135ebc5 f47a95c 135ebc5 f47a95c 135ebc5 f47a95c 135ebc5 f47a95c f52658a 135ebc5 f47a95c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #!/usr/bin/env python3
"""
HTTP status server — required by Hugging Face Spaces.
HF expects a response on port 7860, otherwise it marks the Space as crashed.
This runs alongside the Minecraft server.
"""
import http.server
import socketserver
import threading
import os
PORT = 7860
HTML = """<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Minecraft Server — THEZYZSTUDIO</title>
<style>
body { background: #1a1a2e; color: #e0e0e0; font-family: monospace;
display: flex; align-items: center; justify-content: center;
height: 100vh; margin: 0; }
.box { text-align: center; border: 1px solid #00ff88;
padding: 2rem 3rem; border-radius: 8px; }
h1 { color: #00ff88; font-size: 2rem; margin-bottom: 0.5rem; }
p { color: #aaa; }
.port { color: #ffcc00; font-size: 1.2rem; }
</style>
</head>
<body>
<div class="box">
<h1>🎮 Minecraft Server</h1>
<p>THEZYZSTUDIO — The Z AI Agent</p>
<p>Server is running on</p>
<p class="port">TCP Port 25565</p>
<p style="font-size:0.8rem;margin-top:1rem;color:#666;">
Use playit.gg or ngrok to connect externally
</p>
</div>
</body>
</html>
"""
class Handler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
self.end_headers()
self.wfile.write(HTML.encode())
def log_message(self, format, *args):
pass # suppress access logs
def run():
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print(f"[HTTP] Status page running on port {PORT}", flush=True)
httpd.serve_forever()
if __name__ == "__main__":
t = threading.Thread(target=run, daemon=True)
t.start()
t.join()
|