修复本地屏蔽规则管理

This commit is contained in:
Alex Yang
2025-11-28 00:46:36 +08:00
parent 45ed4d0d6b
commit 0e0ac8b016
14 changed files with 95 additions and 388 deletions

View File

@@ -66,6 +66,9 @@ async function loadLocalRules() {
document.getElementById('local-rules-count').textContent = data.localRulesCount || 0;
}
// 设置当前规则类型
currentRulesType = 'local';
// 合并所有本地规则
let rules = [];
// 添加域名规则
@@ -98,6 +101,8 @@ async function loadLocalRules() {
async function loadRemoteRules() {
showLoading('加载远程规则...');
try {
// 设置当前规则类型
currentRulesType = 'remote';
const response = await fetch('/api/shield/remoterules');
if (!response.ok) {
@@ -212,8 +217,12 @@ async function handleDeleteRule(e) {
}
showSuccessMessage('规则删除成功');
// 重新加载规则
loadLocalRules();
// 根据当前显示的规则类型重新加载对应的规则列表
if (currentRulesType === 'local') {
loadLocalRules();
} else {
loadRemoteRules();
}
// 重新加载统计信息
loadShieldStats();
hideLoading();
@@ -459,6 +468,9 @@ async function handleAddBlacklist() {
// 当前显示的规则类型:'local' 或 'remote'
let currentRulesType = 'local';
// 设置事件监听器
function setupShieldEventListeners() {
// 本地规则管理事件