fix(ui): защищать чтение WireGuard при смене источника

This commit is contained in:
Denozordec committed 2026-10-04 12:48:24 +07:00
1 parent e51964b4d2
commit c7aec1500c
11 files changed
+182 -53

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
import { z } from "zod"
import { serverReadSchema } from "@mmapp/contracts/servers"
const server = serverReadSchema.pick({id:true,name:true,host:true,country:true,type:true,enabled:true,asn:true,status:true,latency:true})
.partial({type:true,asn:true,status:true,latency:true})
.extend({id:z.number().int().positive().max(Number.MAX_SAFE_INTEGER),host:z.string().trim().min(1),latency:z.number().finite().nonnegative().nullable().optional()})
export const wireGuardServersSchema = z.array(server).refine(rows => new Set(rows.map(row => row.id)).size === rows.length)