fix web_ui api

This commit is contained in:
HibiKier 2022-04-05 13:14:29 +08:00
parent 33eb1b83a8
commit a72f126d8f
5 changed files with 18 additions and 23 deletions

View File

@ -32,14 +32,6 @@
## 普通帮助图片 ## 普通帮助图片
![x](https://github.com/HibiKier/zhenxun_bot/blob/0.0.8.2/docs_image/3238573864-836268675-E2FFBB2AC143EAF4DDDF150438508721.png) ![x](https://github.com/HibiKier/zhenxun_bot/blob/0.0.8.2/docs_image/3238573864-836268675-E2FFBB2AC143EAF4DDDF150438508721.png)
## Web UI
[zhenxun_bot_webui](https://github.com/HibiKier/zhenxun_bot_webui)
## 一键安装脚本
[zhenxun_bot-deploy](https://github.com/AkashiCoin/zhenxun_bot-deploy)
## 提供符合真寻标准的插件仓库 ## 提供符合真寻标准的插件仓库
[AkashiCoin/nonebot_plugins_zhenxun_bot](https://github.com/AkashiCoin/nonebot_plugins_zhenxun_bot) [AkashiCoin/nonebot_plugins_zhenxun_bot](https://github.com/AkashiCoin/nonebot_plugins_zhenxun_bot)
@ -244,6 +236,10 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
## 更新 ## 更新
### 2022/4/5 \[v0.1.4.6]
* 修复web修改插件后帮助图片生成错误
### 2022/4/4 \[v0.1.4.5] ### 2022/4/4 \[v0.1.4.5]
* 替换了bt搜索URL * 替换了bt搜索URL
@ -253,7 +249,6 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
* 修复同意群聊请求错误 * 修复同意群聊请求错误
* 提供webui方面的api * 提供webui方面的api
* 新增web-ui前端简易管理页面插件插件 * 新增web-ui前端简易管理页面插件插件
* Update word_bank plus
### 2022/3/21 ### 2022/3/21
@ -337,15 +332,15 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
* epic restful 替换 [@pull/119](https://github.com/HibiKier/zhenxun_bot/pull/119) * epic restful 替换 [@pull/119](https://github.com/HibiKier/zhenxun_bot/pull/119)
* fix: 修复远古时期残留的epic推送问题 [@pull/122](https://github.com/HibiKier/zhenxun_bot/pull/122) * fix: 修复远古时期残留的epic推送问题 [@pull/122](https://github.com/HibiKier/zhenxun_bot/pull/122)
### 2021/2/11 ### 2022/2/11
* 修复pix不使用反代无法下载图片 * 修复pix不使用反代无法下载图片
### 2021/2/10 \[v0.1.1] ### 2022/2/10 \[v0.1.1]
* 修复购买道具出错 * 修复购买道具出错
### 2021/2/9 \[v0.1] ### 2022/2/9 \[v0.1]
* 新增原神自动签到和手动签到 * 新增原神自动签到和手动签到
* 新增原神树脂提醒 * 新增原神树脂提醒
@ -355,7 +350,7 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
* 修复修改商品时限制时间出错 * 修复修改商品时限制时间出错
* 修复超时商品依旧可以被购买 * 修复超时商品依旧可以被购买
### 2021/1/16 \[v0.0.9.0] ### 2022/1/16 \[v0.0.9.0]
* Ai提供文本敏感词过滤器 * Ai提供文本敏感词过滤器
* 疫情插件适配新版腾讯API * 疫情插件适配新版腾讯API
@ -374,7 +369,7 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
* “send_success_msg”(发送成功的交互信息->即:使用道具 {name} {num} 次成功) * “send_success_msg”(发送成功的交互信息->即:使用道具 {name} {num} 次成功)
* “_max_num_limit”(该道具单次使用的最多个数默认1) * “_max_num_limit”(该道具单次使用的最多个数默认1)
### 2021/1/5 \[v0.0.8.2] ### 2022/1/5 \[v0.0.8.2]
* 提供金币消费hook可在plugins2settings.yaml中配置该功能需要消费的金币 * 提供金币消费hook可在plugins2settings.yaml中配置该功能需要消费的金币
* 商店插件将作为内置插件移动至basic_plugins * 商店插件将作为内置插件移动至basic_plugins
@ -429,6 +424,9 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
__..... 更多更新信息请查看文档__ __..... 更多更新信息请查看文档__
## Todo
- [ ] web管理
## 感谢 ## 感谢
[botuniverse / onebot](https://github.com/botuniverse/onebot) :超棒的机器人协议 [botuniverse / onebot](https://github.com/botuniverse/onebot) :超棒的机器人协议
[Mrs4s / go-cqhttp](https://github.com/Mrs4s/go-cqhttp) cqhttp的golang实现轻量、原生跨平台. [Mrs4s / go-cqhttp](https://github.com/Mrs4s/go-cqhttp) cqhttp的golang实现轻量、原生跨平台.

View File

@ -1 +1 @@
__version__: v0.1.4.5 __version__: v0.1.4.6

View File

@ -1,5 +1,5 @@
from configs.config import Config as gConfig from configs.config import Config as gConfig
from .manager import * from .api import *
from .auth import * from .auth import *

View File

@ -67,8 +67,8 @@ def _(type_: Optional[str], user: User = Depends(token_to_user)) -> Result:
if x := plugins2settings_manager.get(model): if x := plugins2settings_manager.get(model):
if x.get("cmd") and isinstance(x.get("cmd"), list): if x.get("cmd") and isinstance(x.get("cmd"), list):
x["cmd"] = ",".join(x["cmd"]) x["cmd"] = ",".join(x["cmd"])
if isinstance(x["plugin_type"], list): # if isinstance(x["plugin_type"], list):
x["plugin_type"] = x["plugin_type"][0] # x["plugin_type"] = x["plugin_type"][0]
data["plugin_settings"] = PluginSettings(**x) data["plugin_settings"] = PluginSettings(**x)
if x := plugins2cd_manager.get(model): if x := plugins2cd_manager.get(model):
data["cd_limit"] = CdLimit(**x) data["cd_limit"] = CdLimit(**x)
@ -88,14 +88,11 @@ def _(plugin: Plugin, user: User = Depends(token_to_user)) -> Result:
修改插件信息 修改插件信息
:param plugin: 插件内容 :param plugin: 插件内容
""" """
print(plugin)
if plugin.plugin_settings: if plugin.plugin_settings:
for key, value in plugin.plugin_settings: for key, value in plugin.plugin_settings:
plugins2settings_manager.set_module_data(plugin.model, key, value) plugins2settings_manager.set_module_data(plugin.model, key, value)
if plugin.plugin_manager: if plugin.plugin_manager:
for key, value in plugin.plugin_manager: for key, value in plugin.plugin_manager:
print(key, value)
plugins_manager.set_module_data(plugin.model, key, value) plugins_manager.set_module_data(plugin.model, key, value)
return Result(code=200) return Result(code=200)

View File

@ -1,4 +1,4 @@
from typing import Optional, List, Any from typing import Optional, List, Any, Union
from pydantic import BaseModel from pydantic import BaseModel
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
import nonebot import nonebot
@ -54,7 +54,7 @@ class PluginSettings(BaseModel):
limit_superuser: Optional[bool] # 是否限制超级用户 limit_superuser: Optional[bool] # 是否限制超级用户
cmd: Optional[str] # cmd别名 cmd: Optional[str] # cmd别名
cost_gold: Optional[int] # 花费金币限制 cost_gold: Optional[int] # 花费金币限制
plugin_type: Optional[str] # 帮助类型 plugin_type: Optional[List[Union[str, int]]] # 帮助类型
class Plugin(BaseModel): class Plugin(BaseModel):