THEZYZSTUDIO commited on
Commit
bd4c724
·
verified ·
1 Parent(s): 7a309e7

Create status_server.py

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