This commit is contained in:
Alex Yang
2025-11-25 00:35:37 +08:00
parent 9f81b449f1
commit c570f303e7
7 changed files with 56 additions and 50 deletions

View File

@@ -41,7 +41,7 @@ async function loadRules() {
showLoading(rulesPanel);
// 更新API路径使用正确的API路径
const data = await apiRequest('/shield', 'GET');
const data = await apiRequest('/api/shield', 'GET');
// 处理后端返回的复杂对象数据格式
let allRules = [];
@@ -207,7 +207,7 @@ async function addNewRule() {
const processedRule = preprocessRule(rule);
// 使用正确的API路径
const response = await apiRequest('/shield', 'POST', { rule: processedRule });
const response = await apiRequest('/api/shield', 'POST', { rule: processedRule });
// 处理不同的响应格式
if (response.success || response.status === 'success') {
@@ -258,7 +258,7 @@ async function deleteRule(index) {
}
// 使用正确的API路径
const response = await apiRequest('/shield', 'DELETE', { rule });
const response = await apiRequest('/api/shield', 'DELETE', { rule });
// 处理不同的响应格式
if (response.success || response.status === 'success') {
@@ -319,8 +319,8 @@ async function reloadRules() {
const rulesPanel = document.getElementById('rules-panel');
showLoading(rulesPanel);
// 使用正确的API路径和方法 - PUT请求到/shield
await apiRequest('/shield', 'PUT');
// 使用正确的API路径和方法 - PUT请求到/api/shield
await apiRequest('/api/shield', 'PUT');
// 重新加载规则列表
await loadRules();