mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
token_json文件写入
This commit is contained in:
parent
5fd687c1e4
commit
3667724061
2
.env.dev
2
.env.dev
@ -13,4 +13,4 @@ SESSION_EXPIRE_TIMEOUT=30
|
|||||||
DEBUG=False
|
DEBUG=False
|
||||||
# 服务器和端口
|
# 服务器和端口
|
||||||
HOST = 127.0.0.1
|
HOST = 127.0.0.1
|
||||||
PORT = 8080
|
PORT = 8090
|
||||||
|
|||||||
6
.gitignore
vendored
6
.gitignore
vendored
@ -8,6 +8,12 @@ __pycache__/
|
|||||||
*.so
|
*.so
|
||||||
|
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
|
.vscode
|
||||||
|
data
|
||||||
|
resources
|
||||||
|
configs
|
||||||
|
.env.dev
|
||||||
|
*.env.dev
|
||||||
.Python
|
.Python
|
||||||
build/
|
build/
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
|
|||||||
@ -11,14 +11,14 @@ NICKNAME: str = "小真寻"
|
|||||||
# 示例:"bind": "postgresql://user:password@127.0.0.1:5432/database"
|
# 示例:"bind": "postgresql://user:password@127.0.0.1:5432/database"
|
||||||
bind: str = "" # 数据库连接链接
|
bind: str = "" # 数据库连接链接
|
||||||
sql_name: str = "postgresql"
|
sql_name: str = "postgresql"
|
||||||
user: str = "" # 数据用户名
|
user: str = "uname" # 数据用户名
|
||||||
password: str = "" # 数据库密码
|
password: str = "zhenxun" # 数据库密码
|
||||||
address: str = "" # 数据库地址
|
address: str = "127.0.0.1" # 数据库地址
|
||||||
port: str = "" # 数据库端口
|
port: str = "5432" # 数据库端口
|
||||||
database: str = "" # 数据库名称
|
database: str = "postgres" # 数据库名称
|
||||||
|
|
||||||
# 代理,例如 "http://127.0.0.1:7890"
|
# 代理,例如 "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")
|
Config = ConfigsManager(Path() / "data" / "configs" / "plugins2config.yaml")
|
||||||
|
|||||||
@ -76,6 +76,8 @@ async def login_get_token(form_data: OAuth2PasswordRequestForm = Depends()):
|
|||||||
token_data["token"].append(access_token)
|
token_data["token"].append(access_token)
|
||||||
if len(token_data["token"]) > 3:
|
if len(token_data["token"]) > 3:
|
||||||
token_data["token"] = token_data["token"][1:]
|
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"}
|
return {"access_token": access_token, "token_type": "bearer"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user