fix(subscribe): clean deleted rule group references

This commit is contained in:
jxxghp
2026-08-26 20:58:15 +08:00
parent 1933887472
commit 88703d645a
7 changed files with 311 additions and 101 deletions
+15
View File
@@ -4,6 +4,7 @@
"""
import threading
from collections.abc import Iterable
from typing import Dict, List, Optional
from pyparsing import (
@@ -85,6 +86,20 @@ class RuleHelper:
)
def replace_group_name_in_list(
values: Optional[Iterable[str]],
old_name: str,
new_name: str,
) -> list[str]:
"""更新配置里的规则组名引用,并顺手去重。"""
result = []
for value in values or []:
mapped = new_name if value == old_name else value
if mapped not in result:
result.append(mapped)
return result
# 内置规则只在这里维护一份,便于过滤模块和 Agent 工具共享同一套事实来源。
BUILTIN_RULE_SET: Dict[str, dict] = {
# 蓝光原盘