fix(api): отклонять несогласованные объекты IPsec и VXLAN

This commit is contained in:
Denozordec committed 2026-09-30 15:25:29 +07:00
1 parent 0e0f98e0f4
commit d112935c73
6 files changed
+31 -7

No files matched your search

+5 -1
View File
@@ -26,7 +26,11 @@ export async function listIpsec(
const clientIds = data.clients.map(c => c.id)
const failedIds = (data.failures ?? []).map(f => f.serverId)
if (new Set(serverIds).size !== serverIds.length || new Set(clientIds).size !== clientIds.length ||
new Set(failedIds).size !== failedIds.length || serverIds.some(id => failedIds.includes(id)) ||
new Set(failedIds).size !== failedIds.length || failedIds.some(id => !id.trim()) ||
data.servers.some(s => s.peers.some(p => p.serverId !== s.serverId) ||
new Set(s.peers.map(p => p.id)).size !== s.peers.length ||
[s.peer, s.pool, s.sharedModeConfig].some(child => child && child.serverId !== s.serverId) ||
new Set((s.certs ?? []).map(c => c.name)).size !== (s.certs ?? []).length) || serverIds.some(id => failedIds.includes(id)) ||
data.clients.some(c => failedIds.includes(c.serverId)) ||
(opts?.serverId && [...serverIds, ...failedIds, ...data.clients.map(c => c.serverId)].some(id => id !== opts.serverId))) {
throw new Error("Несогласованный ответ загрузки IPsec")