bugfix:修复notice事件扩散问题 (#2132)

* bugfix:修复notice事件扩散问题

* 优化并发调度

* bugfix:修复签到样式

* bugfix:功能调用统计修复

* bugfix:修复私聊时功能调用统计显示已退群问题

* 提高插件适配兼容性

* 优化发送队列

* 修改权限检查设计

* 继续修改权限检查设计

* 完善权限检查设计

* 优化sqlite配置

* 优化数据库初始化

* 代码整理,无用代码清理

* bugfix:修复启动时数据库校验问题

* bugfix:修复预算裁剪过于激进问题
This commit is contained in:
Copaan
2026-05-28 22:57:28 +08:00
committed by GitHub
parent 12fc5663fb
commit 5596497947
57 changed files with 7557 additions and 1522 deletions
+39 -3
View File
@@ -18,6 +18,7 @@ from .auth.config import LOGGER_COMMAND
from .auth.context import (
get_event_context,
get_or_create_event_context,
get_permission_side_effect_cache,
resolve_actor_user_id,
resolve_event_channel_id,
resolve_event_group_id,
@@ -25,12 +26,13 @@ from .auth.context import (
)
from .auth_checker import (
LimitManager,
_get_auth_route_precheck_deps,
_get_route_context,
auth,
route_precheck,
start_auth_runtime_tasks,
stop_auth_runtime_tasks,
)
from .auth_route import route_precheck
_SKIP_AUTH_PLUGINS = {"chat_history", "chat_message"}
_BOT_CONNECT_TS: float | None = None
@@ -111,7 +113,7 @@ async def _auth_preprocessor(
)
set_route_modules(state, event_context, route_modules)
if await route_precheck(matcher, event_context):
if await route_precheck(matcher, event_context, **_get_auth_route_precheck_deps()):
return
try:
@@ -146,6 +148,7 @@ async def _unblock_after_matcher(
session: Uninfo,
event: Event,
state: T_State,
exception: Exception | None = None,
):
context = get_event_context(state)
if context is not None:
@@ -164,4 +167,37 @@ async def _unblock_after_matcher(
group_id = session.group.id
if user_id and matcher.plugin:
module = matcher.plugin.name
LimitManager.unblock(module, user_id, group_id, channel_id)
side_effects = get_permission_side_effect_cache(
state=state,
event_cache=context.event_cache if context is not None else None,
)
commit = side_effects.commits.get(module)
if (
commit is not None
and not commit.committed
and commit.owner_matcher_id == id(matcher)
):
side_effects.commits.pop(module, None)
if exception is None:
try:
await commit.commit_all()
side_effects.auth_results[module] = (True, None)
except Exception as exc:
await commit.rollback_all("commit_failed")
logger.error(
"auth side effect commit failed",
LOGGER_COMMAND,
e=exc,
)
else:
await commit.rollback_all("matcher_exception")
if commit.limit_should_auto_unblock:
limit_entity = commit.limit_entity
LimitManager.unblock(
module,
limit_entity.user_id if limit_entity else user_id,
limit_entity.group_id if limit_entity else group_id,
limit_entity.channel_id if limit_entity else channel_id,
)
else:
LimitManager.unblock(module, user_id, group_id, channel_id)