🐛 fix: Rename 'hysteria2' to 'hysteria' across protocol definitions and schemas for consistency
This commit is contained in:
parent
92665293ec
commit
5816dd5198
@ -36,9 +36,13 @@ export type ProtocolName =
|
|||||||
| 'vmess'
|
| 'vmess'
|
||||||
| 'vless'
|
| 'vless'
|
||||||
| 'trojan'
|
| 'trojan'
|
||||||
| 'hysteria2'
|
| 'hysteria'
|
||||||
| 'tuic'
|
| 'tuic'
|
||||||
| 'anytls';
|
| 'anytls'
|
||||||
|
| 'naive'
|
||||||
|
| 'http'
|
||||||
|
| 'socks'
|
||||||
|
| 'mieru';
|
||||||
|
|
||||||
const buildSchema = (t: ReturnType<typeof useTranslations>) =>
|
const buildSchema = (t: ReturnType<typeof useTranslations>) =>
|
||||||
z.object({
|
z.object({
|
||||||
|
|||||||
@ -3,7 +3,7 @@ export const protocols = [
|
|||||||
'vmess',
|
'vmess',
|
||||||
'vless',
|
'vless',
|
||||||
'trojan',
|
'trojan',
|
||||||
'hysteria2',
|
'hysteria',
|
||||||
'tuic',
|
'tuic',
|
||||||
'anytls',
|
'anytls',
|
||||||
'socks',
|
'socks',
|
||||||
@ -64,7 +64,7 @@ export const SECURITY = {
|
|||||||
vmess: ['none', 'tls'] as const,
|
vmess: ['none', 'tls'] as const,
|
||||||
vless: ['none', 'tls', 'reality'] as const,
|
vless: ['none', 'tls', 'reality'] as const,
|
||||||
trojan: ['tls'] as const,
|
trojan: ['tls'] as const,
|
||||||
hysteria2: ['tls'] as const,
|
hysteria: ['tls'] as const,
|
||||||
tuic: ['tls'] as const,
|
tuic: ['tls'] as const,
|
||||||
anytls: ['tls'] as const,
|
anytls: ['tls'] as const,
|
||||||
naive: ['none', 'tls'] as const,
|
naive: ['none', 'tls'] as const,
|
||||||
|
|||||||
@ -90,9 +90,9 @@ export function getProtocolDefaultConfig(proto: ProtocolType) {
|
|||||||
cert_dns_env: null,
|
cert_dns_env: null,
|
||||||
ratio: 1,
|
ratio: 1,
|
||||||
} as any;
|
} as any;
|
||||||
case 'hysteria2':
|
case 'hysteria':
|
||||||
return {
|
return {
|
||||||
type: 'hysteria2',
|
type: 'hysteria',
|
||||||
enable: false,
|
enable: false,
|
||||||
port: null,
|
port: null,
|
||||||
hop_ports: null,
|
hop_ports: null,
|
||||||
|
|||||||
@ -603,7 +603,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
|||||||
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
hysteria2: [
|
hysteria: [
|
||||||
{
|
{
|
||||||
name: 'ratio',
|
name: 'ratio',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
|||||||
@ -104,16 +104,16 @@ const trojan = z.object({
|
|||||||
cert_dns_env: nullableString,
|
cert_dns_env: nullableString,
|
||||||
});
|
});
|
||||||
|
|
||||||
const hysteria2 = z.object({
|
const hysteria = z.object({
|
||||||
ratio: nullableRatio,
|
ratio: nullableRatio,
|
||||||
type: z.literal('hysteria2'),
|
type: z.literal('hysteria'),
|
||||||
enable: nullableBool,
|
enable: nullableBool,
|
||||||
hop_ports: nullableString,
|
hop_ports: nullableString,
|
||||||
hop_interval: z.number().nullish(),
|
hop_interval: z.number().nullish(),
|
||||||
obfs_password: nullableString,
|
obfs_password: nullableString,
|
||||||
obfs: z.enum(['none', 'salamander'] as const).nullish(),
|
obfs: z.enum(['none', 'salamander'] as const).nullish(),
|
||||||
port: nullablePort,
|
port: nullablePort,
|
||||||
security: z.enum(SECURITY.hysteria2).nullish(),
|
security: z.enum(SECURITY.hysteria).nullish(),
|
||||||
sni: nullableString,
|
sni: nullableString,
|
||||||
allow_insecure: nullableBool,
|
allow_insecure: nullableBool,
|
||||||
fingerprint: nullableString,
|
fingerprint: nullableString,
|
||||||
@ -207,7 +207,7 @@ export const protocolApiScheme = z.discriminatedUnion('type', [
|
|||||||
vmess,
|
vmess,
|
||||||
vless,
|
vless,
|
||||||
trojan,
|
trojan,
|
||||||
hysteria2,
|
hysteria,
|
||||||
tuic,
|
tuic,
|
||||||
anytls,
|
anytls,
|
||||||
socks,
|
socks,
|
||||||
|
|||||||
@ -53,23 +53,6 @@ const dnsConfigSchema = z.object({
|
|||||||
const outboundConfigSchema = z.object({
|
const outboundConfigSchema = z.object({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
protocol: z.string(),
|
protocol: z.string(),
|
||||||
// z.enum([
|
|
||||||
// 'http',
|
|
||||||
// 'https',
|
|
||||||
// 'socks5',
|
|
||||||
// 'shadowsocks',
|
|
||||||
// 'vmess',
|
|
||||||
// 'vless',
|
|
||||||
// 'trojan',
|
|
||||||
// 'hysteria2',
|
|
||||||
// 'tuic',
|
|
||||||
// 'naive',
|
|
||||||
// 'brook',
|
|
||||||
// 'snell',
|
|
||||||
// 'wireguard',
|
|
||||||
// 'direct',
|
|
||||||
// 'reject',
|
|
||||||
// ]),
|
|
||||||
address: z.string(),
|
address: z.string(),
|
||||||
port: z.number(),
|
port: z.number(),
|
||||||
password: z.string().optional(),
|
password: z.string().optional(),
|
||||||
|
|||||||
2
apps/admin/services/admin/typings.d.ts
vendored
2
apps/admin/services/admin/typings.d.ts
vendored
@ -1272,7 +1272,7 @@ declare namespace API {
|
|||||||
has_migrate: boolean;
|
has_migrate: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Hysteria2 = {
|
type Hysteria = {
|
||||||
port: number;
|
port: number;
|
||||||
hop_ports: string;
|
hop_ports: string;
|
||||||
hop_interval: number;
|
hop_interval: number;
|
||||||
|
|||||||
2
apps/admin/services/common/typings.d.ts
vendored
2
apps/admin/services/common/typings.d.ts
vendored
@ -324,7 +324,7 @@ declare namespace API {
|
|||||||
state: string;
|
state: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Hysteria2 = {
|
type Hysteria = {
|
||||||
port: number;
|
port: number;
|
||||||
hop_ports: string;
|
hop_ports: string;
|
||||||
hop_interval: number;
|
hop_interval: number;
|
||||||
|
|||||||
2
apps/user/services/common/typings.d.ts
vendored
2
apps/user/services/common/typings.d.ts
vendored
@ -324,7 +324,7 @@ declare namespace API {
|
|||||||
state: string;
|
state: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Hysteria2 = {
|
type Hysteria = {
|
||||||
port: number;
|
port: number;
|
||||||
hop_ports: string;
|
hop_ports: string;
|
||||||
hop_interval: number;
|
hop_interval: number;
|
||||||
|
|||||||
2
apps/user/services/user/typings.d.ts
vendored
2
apps/user/services/user/typings.d.ts
vendored
@ -343,7 +343,7 @@ declare namespace API {
|
|||||||
list: Ticket[];
|
list: Ticket[];
|
||||||
};
|
};
|
||||||
|
|
||||||
type Hysteria2 = {
|
type Hysteria = {
|
||||||
port: number;
|
port: number;
|
||||||
hop_ports: string;
|
hop_ports: string;
|
||||||
hop_interval: number;
|
hop_interval: number;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user