chuni: Fix endpoint for older version of SDGS (#141)

Reviewed-on: Hay1tsme/artemis#141
Co-authored-by: roaz <roaz@noreply.gitea.tendokyu.moe>
Co-committed-by: roaz <roaz@noreply.gitea.tendokyu.moe>
This commit is contained in:
roaz 2024-05-21 04:07:17 +00:00 committed by Hay1tsme
parent 3ed8d9c16b
commit 70b40ce992
2 changed files with 11 additions and 8 deletions

View File

@ -10,6 +10,7 @@ Games listed below have been tested and confirmed working. Only game versions ol
+ CHUNITHM INTL + CHUNITHM INTL
+ SUPERSTAR + SUPERSTAR
+ SUPERSTAR PLUS
+ NEW + NEW
+ NEW PLUS + NEW PLUS
+ SUN + SUN

View File

@ -195,11 +195,11 @@ class ChuniServlet(BaseServlet):
internal_ver = ChuniConstants.VER_CHUNITHM_NEW_PLUS internal_ver = ChuniConstants.VER_CHUNITHM_NEW_PLUS
elif version >= 210 and version < 215: # SUN elif version >= 210 and version < 215: # SUN
internal_ver = ChuniConstants.VER_CHUNITHM_SUN internal_ver = ChuniConstants.VER_CHUNITHM_SUN
elif version >= 215: # SUN elif version >= 215: # SUN PLUS
internal_ver = ChuniConstants.VER_CHUNITHM_SUN_PLUS internal_ver = ChuniConstants.VER_CHUNITHM_SUN_PLUS
elif game_code == "SDGS": # Int elif game_code == "SDGS": # Int
if version < 110: # SUPERSTAR if version < 110: # SUPERSTAR / SUPERSTAR PLUS
internal_ver = ChuniConstants.VER_CHUNITHM_PARADISE # FIXME: Not sure what was intended to go here? was just "PARADISE" internal_ver = ChuniConstants.VER_CHUNITHM_PARADISE # SUPERSTAR / SUPERSTAR PLUS worked fine with it
elif version >= 110 and version < 115: # NEW elif version >= 110 and version < 115: # NEW
internal_ver = ChuniConstants.VER_CHUNITHM_NEW internal_ver = ChuniConstants.VER_CHUNITHM_NEW
elif version >= 115 and version < 120: # NEW PLUS!! elif version >= 115 and version < 120: # NEW PLUS!!
@ -272,11 +272,13 @@ class ChuniServlet(BaseServlet):
self.logger.info(f"v{version} {endpoint} request from {client_ip}") self.logger.info(f"v{version} {endpoint} request from {client_ip}")
self.logger.debug(req_data) self.logger.debug(req_data)
endpoint = ( if game_code == "SDGS" and version >= 110:
endpoint.replace("C3Exp", "") endpoint = endpoint.replace("C3Exp", "")
if game_code == "SDGS" elif game_code == "SDGS" and version < 110:
else endpoint endpoint = endpoint.replace("Exp", "")
) else:
endpoint = endpoint
func_to_find = "handle_" + inflection.underscore(endpoint) + "_request" func_to_find = "handle_" + inflection.underscore(endpoint) + "_request"
handler_cls = self.versions[internal_ver](self.core_cfg, self.game_cfg) handler_cls = self.versions[internal_ver](self.core_cfg, self.game_cfg)