From 36677240614a7a5d9a36e13188a7de15d96c9903 Mon Sep 17 00:00:00 2001 From: CopilotLaLaLa <60728519+CopilotLaLaLa@users.noreply.github.com> Date: Sun, 12 Jun 2022 15:16:07 +0000 Subject: [PATCH] =?UTF-8?q?token=5Fjson=E6=96=87=E4=BB=B6=E5=86=99?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.dev | 2 +- .gitignore | 6 ++++++ configs/config.py | 12 ++++++------ plugins/web_ui/auth/__init__.py | 2 ++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.env.dev b/.env.dev index 00d51e29..1fc68d05 100644 --- a/.env.dev +++ b/.env.dev @@ -13,4 +13,4 @@ SESSION_EXPIRE_TIMEOUT=30 DEBUG=False # 服务器和端口 HOST = 127.0.0.1 -PORT = 8080 +PORT = 8090 diff --git a/.gitignore b/.gitignore index bca28216..f1558d7e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,12 @@ __pycache__/ *.so # Distribution / packaging +.vscode +data +resources +configs +.env.dev +*.env.dev .Python build/ develop-eggs/ diff --git a/configs/config.py b/configs/config.py index 70ff7a1e..e2502b3a 100644 --- a/configs/config.py +++ b/configs/config.py @@ -11,14 +11,14 @@ NICKNAME: str = "小真寻" # 示例:"bind": "postgresql://user:password@127.0.0.1:5432/database" bind: str = "" # 数据库连接链接 sql_name: str = "postgresql" -user: str = "" # 数据用户名 -password: str = "" # 数据库密码 -address: str = "" # 数据库地址 -port: str = "" # 数据库端口 -database: str = "" # 数据库名称 +user: str = "uname" # 数据用户名 +password: str = "zhenxun" # 数据库密码 +address: str = "127.0.0.1" # 数据库地址 +port: str = "5432" # 数据库端口 +database: str = "postgres" # 数据库名称 # 代理,例如 "http://127.0.0.1:7890" -SYSTEM_PROXY: Optional[str] = None # 全局代理 +SYSTEM_PROXY: Optional[str] = "http://127.0.0.1:7890" # 全局代理 Config = ConfigsManager(Path() / "data" / "configs" / "plugins2config.yaml") diff --git a/plugins/web_ui/auth/__init__.py b/plugins/web_ui/auth/__init__.py index c6cadf84..4fce1d36 100644 --- a/plugins/web_ui/auth/__init__.py +++ b/plugins/web_ui/auth/__init__.py @@ -76,6 +76,8 @@ async def login_get_token(form_data: OAuth2PasswordRequestForm = Depends()): token_data["token"].append(access_token) if len(token_data["token"]) > 3: token_data["token"] = token_data["token"][1:] + with open(token_file, 'w', encoding="utf8") as f: + json.dump(token_data, f, ensure_ascii=False, indent=4) return {"access_token": access_token, "token_type": "bearer"}