bettermint commited on
Commit
8bf3378
·
verified ·
1 Parent(s): a7c7b59

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +74 -71
main.py CHANGED
@@ -131,75 +131,78 @@ async def websocket_endpoint(websocket: WebSocket, elo: str):
131
 
132
  @app.get("/")
133
  async def root(request: Request):
134
- return HTMLResponse("""<!DOCTYPE html>
135
- <html lang="en">
136
- <head>
137
- <meta charset="UTF-8">
138
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
139
- <title>Users playing now</title>
140
- <style>
141
- body {
142
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
143
- background-color: #1f1f1f;
144
- color: #f0f0f0;
145
- margin: 0;
146
- padding: 0;
147
- display: flex;
148
- justify-content: center;
149
- align-items: center;
150
- height: 100vh;
151
- text-align: center;
152
- }
153
- .container {
154
- background-color: #2d2d2d;
155
- padding: 20px;
156
- border-radius: 10px;
157
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
158
- max-width: 400px;
159
- width: 100%;
160
- margin: 20px;
161
- }
162
- h1 {
163
- color: #f0f0f0;
164
- font-size: 2.5rem;
165
- margin-bottom: 20px;
166
- }
167
- .stat {
168
- margin-bottom: 10px;
169
- display: flex;
170
- justify-content: space-between;
171
- align-items: center;
172
- padding: 10px;
173
- border-bottom: 1px solid #444;
174
- }
175
- .stat:last-child {
176
- border-bottom: none;
177
- }
178
- .stat label {
179
- font-weight: bold;
180
- font-size: 1.2rem;
181
- }
182
- .stat span {
183
- font-size: 1.2rem;
184
- }
185
- </style>
186
- </head>
187
- <body>
188
- <div class="container">
189
- <h1>Users playing now</h1>
190
- <div class="stat">
191
- <label>Total Users:</label>
192
- <span id="total-users">""" + user_playing["total"] + """</span>
 
 
 
 
 
 
 
 
 
 
193
  </div>
194
- <div class="stat">
195
- <label>Stockfish Users:</label>
196
- <span id="stockfish-users">""" + user_playing["stockfish"] """</span>
197
- </div>
198
- <div class="stat">
199
- <label>Maia Users:</label>
200
- <span id="maia-users">""" + user_playing["maia"] + """</span>
201
- </div>
202
- </div>
203
- </body>
204
- </html>
205
- """)
 
131
 
132
  @app.get("/")
133
  async def root(request: Request):
134
+ html_content = """
135
+ <!DOCTYPE html>
136
+ <html lang="en">
137
+ <head>
138
+ <meta charset="UTF-8">
139
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
140
+ <title>Users playing now</title>
141
+ <style>
142
+ body {
143
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
144
+ background-color: #1f1f1f;
145
+ color: #f0f0f0;
146
+ margin: 0;
147
+ padding: 0;
148
+ display: flex;
149
+ justify-content: center;
150
+ align-items: center;
151
+ height: 100vh;
152
+ text-align: center;
153
+ }
154
+ .container {
155
+ background-color: #2d2d2d;
156
+ padding: 20px;
157
+ border-radius: 10px;
158
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
159
+ max-width: 400px;
160
+ width: 100%;
161
+ margin: 20px;
162
+ }
163
+ h1 {
164
+ color: #f0f0f0;
165
+ font-size: 2.5rem;
166
+ margin-bottom: 20px;
167
+ }
168
+ .stat {
169
+ margin-bottom: 10px;
170
+ display: flex;
171
+ justify-content: space-between;
172
+ align-items: center;
173
+ padding: 10px;
174
+ border-bottom: 1px solid #444;
175
+ }
176
+ .stat:last-child {
177
+ border-bottom: none;
178
+ }
179
+ .stat label {
180
+ font-weight: bold;
181
+ font-size: 1.2rem;
182
+ }
183
+ .stat span {
184
+ font-size: 1.2rem;
185
+ }
186
+ </style>
187
+ </head>
188
+ <body>
189
+ <div class="container">
190
+ <h1>Users playing now</h1>
191
+ <div class="stat">
192
+ <label>Total Users:</label>
193
+ <span id="total-users">{}</span>
194
+ </div>
195
+ <div class="stat">
196
+ <label>Stockfish Users:</label>
197
+ <span id="stockfish-users">{}</span>
198
+ </div>
199
+ <div class="stat">
200
+ <label>Maia Users:</label>
201
+ <span id="maia-users">{}</span>
202
+ </div>
203
  </div>
204
+ </body>
205
+ </html>
206
+ """.format(user_playing["total"], user_playing["stockfish"], user_playing["maia"])
207
+
208
+ return HTMLResponse(content=html_content)