mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-05 07:26:36 +08:00
[优化] 添加 WAF IP 组功能,包括 CRUD 接口和前端页面支持
This commit is contained in:
@@ -3,6 +3,9 @@ import { apiRequest } from '@/lib/api/client';
|
||||
import type {
|
||||
WAFRuleGroup,
|
||||
WAFRuleGroupPayload,
|
||||
WAFIPGroup,
|
||||
WAFIPGroupPayload,
|
||||
WAFIPGroupSyncResult,
|
||||
WAFSiteRuleGroups,
|
||||
} from '@/features/waf/types';
|
||||
|
||||
@@ -47,3 +50,37 @@ export function replaceWAFSiteRuleGroups(routeId: number, ids: number[]) {
|
||||
body: JSON.stringify({ ids }),
|
||||
});
|
||||
}
|
||||
|
||||
export function getWAFIPGroups() {
|
||||
return apiRequest<WAFIPGroup[]>('/waf/ip-groups');
|
||||
}
|
||||
|
||||
export function getWAFIPGroup(id: number) {
|
||||
return apiRequest<WAFIPGroup>(`/waf/ip-groups/${id}`);
|
||||
}
|
||||
|
||||
export function createWAFIPGroup(payload: WAFIPGroupPayload) {
|
||||
return apiRequest<WAFIPGroup>('/waf/ip-groups', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export function updateWAFIPGroup(id: number, payload: WAFIPGroupPayload) {
|
||||
return apiRequest<WAFIPGroup>(`/waf/ip-groups/${id}/update`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteWAFIPGroup(id: number) {
|
||||
return apiRequest<void>(`/waf/ip-groups/${id}/delete`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export function syncWAFIPGroup(id: number) {
|
||||
return apiRequest<WAFIPGroupSyncResult>(`/waf/ip-groups/${id}/sync`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user