@@ -38,6 +38,13 @@ def __init__(self):
38
38
self .activePlayer = None
39
39
def get (self , path , query , gameno ):
40
40
if path == "/check" :
41
+ if query .get ("name" ) not in users : return {
42
+ "status" : 303 ,
43
+ "headers" : {
44
+ "Location" : f"/?" + query .orig
45
+ },
46
+ "content" : ""
47
+ }
41
48
# Check for game status openings
42
49
if self .status == GameStatus .WAITING_FOR_FIRST_WORD :
43
50
return {
@@ -295,10 +302,10 @@ def getGameInfo():
295
302
return random .choice (info )
296
303
297
304
users = []
298
- pwd = '' .join ([random .choice ([* "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 " ]) for x in range (5 )])
305
+ pwd = '' .join ([random .choice ([* "abcdefghijklmnpqrstuvwxyz0123456789 " ]) for x in range (4 )])
299
306
pending = []
300
307
def get (path , query : URLQuery ):
301
- if path == "/status " + pwd :
308
+ if path == "/status_ " + pwd :
302
309
return {
303
310
"status" : 200 ,
304
311
"headers" : {
@@ -316,7 +323,7 @@ def get(path, query: URLQuery):
316
323
<script>
317
324
setInterval(() => {
318
325
var x = new XMLHttpRequest()
319
- x.open("GET", location.pathname + "/i ")
326
+ x.open("GET", location.pathname + "/s/ ")
320
327
x.addEventListener("loadend", (e) => {
321
328
document.querySelector("#t").innerText = e.target.responseText
322
329
})
@@ -332,16 +339,8 @@ def get(path, query: URLQuery):
332
339
</body>
333
340
</html>"""
334
341
}
335
- elif path == "/status" + pwd + "/i" :
336
- return {
337
- "status" : 200 ,
338
- "headers" : {
339
- "Content-Type" : "text/plain"
340
- },
341
- "content" : get_manager_info ("" )
342
- }
343
- elif path .startswith ("/status" + pwd + "/s/" ):
344
- d = path [len ("/status" + pwd + "/s/" ):]
342
+ elif path .startswith ("/status_" + pwd + "/s/" ):
343
+ d = path [len ("/status_" + pwd + "/s/" ):]
345
344
return {
346
345
"status" : 200 ,
347
346
"headers" : {
0 commit comments