Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d522d65

Browse files
Misc fixes
1 parent bff9673 commit d522d65

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

main.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ def __init__(self):
3838
self.activePlayer = None
3939
def get(self, path, query, gameno):
4040
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+
}
4148
# Check for game status openings
4249
if self.status == GameStatus.WAITING_FOR_FIRST_WORD:
4350
return {
@@ -295,10 +302,10 @@ def getGameInfo():
295302
return random.choice(info)
296303

297304
users = []
298-
pwd = ''.join([random.choice([*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"]) for x in range(5)])
305+
pwd = ''.join([random.choice([*"abcdefghijklmnpqrstuvwxyz0123456789"]) for x in range(4)])
299306
pending = []
300307
def get(path, query: URLQuery):
301-
if path == "/status" + pwd:
308+
if path == "/status_" + pwd:
302309
return {
303310
"status": 200,
304311
"headers": {
@@ -316,7 +323,7 @@ def get(path, query: URLQuery):
316323
<script>
317324
setInterval(() => {
318325
var x = new XMLHttpRequest()
319-
x.open("GET", location.pathname + "/i")
326+
x.open("GET", location.pathname + "/s/")
320327
x.addEventListener("loadend", (e) => {
321328
document.querySelector("#t").innerText = e.target.responseText
322329
})
@@ -332,16 +339,8 @@ def get(path, query: URLQuery):
332339
</body>
333340
</html>"""
334341
}
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/"):]
345344
return {
346345
"status": 200,
347346
"headers": {

public_files/gamestart.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<title>Waiting</title>
5-
<script>setTimeout(() => location.reload(), Math.random() * 5000)</script>
5+
<script>setTimeout(() => location.reload(), 5000)</script>
66
<link href="main.css" rel="stylesheet" type="text/css" />
77
<link rel="icon" type="image/x-icon" href="wait.ico">
88
</head>

public_files/word.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<script>
2121
/*X// This code will only be parsed if there are no photos available.
2222
document.querySelector("img").parentNode.remove()
23-
document.querySelector(".wordheader").innerText = "Enter any word or phrase."
23+
document.querySelector(".wordheader").innerText = "Enter any phrase or sentence."
2424
// */
2525
function g(css) { return document.querySelector(css); }
2626
function submit() {
@@ -35,4 +35,4 @@
3535
}
3636
</script>
3737
</body>
38-
</html>
38+
</html>

0 commit comments

Comments
 (0)