mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-30 01:00:02 +08:00
update v0.1.5.8
This commit is contained in:
@@ -58,4 +58,4 @@ async def _(group: GroupResult, user: User = Depends(token_to_user)) -> Result:
|
||||
group_manager.turn_on_group_bot_status(group_id)
|
||||
else:
|
||||
group_manager.shutdown_group_bot_status(group_id)
|
||||
return Result(code=200)
|
||||
return Result(code=200, data="修改成功!")
|
||||
|
||||
@@ -121,7 +121,17 @@ def _(plugin: Plugin, user: User = Depends(token_to_user)) -> Result:
|
||||
isinstance(Config.get_config(plugin.model, c.key, c.value), list)
|
||||
or isinstance(c.default_value, list)
|
||||
):
|
||||
default_value = Config.get_config(plugin.model, c.key, c.value)
|
||||
c.value = c.value.split(",")
|
||||
if default_value and isinstance(default_value[0], int):
|
||||
c.value = [int(x) for x in c.value]
|
||||
elif default_value and isinstance(default_value[0], float):
|
||||
c.value = [float(x) for x in c.value]
|
||||
elif default_value and isinstance(default_value[0], bool):
|
||||
temp = []
|
||||
for x in c.value:
|
||||
temp.append(x.lower() == "true")
|
||||
c.value = temp
|
||||
Config.set_config(plugin.model, c.key, c.value)
|
||||
Config.save(None, True)
|
||||
else:
|
||||
@@ -139,4 +149,4 @@ def _(plugin: Plugin, user: User = Depends(token_to_user)) -> Result:
|
||||
code=500,
|
||||
data=f"WEB_UI POST /webui/plugins model:{plugin.model} 发生错误 {type(e)}:{e}",
|
||||
)
|
||||
return Result(code=200)
|
||||
return Result(code=200, data="修改成功!")
|
||||
|
||||
@@ -34,7 +34,7 @@ async def _(parma: RequestParma, user: User = Depends(token_to_user)) -> Result:
|
||||
操作请求
|
||||
:param parma: 参数
|
||||
"""
|
||||
result = "ok"
|
||||
result = "操作成功!"
|
||||
flag = 3
|
||||
if bot := get_bot():
|
||||
if parma.handle == "approve":
|
||||
|
||||
@@ -29,7 +29,7 @@ disk_data = {"data": []}
|
||||
|
||||
|
||||
@app.get("/webui/system")
|
||||
async def _(user: User = Depends(token_to_user)) -> Result:
|
||||
async def _() -> Result:
|
||||
return await get_system_data()
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ async def _(user: User = Depends(token_to_user)) -> Result:
|
||||
)
|
||||
|
||||
|
||||
async def get_system_data():
|
||||
async def get_system_data(user: User = Depends(token_to_user)):
|
||||
"""
|
||||
说明:
|
||||
获取系统信息,资源文件大小,网络状态等
|
||||
@@ -92,7 +92,7 @@ async def get_system_data():
|
||||
logger.warning(f"访问Google失败... {type(e)}: {e}")
|
||||
google = 404
|
||||
network = SystemNetwork(baidu=baidu, google=google)
|
||||
disk = await asyncio.get_event_loop().run_in_executor(None, _get_system_disk)
|
||||
disk = await asyncio.get_event_loop().run_in_executor(None, _get_system_disk, None)
|
||||
status = await asyncio.get_event_loop().run_in_executor(None, _get_system_status)
|
||||
return Result(
|
||||
code=200,
|
||||
@@ -105,7 +105,7 @@ async def get_system_data():
|
||||
)
|
||||
|
||||
|
||||
def _get_system_status() -> SystemStatus:
|
||||
def _get_system_status(user: User = Depends(token_to_user)) -> SystemStatus:
|
||||
"""
|
||||
说明:
|
||||
获取系统信息等
|
||||
@@ -123,7 +123,7 @@ def _get_system_status() -> SystemStatus:
|
||||
|
||||
|
||||
def _get_system_disk(
|
||||
type_: Optional[str],
|
||||
type_: Optional[str], user: User = Depends(token_to_user)
|
||||
) -> Union[SystemFolderSize, Dict[str, Union[float, datetime]]]:
|
||||
"""
|
||||
说明:
|
||||
|
||||
Reference in New Issue
Block a user