BISON_OUTER_URL配置改进 (#405)

* 📝 修复文档中的错误链接

*  bison_outer_url使用property包装

* 📝 通过vue动态生成BISON_OUTER_URL的配置建议

* 💄 auto fix by pre-commit hooks

* 📝 优化文档视觉效果

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Sherkey
2023-10-29 20:54:41 +08:00
committed by GitHub
parent 7a7585734d
commit 1997b57761
5 changed files with 78 additions and 10 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ def register_get_token_handler():
@get_token.handle()
async def send_token(bot: "Bot", event: PrivateMessageEvent, state: T_State):
token = tm.get_user_token((event.get_user_id(), event.sender.nickname))
await get_token.finish(f"请访问: {plugin_config.bison_outer_url}auth/{token}")
await get_token.finish(f"请访问: {plugin_config.outer_url}auth/{token}")
get_token.__help__name__ = "获取后台管理地址" # type: ignore
get_token.__help__info__ = "获取管理bot后台的地址,该地址会在一段时间过后过期,请不要泄漏该地址" # type: ignore
+7 -2
View File
@@ -1,13 +1,15 @@
import nonebot
from pydantic import BaseSettings
global_config = nonebot.get_driver().config
class PlugConfig(BaseSettings):
bison_config_path: str = ""
bison_use_pic: bool = False
bison_init_filter: bool = True
bison_use_queue: bool = True
bison_outer_url: str = "http://localhost:8080/bison/"
bison_outer_url: str = ""
bison_filter_log: bool = False
bison_to_me: bool = True
bison_skip_browser_check: bool = False
@@ -20,9 +22,12 @@ class PlugConfig(BaseSettings):
)
bison_show_network_warning: bool = True
@property
def outer_url(self) -> str:
return self.bison_outer_url or f"http://localhost:{global_config.port}/bison/"
class Config:
extra = "ignore"
global_config = nonebot.get_driver().config
plugin_config = PlugConfig(**global_config.dict())