🐛 fix: Rename 'hysteria2' to 'hysteria' across protocol definitions and schemas for consistency

This commit is contained in:
web 2025-09-29 02:32:28 -07:00
parent 92665293ec
commit 5816dd5198
10 changed files with 19 additions and 32 deletions

View File

@ -36,9 +36,13 @@ export type ProtocolName =
| 'vmess'
| 'vless'
| 'trojan'
| 'hysteria2'
| 'hysteria'
| 'tuic'
| 'anytls';
| 'anytls'
| 'naive'
| 'http'
| 'socks'
| 'mieru';
const buildSchema = (t: ReturnType<typeof useTranslations>) =>
z.object({

View File

@ -3,7 +3,7 @@ export const protocols = [
'vmess',
'vless',
'trojan',
'hysteria2',
'hysteria',
'tuic',
'anytls',
'socks',
@ -64,7 +64,7 @@ export const SECURITY = {
vmess: ['none', 'tls'] as const,
vless: ['none', 'tls', 'reality'] as const,
trojan: ['tls'] as const,
hysteria2: ['tls'] as const,
hysteria: ['tls'] as const,
tuic: ['tls'] as const,
anytls: ['tls'] as const,
naive: ['none', 'tls'] as const,

View File

@ -90,9 +90,9 @@ export function getProtocolDefaultConfig(proto: ProtocolType) {
cert_dns_env: null,
ratio: 1,
} as any;
case 'hysteria2':
case 'hysteria':
return {
type: 'hysteria2',
type: 'hysteria',
enable: false,
port: null,
hop_ports: null,

View File

@ -603,7 +603,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
},
],
hysteria2: [
hysteria: [
{
name: 'ratio',
type: 'number',

View File

@ -104,16 +104,16 @@ const trojan = z.object({
cert_dns_env: nullableString,
});
const hysteria2 = z.object({
const hysteria = z.object({
ratio: nullableRatio,
type: z.literal('hysteria2'),
type: z.literal('hysteria'),
enable: nullableBool,
hop_ports: nullableString,
hop_interval: z.number().nullish(),
obfs_password: nullableString,
obfs: z.enum(['none', 'salamander'] as const).nullish(),
port: nullablePort,
security: z.enum(SECURITY.hysteria2).nullish(),
security: z.enum(SECURITY.hysteria).nullish(),
sni: nullableString,
allow_insecure: nullableBool,
fingerprint: nullableString,
@ -207,7 +207,7 @@ export const protocolApiScheme = z.discriminatedUnion('type', [
vmess,
vless,
trojan,
hysteria2,
hysteria,
tuic,
anytls,
socks,

View File

@ -53,23 +53,6 @@ const dnsConfigSchema = z.object({
const outboundConfigSchema = z.object({
name: 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(),
port: z.number(),
password: z.string().optional(),

View File

@ -1272,7 +1272,7 @@ declare namespace API {
has_migrate: boolean;
};
type Hysteria2 = {
type Hysteria = {
port: number;
hop_ports: string;
hop_interval: number;

View File

@ -324,7 +324,7 @@ declare namespace API {
state: string;
};
type Hysteria2 = {
type Hysteria = {
port: number;
hop_ports: string;
hop_interval: number;

View File

@ -324,7 +324,7 @@ declare namespace API {
state: string;
};
type Hysteria2 = {
type Hysteria = {
port: number;
hop_ports: string;
hop_interval: number;

View File

@ -343,7 +343,7 @@ declare namespace API {
list: Ticket[];
};
type Hysteria2 = {
type Hysteria = {
port: number;
hop_ports: string;
hop_interval: number;