Jelajahi Sumber

fix(schemas): widen VLESS decryption/encryption to accept PQ values

The post-quantum auth blocks (ML-KEM-768, X25519) populate
`settings.decryption` / `settings.encryption` with values like
`mlkem768x25519plus.<base64>` and `xchacha20-poly1305.aead.x25519`,
but the schema pinned both fields to z.literal('none') so saving an
inbound after picking "ML-KEM-768 auth" failed with
`Invalid input: expected "none"`.

Relax both fields (inbound + outbound + outbound form) to
z.string().min(1) keeping the 'none' default. xray-core does its own
validation server-side so a string check at the form boundary is
enough.
MHSanaei 14 jam lalu
induk
melakukan
87eaa79e5d

+ 1 - 1
frontend/src/schemas/forms/outbound-form.ts

@@ -64,7 +64,7 @@ export const VlessOutboundFormSettingsSchema = z.object({
   port: PortSchema.default(443),
   id: z.string().default(''),
   flow: z.string().default(''),
-  encryption: z.literal('none').default('none'),
+  encryption: z.string().min(1).default('none'),
   reverseTag: z.string().default(''),
   reverseSniffing: ReverseSniffingFormSchema.default({
     enabled: false,

+ 2 - 2
frontend/src/schemas/protocols/inbound/vless.ts

@@ -39,8 +39,8 @@ export type VlessClient = z.infer<typeof VlessClientSchema>;
 
 export const VlessInboundSettingsSchema = z.object({
   clients: z.array(VlessClientSchema).default([]),
-  decryption: z.literal('none').default('none'),
-  encryption: z.literal('none').default('none'),
+  decryption: z.string().min(1).default('none'),
+  encryption: z.string().min(1).default('none'),
   fallbacks: z.array(VlessFallbackSchema).default([]),
   // TODO: narrow to flow === 'xtls-rprx-vision' once a per-flow discriminator
   // exists. 4-positive-int padding seed for xtls-rprx-vision; backend uses

+ 1 - 1
frontend/src/schemas/protocols/outbound/vless.ts

@@ -7,7 +7,7 @@ export const VlessOutboundSettingsSchema = z.object({
   port: z.number().int().min(1).max(65535),
   id: z.uuid(),
   flow: FlowSchema.default(''),
-  encryption: z.literal('none').default('none'),
+  encryption: z.string().min(1).default('none'),
   reverse: z
     .object({
       tag: z.string(),