File size: 1,245 Bytes
10f2308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html>
<head>
    <title>Void City Admin</title>
    <style>
        body { background: #222; color: white; font-family: sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; }
        button { padding: 20px 40px; font-size: 24px; margin: 10px; cursor: pointer; border: none; border-radius: 5px; }
        .start { background: #2ecc71; color: white; }
        .stop { background: #e74c3c; color: white; }
    </style>
    <script src="https://cdn.socket.io/4.7.4/socket.io.min.js"></script>
</head>
<body>
    <h1>Admin Control Panel</h1>
    <button class="start" onclick="send('start_tournament')">Start Tournament</button>
    <button class="stop" onclick="send('stop_tournament')">Stop & Show Results</button>
    
    <script>
        // Use the same token as the client for simplicity in this MVP
        // In prod, you'd want a separate admin auth mechanism
        const token = sessionStorage.getItem('game_token');
        const socket = io({ auth: { token: token } });
        
        function send(cmd) {
            if(confirm("Are you sure?")) {
                socket.emit('admin_cmd', { cmd: cmd });
            }
        }
    </script>
</body>
</html>