forked from Hay1tsme/artemis
Merge pull request 'ongeki: fix base version title work' (#153) from zaphkito/artemis:develop into develop
Reviewed-on: Hay1tsme/artemis#153
This commit is contained in:
commit
cfece7593e
@ -216,16 +216,20 @@ class OngekiServlet(BaseServlet):
|
|||||||
)
|
)
|
||||||
return Response(zlib.compress(b'{"stat": "0"}'))
|
return Response(zlib.compress(b'{"stat": "0"}'))
|
||||||
|
|
||||||
try:
|
if version < 105:
|
||||||
unzip = zlib.decompress(req_raw)
|
# O.N.G.E.K.I base don't use zlib
|
||||||
|
req_data = json.loads(req_raw)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
unzip = zlib.decompress(req_raw)
|
||||||
|
|
||||||
|
except zlib.error as e:
|
||||||
|
self.logger.error(
|
||||||
|
f"Failed to decompress v{version} {endpoint} request -> {e}"
|
||||||
|
)
|
||||||
|
return Response(zlib.compress(b'{"stat": "0"}'))
|
||||||
|
|
||||||
except zlib.error as e:
|
req_data = json.loads(unzip)
|
||||||
self.logger.error(
|
|
||||||
f"Failed to decompress v{version} {endpoint} request -> {e}"
|
|
||||||
)
|
|
||||||
return Response(zlib.compress(b'{"stat": "0"}'))
|
|
||||||
|
|
||||||
req_data = json.loads(unzip)
|
|
||||||
|
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
f"v{version} {endpoint} request from {client_ip}"
|
f"v{version} {endpoint} request from {client_ip}"
|
||||||
@ -251,9 +255,12 @@ class OngekiServlet(BaseServlet):
|
|||||||
|
|
||||||
self.logger.debug(f"Response {resp}")
|
self.logger.debug(f"Response {resp}")
|
||||||
|
|
||||||
zipped = zlib.compress(json.dumps(resp, ensure_ascii=False).encode("utf-8"))
|
resp_raw = json.dumps(resp, ensure_ascii=False).encode("utf-8")
|
||||||
|
zipped = zlib.compress(resp_raw)
|
||||||
|
|
||||||
if not encrtped or version < 120:
|
if not encrtped or version < 120:
|
||||||
|
if version < 105:
|
||||||
|
return Response(resp_raw)
|
||||||
return Response(zipped)
|
return Response(zipped)
|
||||||
|
|
||||||
padded = pad(zipped, 16)
|
padded = pad(zipped, 16)
|
||||||
|
Loading…
Reference in New Issue
Block a user