From 028251809bea6783c624c8880ecd47cfba00770e Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 27 Oct 2024 00:09:12 +0200 Subject: [PATCH] Minor cleanups --- auth/server.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/auth/server.py b/auth/server.py index cc8b07f..66578c3 100755 --- a/auth/server.py +++ b/auth/server.py @@ -7,15 +7,8 @@ from base64 import b64encode from os.path import getmtime import json -userdata = { - "9a10d47934294527b3a0a32ab41d207e": { - "name": "test1" - }, - "4ad1f41992193cb986741243f14d81e8": { - "name": "test2" - } -} -connections = {} +userdata = {} +g_connections = {} class HTTPRequestHandler(BaseHTTPRequestHandler): protocol_version = "HTTP/1.1" @@ -141,7 +134,7 @@ class HTTPRequestHandler(BaseHTTPRequestHandler): token, profileId = params["sessionId"][0].split(":")[1:] serverId = params["serverId"][0] - connections[serverId] = profileId + g_connections[serverId] = profileId if True: self.send_ok(b"OK") @@ -155,7 +148,7 @@ class HTTPRequestHandler(BaseHTTPRequestHandler): profileId = data["selectedProfile"] serverId = data["serverId"] - connections[serverId] = profileId + g_connections[serverId] = profileId if True: self.send_response(HTTPStatus.NO_CONTENT) @@ -171,7 +164,7 @@ class HTTPRequestHandler(BaseHTTPRequestHandler): user = params["user"][0] serverId = params["serverId"][0] - if not serverId in connections: + if not serverId in g_connections: self.send_ok(b"NO") self.send_ok(b"YES") @@ -180,11 +173,11 @@ class HTTPRequestHandler(BaseHTTPRequestHandler): serverId = params["serverId"][0] user = params["username"][0] - if not serverId in connections: + if not serverId in g_connections: self.send_response(HTTPStatus.NO_CONTENT) self.end_headers() - profileId = connections[serverId] + profileId = g_connections[serverId] data = self.get_profile(profileId) if data is None: