From f9214b3ca64dcc7a1bd65bf23f6ed78d84070795 Mon Sep 17 00:00:00 2001 From: drmext <71258889+drmext@users.noreply.github.com> Date: Thu, 2 Mar 2023 11:47:04 +0000 Subject: [PATCH] Fix ujson --- README.md | 2 +- modules/ddr/api.py | 6 +++--- pyeamu.py | 2 +- requirements.txt | 26 +++++++------------------- start.bat | 2 +- 5 files changed, 13 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 6817152..b2b4b58 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ for experimental local testing and playing ## Instructions -1. Install [python](https://www.python.org/ftp/python/3.11.1/python-3.11.1-amd64.exe) with "Add python.exe to PATH" checked +1. Install [python](https://www.python.org/ftp/python/3.11.2/python-3.11.2-amd64.exe) with "Add python.exe to PATH" checked 1. Run `start.bat` diff --git a/modules/ddr/api.py b/modules/ddr/api.py index 24b42b5..6194d24 100644 --- a/modules/ddr/api.py +++ b/modules/ddr/api.py @@ -17,7 +17,7 @@ from typing import Dict, List, Tuple from os import path -router = APIRouter(prefix="/ddr", tags=["api"]) +router = APIRouter(prefix="/ddr", tags=["api_ddr"]) class DDR_Profile_Main_Items(BaseModel): @@ -149,7 +149,7 @@ async def ddr_scores_id(mcode: int): @router.get("/mcode/{mcode}/best") -async def ddr_scores_id(mcode: int): +async def ddr_scores_id_best(mcode: int): return get_db().table("ddr_scores_best").search((where("mcode") == mcode)) @@ -259,6 +259,6 @@ async def ddr_receive_mdb(file: UploadFile = File(...)) -> bytes: mdb[mcode] = mdb_old[mcode] with open(ddr_metadata, "w", encoding="utf-8") as fp: - json.dump(mdb, fp, indent=4, ensure_ascii=False) + json.dump(mdb, fp, indent=4, ensure_ascii=False, escape_forward_slashes=False) return Response(status_code=201) diff --git a/pyeamu.py b/pyeamu.py index 63201a5..d60a331 100644 --- a/pyeamu.py +++ b/pyeamu.py @@ -55,7 +55,7 @@ app.add_middleware( if path.exists("webui"): webui = True with open(path.join("webui", "monkey.json"), "w") as f: - json.dump(settings, f, indent=2) + json.dump(settings, f, indent=2, escape_forward_slashes=False) app.mount("/webui", StaticFiles(directory="webui", html=True), name="webui") else: webui = False diff --git a/requirements.txt b/requirements.txt index 8f41547..c0ceb47 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,7 @@ -anyio==3.6.2 -asgiref==3.5.2 -click==8.1.3 -colorama==0.4.6 -fastapi==0.88.0 -h11==0.14.0 -idna==3.4 -kbinxml==1.7 -lxml==4.9.2 -pycryptodomex==3.16.0 -pydantic==1.10.2 -python-multipart==0.0.5 -six==1.16.0 -sniffio==1.3.0 -starlette==0.22.0 -tinydb==4.7.0 -typing_extensions==4.4.0 -ujson==5.6.0 -uvicorn[standard]==0.20.0 +fastapi +kbinxml +pycryptodomex +python-multipart +tinydb +ujson +uvicorn[standard] diff --git a/start.bat b/start.bat index e8f7c56..df6090e 100644 --- a/start.bat +++ b/start.bat @@ -19,7 +19,7 @@ if exist .venv\Lib\site-packages\ujson*.pyd ( echo: echo Install python with "Add python.exe to PATH" checked -echo https://www.python.org/ftp/python/3.11.1/python-3.11.1-amd64.exe +echo https://www.python.org/ftp/python/3.11.2/python-3.11.2-amd64.exe echo: pause