✨ feat: Update server configuration translations for multiple languages
- Added new keys for server configuration actions and descriptions in Russian, Thai, Turkish, Ukrainian, Vietnamese, Chinese (Simplified and Traditional). - Removed outdated configuration structure and replaced it with a more organized server_config object. - Enhanced the dynamic Inputs component to support textarea input type for better user experience.
This commit is contained in:
@@ -60,6 +60,7 @@ export const TRANSPORTS = {
|
||||
} as const;
|
||||
|
||||
export const SECURITY = {
|
||||
shadowsocks: ['none', 'http', 'tls'] as const,
|
||||
vmess: ['none', 'tls'] as const,
|
||||
vless: ['none', 'tls', 'reality'] as const,
|
||||
trojan: ['tls'] as const,
|
||||
@@ -91,6 +92,8 @@ export const FINGERPRINTS = [
|
||||
'qq',
|
||||
] as const;
|
||||
|
||||
export const CERT_MODES = ['none', 'http', 'dns', 'self'] as const;
|
||||
|
||||
export const multiplexLevels = ['none', 'low', 'middle', 'high'] as const;
|
||||
|
||||
export function getLabel(value: string): string {
|
||||
|
||||
@@ -10,36 +10,85 @@ export function getProtocolDefaultConfig(proto: ProtocolType) {
|
||||
port: null,
|
||||
cipher: 'chacha20-ietf-poly1305',
|
||||
server_key: null,
|
||||
obfs: 'none',
|
||||
obfs_host: null,
|
||||
obfs_path: null,
|
||||
security: 'none',
|
||||
host: null,
|
||||
path: null,
|
||||
sni: null,
|
||||
allow_insecure: null,
|
||||
cert_mode: 'none',
|
||||
cert_dns_provider: null,
|
||||
cert_dns_env: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
case 'vmess':
|
||||
return {
|
||||
type: 'vmess',
|
||||
enable: false,
|
||||
host: null,
|
||||
port: null,
|
||||
transport: 'tcp',
|
||||
security: 'none',
|
||||
path: null,
|
||||
service_name: null,
|
||||
sni: null,
|
||||
allow_insecure: null,
|
||||
fingerprint: 'chrome',
|
||||
cert_mode: 'none',
|
||||
cert_dns_provider: null,
|
||||
cert_dns_env: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
case 'vless':
|
||||
return {
|
||||
type: 'vless',
|
||||
enable: false,
|
||||
host: null,
|
||||
port: null,
|
||||
transport: 'tcp',
|
||||
security: 'none',
|
||||
flow: 'none',
|
||||
path: null,
|
||||
service_name: null,
|
||||
sni: null,
|
||||
allow_insecure: null,
|
||||
fingerprint: 'chrome',
|
||||
reality_server_addr: null,
|
||||
reality_server_port: null,
|
||||
reality_private_key: null,
|
||||
reality_public_key: null,
|
||||
reality_short_id: null,
|
||||
xhttp_mode: XHTTP_MODES[0], // 'auto'
|
||||
xhttp_extra: null,
|
||||
encryption: 'none',
|
||||
encryption_mode: null,
|
||||
encryption_rtt: null,
|
||||
encryption_ticket: null,
|
||||
encryption_server_padding: null,
|
||||
encryption_private_key: null,
|
||||
encryption_client_padding: null,
|
||||
encryption_password: null,
|
||||
cert_mode: 'none',
|
||||
cert_dns_provider: null,
|
||||
cert_dns_env: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
case 'trojan':
|
||||
return {
|
||||
type: 'trojan',
|
||||
enable: false,
|
||||
host: null,
|
||||
port: null,
|
||||
transport: 'tcp',
|
||||
security: 'tls',
|
||||
path: null,
|
||||
service_name: null,
|
||||
sni: null,
|
||||
allow_insecure: null,
|
||||
fingerprint: 'chrome',
|
||||
cert_mode: 'none',
|
||||
cert_dns_provider: null,
|
||||
cert_dns_env: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
case 'hysteria2':
|
||||
return {
|
||||
@@ -53,6 +102,13 @@ export function getProtocolDefaultConfig(proto: ProtocolType) {
|
||||
security: 'tls',
|
||||
up_mbps: null,
|
||||
down_mbps: null,
|
||||
sni: null,
|
||||
allow_insecure: null,
|
||||
fingerprint: 'chrome',
|
||||
cert_mode: 'none',
|
||||
cert_dns_provider: null,
|
||||
cert_dns_env: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
case 'tuic':
|
||||
return {
|
||||
@@ -67,12 +123,17 @@ export function getProtocolDefaultConfig(proto: ProtocolType) {
|
||||
sni: null,
|
||||
allow_insecure: false,
|
||||
fingerprint: 'chrome',
|
||||
cert_mode: 'none',
|
||||
cert_dns_provider: null,
|
||||
cert_dns_env: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
case 'socks':
|
||||
return {
|
||||
type: 'socks',
|
||||
enable: false,
|
||||
port: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
case 'naive':
|
||||
return {
|
||||
@@ -80,6 +141,13 @@ export function getProtocolDefaultConfig(proto: ProtocolType) {
|
||||
enable: false,
|
||||
port: null,
|
||||
security: 'none',
|
||||
sni: null,
|
||||
allow_insecure: null,
|
||||
fingerprint: 'chrome',
|
||||
cert_mode: 'none',
|
||||
cert_dns_provider: null,
|
||||
cert_dns_env: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
case 'http':
|
||||
return {
|
||||
@@ -87,6 +155,13 @@ export function getProtocolDefaultConfig(proto: ProtocolType) {
|
||||
enable: false,
|
||||
port: null,
|
||||
security: 'none',
|
||||
sni: null,
|
||||
allow_insecure: null,
|
||||
fingerprint: 'chrome',
|
||||
cert_mode: 'none',
|
||||
cert_dns_provider: null,
|
||||
cert_dns_env: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
case 'mieru':
|
||||
return {
|
||||
@@ -106,6 +181,10 @@ export function getProtocolDefaultConfig(proto: ProtocolType) {
|
||||
sni: null,
|
||||
allow_insecure: false,
|
||||
fingerprint: 'chrome',
|
||||
cert_mode: 'none',
|
||||
cert_dns_provider: null,
|
||||
cert_dns_env: null,
|
||||
ratio: 1,
|
||||
} as any;
|
||||
default:
|
||||
return {} as any;
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
generateRealityShortId,
|
||||
} from '../generate';
|
||||
import {
|
||||
CERT_MODES,
|
||||
ENCRYPTION_MODES,
|
||||
ENCRYPTION_RTT,
|
||||
ENCRYPTION_TYPES,
|
||||
@@ -22,11 +23,20 @@ import type { FieldConfig } from './types';
|
||||
|
||||
export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
shadowsocks: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -55,36 +65,85 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
].includes(p.cipher),
|
||||
},
|
||||
{
|
||||
name: 'obfs',
|
||||
name: 'security',
|
||||
type: 'select',
|
||||
label: 'obfs',
|
||||
options: ['none', 'http', 'tls'],
|
||||
label: 'security',
|
||||
options: SECURITY.shadowsocks,
|
||||
defaultValue: 'none',
|
||||
group: 'obfs',
|
||||
group: 'security',
|
||||
},
|
||||
{
|
||||
name: 'obfs_host',
|
||||
name: 'host',
|
||||
type: 'input',
|
||||
label: 'obfs_host',
|
||||
label: 'host',
|
||||
placeholder: 'e.g. www.bing.com',
|
||||
group: 'obfs',
|
||||
condition: (p) => p.obfs && p.obfs !== 'none',
|
||||
group: 'security',
|
||||
condition: (p) => p.security && p.security !== 'none',
|
||||
},
|
||||
{
|
||||
name: 'obfs_path',
|
||||
name: 'path',
|
||||
type: 'input',
|
||||
label: 'obfs_path',
|
||||
label: 'path',
|
||||
placeholder: 'e.g. /path/to/obfs',
|
||||
group: 'obfs',
|
||||
condition: (p) => p.obfs && p.obfs !== 'none',
|
||||
group: 'security',
|
||||
condition: (p) => p.security && p.security !== 'none',
|
||||
},
|
||||
{
|
||||
name: 'sni',
|
||||
type: 'input',
|
||||
label: 'security_sni',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls',
|
||||
},
|
||||
{
|
||||
name: 'allow_insecure',
|
||||
type: 'switch',
|
||||
label: 'security_allow_insecure',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls',
|
||||
},
|
||||
{
|
||||
name: 'cert_mode',
|
||||
type: 'select',
|
||||
label: 'cert_mode',
|
||||
options: CERT_MODES,
|
||||
defaultValue: 'none',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_provider',
|
||||
type: 'input',
|
||||
label: 'cert_dns_provider',
|
||||
placeholder: 'e.g. cloudflare, aliyun',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_env',
|
||||
type: 'textarea',
|
||||
label: 'cert_dns_env',
|
||||
placeholder:
|
||||
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
],
|
||||
vmess: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -151,13 +210,48 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
group: 'security',
|
||||
condition: (p) => p.security !== 'none',
|
||||
},
|
||||
{
|
||||
name: 'cert_mode',
|
||||
type: 'select',
|
||||
label: 'cert_mode',
|
||||
options: CERT_MODES,
|
||||
defaultValue: 'none',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_provider',
|
||||
type: 'input',
|
||||
label: 'cert_dns_provider',
|
||||
placeholder: 'e.g. cloudflare, aliyun',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_env',
|
||||
type: 'textarea',
|
||||
label: 'cert_dns_env',
|
||||
placeholder:
|
||||
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
],
|
||||
vless: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -374,13 +468,48 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
group: 'encryption',
|
||||
condition: (p) => p.encryption === 'mlkem768x25519plus',
|
||||
},
|
||||
{
|
||||
name: 'cert_mode',
|
||||
type: 'select',
|
||||
label: 'cert_mode',
|
||||
options: CERT_MODES,
|
||||
defaultValue: 'none',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_provider',
|
||||
type: 'input',
|
||||
label: 'cert_dns_provider',
|
||||
placeholder: 'e.g. cloudflare, aliyun',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_env',
|
||||
type: 'textarea',
|
||||
label: 'cert_dns_env',
|
||||
placeholder:
|
||||
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
],
|
||||
trojan: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -447,13 +576,48 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
group: 'security',
|
||||
condition: (p) => p.security !== 'none',
|
||||
},
|
||||
{
|
||||
name: 'cert_mode',
|
||||
type: 'select',
|
||||
label: 'cert_mode',
|
||||
options: CERT_MODES,
|
||||
defaultValue: 'none',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_provider',
|
||||
type: 'input',
|
||||
label: 'cert_dns_provider',
|
||||
placeholder: 'e.g. cloudflare, aliyun',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_env',
|
||||
type: 'textarea',
|
||||
label: 'cert_dns_env',
|
||||
placeholder:
|
||||
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
],
|
||||
hysteria2: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -470,7 +634,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
type: 'number',
|
||||
label: 'hop_interval',
|
||||
placeholder: 'e.g. 300',
|
||||
min: 0,
|
||||
min: 1,
|
||||
suffix: 'S',
|
||||
group: 'basic',
|
||||
},
|
||||
@@ -497,7 +661,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
name: 'up_mbps',
|
||||
type: 'number',
|
||||
label: 'up_mbps',
|
||||
min: 0,
|
||||
min: 1,
|
||||
placeholder: (t) => t('bandwidth_placeholder'),
|
||||
suffix: 'Mbps',
|
||||
group: 'basic',
|
||||
@@ -506,7 +670,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
name: 'down_mbps',
|
||||
type: 'number',
|
||||
label: 'down_mbps',
|
||||
min: 0,
|
||||
min: 1,
|
||||
placeholder: (t) => t('bandwidth_placeholder'),
|
||||
suffix: 'Mbps',
|
||||
group: 'basic',
|
||||
@@ -521,13 +685,47 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
defaultValue: 'chrome',
|
||||
group: 'security',
|
||||
},
|
||||
{
|
||||
name: 'cert_mode',
|
||||
type: 'select',
|
||||
label: 'cert_mode',
|
||||
options: CERT_MODES,
|
||||
defaultValue: 'none',
|
||||
group: 'security',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_provider',
|
||||
type: 'input',
|
||||
label: 'cert_dns_provider',
|
||||
placeholder: 'e.g. cloudflare, aliyun',
|
||||
group: 'security',
|
||||
condition: (p) => p.cert_mode === 'dns',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_env',
|
||||
type: 'textarea',
|
||||
label: 'cert_dns_env',
|
||||
placeholder:
|
||||
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
|
||||
group: 'security',
|
||||
condition: (p) => p.cert_mode === 'dns',
|
||||
},
|
||||
],
|
||||
tuic: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -560,24 +758,67 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
defaultValue: 'chrome',
|
||||
group: 'security',
|
||||
},
|
||||
{
|
||||
name: 'cert_mode',
|
||||
type: 'select',
|
||||
label: 'cert_mode',
|
||||
options: CERT_MODES,
|
||||
defaultValue: 'none',
|
||||
group: 'security',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_provider',
|
||||
type: 'input',
|
||||
label: 'cert_dns_provider',
|
||||
placeholder: 'e.g. cloudflare, aliyun',
|
||||
group: 'security',
|
||||
condition: (p) => p.cert_mode === 'dns',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_env',
|
||||
type: 'textarea',
|
||||
label: 'cert_dns_env',
|
||||
placeholder:
|
||||
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
|
||||
group: 'security',
|
||||
condition: (p) => p.cert_mode === 'dns',
|
||||
},
|
||||
],
|
||||
socks: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
},
|
||||
],
|
||||
naive: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -613,13 +854,48 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
group: 'security',
|
||||
condition: (p) => p.security !== 'none',
|
||||
},
|
||||
{
|
||||
name: 'cert_mode',
|
||||
type: 'select',
|
||||
label: 'cert_mode',
|
||||
options: CERT_MODES,
|
||||
defaultValue: 'none',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_provider',
|
||||
type: 'input',
|
||||
label: 'cert_dns_provider',
|
||||
placeholder: 'e.g. cloudflare, aliyun',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_env',
|
||||
type: 'textarea',
|
||||
label: 'cert_dns_env',
|
||||
placeholder:
|
||||
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
],
|
||||
http: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -655,13 +931,48 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
group: 'security',
|
||||
condition: (p) => p.security !== 'none',
|
||||
},
|
||||
{
|
||||
name: 'cert_mode',
|
||||
type: 'select',
|
||||
label: 'cert_mode',
|
||||
options: CERT_MODES,
|
||||
defaultValue: 'none',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_provider',
|
||||
type: 'input',
|
||||
label: 'cert_dns_provider',
|
||||
placeholder: 'e.g. cloudflare, aliyun',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_env',
|
||||
type: 'textarea',
|
||||
label: 'cert_dns_env',
|
||||
placeholder:
|
||||
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
|
||||
group: 'security',
|
||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||
},
|
||||
],
|
||||
mieru: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -684,11 +995,20 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
},
|
||||
],
|
||||
anytls: [
|
||||
{
|
||||
name: 'ratio',
|
||||
type: 'number',
|
||||
label: 'traffic_ratio',
|
||||
min: 1,
|
||||
step: 0.01,
|
||||
defaultValue: 1,
|
||||
group: 'basic',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
type: 'number',
|
||||
label: 'port',
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 65535,
|
||||
placeholder: '1-65535',
|
||||
group: 'basic',
|
||||
@@ -710,5 +1030,30 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||
defaultValue: 'chrome',
|
||||
group: 'security',
|
||||
},
|
||||
{
|
||||
name: 'cert_mode',
|
||||
type: 'select',
|
||||
label: 'cert_mode',
|
||||
options: CERT_MODES,
|
||||
defaultValue: 'none',
|
||||
group: 'security',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_provider',
|
||||
type: 'input',
|
||||
label: 'cert_dns_provider',
|
||||
placeholder: 'e.g. cloudflare, aliyun',
|
||||
group: 'security',
|
||||
condition: (p) => p.cert_mode === 'dns',
|
||||
},
|
||||
{
|
||||
name: 'cert_dns_env',
|
||||
type: 'textarea',
|
||||
label: 'cert_dns_env',
|
||||
placeholder:
|
||||
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
|
||||
group: 'security',
|
||||
condition: (p) => p.cert_mode === 'dns',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
CERT_MODES,
|
||||
ENCRYPTION_MODES,
|
||||
ENCRYPTION_RTT,
|
||||
ENCRYPTION_TYPES,
|
||||
@@ -16,20 +17,25 @@ import {
|
||||
const nullableString = z.string().nullish();
|
||||
const nullableBool = z.boolean().nullish();
|
||||
const nullablePort = z.number().int().min(0).max(65535).nullish();
|
||||
const nullableRatio = z.number().min(1).nullish();
|
||||
|
||||
const ss = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('shadowsocks'),
|
||||
enable: nullableBool,
|
||||
host: nullableString,
|
||||
port: nullablePort,
|
||||
cipher: z.enum(SS_CIPHERS).nullish(),
|
||||
server_key: nullableString,
|
||||
obfs: z.enum(['none', 'http', 'tls'] as const).nullish(),
|
||||
obfs_host: nullableString,
|
||||
obfs_path: nullableString,
|
||||
security: z.enum(SECURITY.shadowsocks).nullish(),
|
||||
host: nullableString,
|
||||
path: nullableString,
|
||||
cert_mode: z.enum(CERT_MODES).nullish(),
|
||||
cert_dns_provider: nullableString,
|
||||
cert_dns_env: nullableString,
|
||||
});
|
||||
|
||||
const vmess = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('vmess'),
|
||||
enable: nullableBool,
|
||||
host: nullableString,
|
||||
@@ -41,9 +47,13 @@ const vmess = z.object({
|
||||
sni: nullableString,
|
||||
allow_insecure: nullableBool,
|
||||
fingerprint: nullableString,
|
||||
cert_mode: z.enum(CERT_MODES).nullish(),
|
||||
cert_dns_provider: nullableString,
|
||||
cert_dns_env: nullableString,
|
||||
});
|
||||
|
||||
const vless = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('vless'),
|
||||
enable: nullableBool,
|
||||
host: nullableString,
|
||||
@@ -71,9 +81,13 @@ const vless = z.object({
|
||||
encryption_private_key: nullableString,
|
||||
encryption_client_padding: nullableString,
|
||||
encryption_password: nullableString,
|
||||
cert_mode: z.enum(CERT_MODES).nullish(),
|
||||
cert_dns_provider: nullableString,
|
||||
cert_dns_env: nullableString,
|
||||
});
|
||||
|
||||
const trojan = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('trojan'),
|
||||
enable: nullableBool,
|
||||
host: nullableString,
|
||||
@@ -85,9 +99,13 @@ const trojan = z.object({
|
||||
sni: nullableString,
|
||||
allow_insecure: nullableBool,
|
||||
fingerprint: nullableString,
|
||||
cert_mode: z.enum(CERT_MODES).nullish(),
|
||||
cert_dns_provider: nullableString,
|
||||
cert_dns_env: nullableString,
|
||||
});
|
||||
|
||||
const hysteria2 = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('hysteria2'),
|
||||
enable: nullableBool,
|
||||
hop_ports: nullableString,
|
||||
@@ -101,9 +119,13 @@ const hysteria2 = z.object({
|
||||
fingerprint: nullableString,
|
||||
up_mbps: z.number().nullish(),
|
||||
down_mbps: z.number().nullish(),
|
||||
cert_mode: z.enum(CERT_MODES).nullish(),
|
||||
cert_dns_provider: nullableString,
|
||||
cert_dns_env: nullableString,
|
||||
});
|
||||
|
||||
const tuic = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('tuic'),
|
||||
enable: nullableBool,
|
||||
host: nullableString,
|
||||
@@ -116,9 +138,13 @@ const tuic = z.object({
|
||||
sni: nullableString,
|
||||
allow_insecure: nullableBool,
|
||||
fingerprint: nullableString,
|
||||
cert_mode: z.enum(CERT_MODES).nullish(),
|
||||
cert_dns_provider: nullableString,
|
||||
cert_dns_env: nullableString,
|
||||
});
|
||||
|
||||
const anytls = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('anytls'),
|
||||
enable: nullableBool,
|
||||
port: nullablePort,
|
||||
@@ -127,15 +153,20 @@ const anytls = z.object({
|
||||
allow_insecure: nullableBool,
|
||||
fingerprint: nullableString,
|
||||
padding_scheme: nullableString,
|
||||
cert_mode: z.enum(CERT_MODES).nullish(),
|
||||
cert_dns_provider: nullableString,
|
||||
cert_dns_env: nullableString,
|
||||
});
|
||||
|
||||
const socks = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('socks'),
|
||||
enable: nullableBool,
|
||||
port: nullablePort,
|
||||
});
|
||||
|
||||
const naive = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('naive'),
|
||||
enable: nullableBool,
|
||||
port: nullablePort,
|
||||
@@ -143,9 +174,13 @@ const naive = z.object({
|
||||
sni: nullableString,
|
||||
allow_insecure: nullableBool,
|
||||
fingerprint: nullableString,
|
||||
cert_mode: z.enum(CERT_MODES).nullish(),
|
||||
cert_dns_provider: nullableString,
|
||||
cert_dns_env: nullableString,
|
||||
});
|
||||
|
||||
const http = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('http'),
|
||||
enable: nullableBool,
|
||||
port: nullablePort,
|
||||
@@ -153,9 +188,13 @@ const http = z.object({
|
||||
sni: nullableString,
|
||||
allow_insecure: nullableBool,
|
||||
fingerprint: nullableString,
|
||||
cert_mode: z.enum(CERT_MODES).nullish(),
|
||||
cert_dns_provider: nullableString,
|
||||
cert_dns_env: nullableString,
|
||||
});
|
||||
|
||||
const mieru = z.object({
|
||||
ratio: nullableRatio,
|
||||
type: z.literal('mieru'),
|
||||
enable: nullableBool,
|
||||
port: nullablePort,
|
||||
@@ -182,6 +221,5 @@ export const formSchema = z.object({
|
||||
address: z.string().min(1),
|
||||
country: z.string().optional(),
|
||||
city: z.string().optional(),
|
||||
ratio: z.number().default(1),
|
||||
protocols: z.array(protocolApiScheme),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user