fix using the request instead of the response

This commit is contained in:
Hay1tsme 2023-02-18 23:42:27 -05:00
parent a843e3d3ac
commit a3c689cd09

View File

@ -131,20 +131,20 @@ class AllnetServlet:
if machine is not None: if machine is not None:
arcade = self.data.arcade.get_arcade(machine["arcade"]) arcade = self.data.arcade.get_arcade(machine["arcade"])
req.country = arcade["country"] if machine["country"] is None else machine["country"] resp.country = arcade["country"] if machine["country"] is None else machine["country"]
req.place_id = arcade["id"] resp.place_id = arcade["id"]
req.allnet_id = machine["id"] resp.allnet_id = machine["id"]
req.name = arcade["name"] resp.name = arcade["name"]
req.nickname = arcade["nickname"] resp.nickname = arcade["nickname"]
req.region0 = arcade["region_id"] resp.region0 = arcade["region_id"]
req.region_name0 = arcade["country"] resp.region_name0 = arcade["country"]
req.region_name1 = arcade["state"] resp.region_name1 = arcade["state"]
req.region_name2 = arcade["city"] resp.region_name2 = arcade["city"]
req.client_timezone = arcade["timezone"] if arcade["timezone"] is not None else "+0900" resp.client_timezone = arcade["timezone"] if arcade["timezone"] is not None else "+0900"
int_ver = req.ver.replace(".", "") int_ver = req.ver.replace(".", "")
req.uri = req.uri.replace("$v", int_ver) resp.uri = resp.uri.replace("$v", int_ver)
req.host = req.host.replace("$v", int_ver) resp.host = resp.host.replace("$v", int_ver)
msg = f"{req.serial} authenticated from {request_ip}: {req.game_id} v{req.ver}" msg = f"{req.serial} authenticated from {request_ip}: {req.game_id} v{req.ver}"
self.data.base.log_event("allnet", "ALLNET_AUTH_SUCCESS", logging.INFO, msg) self.data.base.log_event("allnet", "ALLNET_AUTH_SUCCESS", logging.INFO, msg)
@ -227,7 +227,7 @@ class AllnetServlet:
resp = BillingResponse(playlimit, playlimit_sig, nearfull, nearfull_sig) resp = BillingResponse(playlimit, playlimit_sig, nearfull, nearfull_sig)
resp_str = self.dict_to_http_form_string([vars(resp)]) resp_str = self.dict_to_http_form_string([vars(resp)], True)
if resp_str is None: if resp_str is None:
self.logger.error(f"Failed to parse response {vars(resp)}") self.logger.error(f"Failed to parse response {vars(resp)}")