feat: 插件中心支持禁用/启用插件,修复 CNB 镜像版本检测 - #10
Merged
Merged
Conversation
- 新增禁用插件功能:插件卡片与详情抽屉显示「运行中/已禁用」徽标, 详情抽屉内可一键禁用/启用;基于 run_preprocessor 抛 IgnoredException 在响应器级拦截事件,后台任务不受影响; 禁用列表持久化于 localstore 的 disabled_plugins.json, 重启后仍生效;控制台自身禁止禁用 - 新增 PUT /api/plugins/disabled 接口与 DisabledStore 存储, GET /api/plugins 返回 disabled 标记 - 修复 CNB 镜像版本检测:CNB 无匿名 raw 直链,改用 git 浅克隆 (--depth 1 --filter=blob:none --sparse)读取 pyproject.toml, 镜像连通性测试改用 git ls-remote,实测可正确返回版本号 - 版本号 0.1.3 -> 0.1.5,新增 tests/test_disabled.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
基于最新 master(含已合并的 #9),新增两个改动,本地 NoneBot2 + Python 3.11 实测通过(78 个单元测试全绿,ruff check/format 通过):
1. 插件中心禁用/启用插件
run_preprocessor钩子检测matcher.plugin_name,对已禁用插件抛出IgnoredException,在响应器级拦截事件——被禁插件不再响应消息,已调度的后台任务不受影响disabled_plugins.json,重启后仍生效;控制台自身禁止禁用,防止锁死PUT /api/plugins/disabled接口;GET /api/plugins每项返回disabled标记tests/test_disabled.py(存储读写、拦截钩子、API 校验等 6 个用例)2. 修复 CNB 镜像版本检测
/-/raw返回 SPA 页面,blob 页内容靠 JS 加载)git clone --depth 1 --filter=blob:none --sparse+sparse-checkout set --no-cone /pyproject.toml),镜像连通性测试改用git ls-remotehttps://cnb.cool/MimokitStudio/nonebot-plugin-mimo-console可正确返回版本号其他