feat(node): Add serverKey

This commit is contained in:
web@ppanel
2025-01-04 20:26:53 +07:00
parent b2a2f42e53
commit 25ce37ea05
25 changed files with 49 additions and 0 deletions
@@ -36,6 +36,7 @@ const baseProtocolSchema = z.object({
const shadowsocksSchema = z.object({
method: z.string(),
port: portSchema,
server_key: nullableString,
});
const vmessSchema = baseProtocolSchema;
@@ -77,6 +77,7 @@ export default function NodeForm<T extends { [x: string]: any }>({
const transport = form.watch('config.transport');
const security = form.watch('config.security');
const relayMode = form.watch('relay_mode');
const method = form.watch('config.method');
useEffect(() => {
form?.reset(initialValues);
@@ -313,6 +314,30 @@ export default function NodeForm<T extends { [x: string]: any }>({
</FormItem>
)}
/>
{[
'2022-blake3-aes-128-gcm',
'2022-blake3-aes-256-gcm',
'2022-blake3-chacha20-poly1305',
].includes(method) && (
<FormField
control={form.control}
name='config.server_key'
render={({ field }) => (
<FormItem>
<FormLabel>{t('form.serverKey')}</FormLabel>
<FormControl>
<EnhancedInput
{...field}
onValueChange={(value) => {
form.setValue(field.name, value);
}}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
</div>
)}