🐛 fix: Update protocol plugin handling and add new options in typings

This commit is contained in:
web 2025-09-13 23:17:21 -07:00
parent 8dffd69b48
commit 6ca24333da
9 changed files with 141 additions and 9 deletions

View File

@ -60,8 +60,8 @@ export const LABELS = {
'middle': 'Middle',
'high': 'High',
// ss plugins
'obfs': 'Simple Obfs',
'v2ray-plugin': 'V2Ray Plugin',
'simple-obfs': 'Simple Obfs',
} as const;
// Flat arrays for enum-like sets
@ -75,7 +75,7 @@ export const SS_CIPHERS = [
'2022-blake3-chacha20-poly1305',
] as const;
export const SS_PLUGINS = ['none', 'obfs', 'v2ray-plugin'] as const;
export const SS_PLUGINS = ['none', 'simple-obfs', 'v2ray-plugin'] as const;
export const TRANSPORTS = {
vmess: ['tcp', 'websocket', 'grpc'] as const,
@ -130,7 +130,7 @@ const ss = z.object({
cipher: z.enum(SS_CIPHERS as any).nullish(),
server_key: nullableString,
plugin: z.enum(SS_PLUGINS as any).nullish(),
plugin_opts: nullableString,
plugin_options: nullableString,
});
const vmess = z.object({
@ -399,7 +399,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
label: 'plugin_opts',
placeholder: (t: (key: string) => string, p: any) => {
switch (p.plugin) {
case 'obfs':
case 'simple-obfs':
return 'obfs=http;obfs-host=www.bing.com;path=/';
case 'v2ray-plugin':
return 'WebSocket: mode=websocket;host=mydomain.me;path=/;tls=true\n\nQUIC: mode=quic;host=mydomain.me';
@ -408,7 +408,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
}
},
group: 'plugin',
condition: (p) => ['obfs', 'v2ray-plugin'].includes(p.plugin),
condition: (p) => ['simple-obfs', 'v2ray-plugin'].includes(p.plugin),
},
],
vmess: [

View File

@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as ads from './ads';

View File

@ -1519,6 +1519,18 @@ declare namespace API {
reduce_rtt?: boolean;
udp_relay_mode?: string;
congestion_controller?: string;
/** obfs, v2ray-plugin, simple-obfs */
plugin?: string;
/** plugin options, eg: obfs=http;obfs-host=www.bing.com */
plugin_options?: string;
/** mux, eg: off/low/medium/high */
multiplex?: string;
/** padding scheme */
padding_scheme?: string;
/** upload speed limit */
up_mbps?: number;
/** download speed limit */
down_mbps?: number;
};
type PubilcRegisterConfig = {

View File

@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as auth from './auth';

View File

@ -501,6 +501,46 @@ declare namespace API {
privacy_policy: string;
};
type Protocol = {
type: string;
port: number;
security?: string;
sni?: string;
allow_insecure?: boolean;
fingerprint?: string;
reality_server_addr?: string;
reality_server_port?: number;
reality_private_key?: string;
reality_public_key?: string;
reality_short_id?: string;
transport?: string;
host?: string;
path?: string;
service_name?: string;
cipher?: string;
server_key?: string;
flow?: string;
hop_ports?: string;
hop_interval?: number;
obfs_password?: string;
disable_sni?: boolean;
reduce_rtt?: boolean;
udp_relay_mode?: string;
congestion_controller?: string;
/** obfs, v2ray-plugin, simple-obfs */
plugin?: string;
/** plugin options, eg: obfs=http;obfs-host=www.bing.com */
plugin_options?: string;
/** mux, eg: off/low/medium/high */
multiplex?: string;
/** padding scheme */
padding_scheme?: string;
/** upload speed limit */
up_mbps?: number;
/** download speed limit */
down_mbps?: number;
};
type PubilcRegisterConfig = {
stop_register: boolean;
enable_ip_register_limit: boolean;

View File

@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as auth from './auth';

View File

@ -501,6 +501,46 @@ declare namespace API {
privacy_policy: string;
};
type Protocol = {
type: string;
port: number;
security?: string;
sni?: string;
allow_insecure?: boolean;
fingerprint?: string;
reality_server_addr?: string;
reality_server_port?: number;
reality_private_key?: string;
reality_public_key?: string;
reality_short_id?: string;
transport?: string;
host?: string;
path?: string;
service_name?: string;
cipher?: string;
server_key?: string;
flow?: string;
hop_ports?: string;
hop_interval?: number;
obfs_password?: string;
disable_sni?: boolean;
reduce_rtt?: boolean;
udp_relay_mode?: string;
congestion_controller?: string;
/** obfs, v2ray-plugin, simple-obfs */
plugin?: string;
/** plugin options, eg: obfs=http;obfs-host=www.bing.com */
plugin_options?: string;
/** mux, eg: off/low/medium/high */
multiplex?: string;
/** padding scheme */
padding_scheme?: string;
/** upload speed limit */
up_mbps?: number;
/** download speed limit */
down_mbps?: number;
};
type PubilcRegisterConfig = {
stop_register: boolean;
enable_ip_register_limit: boolean;

View File

@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as announcement from './announcement';

View File

@ -540,6 +540,46 @@ declare namespace API {
privacy_policy: string;
};
type Protocol = {
type: string;
port: number;
security?: string;
sni?: string;
allow_insecure?: boolean;
fingerprint?: string;
reality_server_addr?: string;
reality_server_port?: number;
reality_private_key?: string;
reality_public_key?: string;
reality_short_id?: string;
transport?: string;
host?: string;
path?: string;
service_name?: string;
cipher?: string;
server_key?: string;
flow?: string;
hop_ports?: string;
hop_interval?: number;
obfs_password?: string;
disable_sni?: boolean;
reduce_rtt?: boolean;
udp_relay_mode?: string;
congestion_controller?: string;
/** obfs, v2ray-plugin, simple-obfs */
plugin?: string;
/** plugin options, eg: obfs=http;obfs-host=www.bing.com */
plugin_options?: string;
/** mux, eg: off/low/medium/high */
multiplex?: string;
/** padding scheme */
padding_scheme?: string;
/** upload speed limit */
up_mbps?: number;
/** download speed limit */
down_mbps?: number;
};
type PubilcRegisterConfig = {
stop_register: boolean;
enable_ip_register_limit: boolean;