mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-10 20:32:21 +08:00
Route frontend and tray node selections through the same backend flow for selection, persistence, state refresh, and connection cleanup. Read the group's previous selection before switching and preserve the original rule of closing only connections whose chains contain that selection. Run optional cleanup in the background and keep its failures separate from successful selection. Remove redundant frontend effects and unused IPC commands, and refresh the proxy view for every successful switch. Refs:32095daf90Refs:bea0dde074
1156 lines
35 KiB
TypeScript
1156 lines
35 KiB
TypeScript
// This file has been generated by Tauri Specta. Do not edit this file manually.
|
|
|
|
import { invoke as __TAURI_INVOKE, Channel } from '@tauri-apps/api/core'
|
|
|
|
/** Commands */
|
|
export const commands = {
|
|
getSystemInfo: () => __TAURI_INVOKE<SystemInfo>('get_system_info'),
|
|
/** 获取应用的运行时间(毫秒) */
|
|
getAppUptime: () => __TAURI_INVOKE<number>('get_app_uptime'),
|
|
exportDiagnosticInfo: () => __TAURI_INVOKE<null>('export_diagnostic_info'),
|
|
probeListener: (request: ListenerProbe) =>
|
|
__TAURI_INVOKE<ListenerProbeOutcome>('probe_listener', { request }),
|
|
saveProxyPorts: (settings: ProxyPortSettings) =>
|
|
__TAURI_INVOKE<SaveProxyPortsOutcome>('save_proxy_ports', { settings }),
|
|
getSysProxy: () => __TAURI_INVOKE<SystemProxy>('get_sys_proxy'),
|
|
getAutoProxy: () => __TAURI_INVOKE<AutoProxy>('get_auto_proxy'),
|
|
getEmbeddedServerPort: () =>
|
|
__TAURI_INVOKE<number>('get_embedded_server_port'),
|
|
openAppDir: () => __TAURI_INVOKE<null>('open_app_dir'),
|
|
openLogsDir: () => __TAURI_INVOKE<null>('open_logs_dir'),
|
|
openCoreDir: () => __TAURI_INVOKE<null>('open_core_dir'),
|
|
getNetworkInterfaces: () =>
|
|
__TAURI_INVOKE<string[]>('get_network_interfaces'),
|
|
getSystemHostname: () => __TAURI_INVOKE<string>('get_system_hostname'),
|
|
restartApp: () => __TAURI_INVOKE<null>('restart_app'),
|
|
installUpdate: (
|
|
version: string,
|
|
onEvent: Channel<DownloadEvent_Deserialize>,
|
|
) =>
|
|
__TAURI_INVOKE<InstallUpdateOutcome>('install_update', {
|
|
version,
|
|
onEvent,
|
|
}),
|
|
cancelUpdateDownload: () => __TAURI_INVOKE<void>('cancel_update_download'),
|
|
restartCore: () => __TAURI_INVOKE<null>('restart_core'),
|
|
/** Replaces the managed core binary atomically instead of letting mihomo overwrite itself. */
|
|
upgradeClashCore: (force: boolean) =>
|
|
__TAURI_INVOKE<CoreUpgradeReport>('upgrade_clash_core', { force }),
|
|
/** Returns one coherent core/service snapshot instead of independently refreshed state. */
|
|
getRuntimeState: () =>
|
|
__TAURI_INVOKE<RunStateView_Serialize>('get_runtime_state'),
|
|
getPendingFailures: () =>
|
|
__TAURI_INVOKE<PendingFailure[]>('get_pending_failures'),
|
|
getSidecarFailure: () =>
|
|
__TAURI_INVOKE<SidecarFailureSnapshot_Serialize>('get_sidecar_failure'),
|
|
entryLightweightMode: () => __TAURI_INVOKE<null>('entry_lightweight_mode'),
|
|
installService: () =>
|
|
__TAURI_INVOKE<ServiceInstallOutcome>('install_service'),
|
|
uninstallService: () => __TAURI_INVOKE<null>('uninstall_service'),
|
|
reinstallService: () =>
|
|
__TAURI_INVOKE<ServiceInstallOutcome>('reinstall_service'),
|
|
repairService: () => __TAURI_INVOKE<ServiceInstallOutcome>('repair_service'),
|
|
continueWithSidecar: () => __TAURI_INVOKE<null>('continue_with_sidecar'),
|
|
syncRuntimeProviders: () => __TAURI_INVOKE<void>('sync_runtime_providers'),
|
|
getClashInfo: () => __TAURI_INVOKE<ClashInfo_Serialize>('get_clash_info'),
|
|
patchClashConfig: (payload: YamlMapping) =>
|
|
__TAURI_INVOKE<null>('patch_clash_config', { payload }),
|
|
patchClashMode: (payload: string) =>
|
|
__TAURI_INVOKE<null>('patch_clash_mode', { payload }),
|
|
/** Reads the saved mode without depending on strict mihomo `/configs` deserialization. */
|
|
getClashMode: () => __TAURI_INVOKE<string | null>('get_clash_mode'),
|
|
changeClashCore: (clashCore: string) =>
|
|
__TAURI_INVOKE<CommandFailure_Serialize | null>('change_clash_core', {
|
|
clashCore,
|
|
}),
|
|
getRuntimeConfig: () =>
|
|
__TAURI_INVOKE<YamlMapping | null>('get_runtime_config'),
|
|
getProxyView: () => __TAURI_INVOKE<ProxyViewV1_Serialize>('get_proxy_view'),
|
|
getRuntimeYaml: () => __TAURI_INVOKE<string>('get_runtime_yaml'),
|
|
getRuntimeLogs: () => __TAURI_INVOKE<RuntimeLogs>('get_runtime_logs'),
|
|
getRuntimeProxyChainConfig: (proxyChainExitNode: string) =>
|
|
__TAURI_INVOKE<string>('get_runtime_proxy_chain_config', {
|
|
proxyChainExitNode,
|
|
}),
|
|
updateProxyChainConfigInRuntime: (proxyChainConfig: YamlValue | null) =>
|
|
__TAURI_INVOKE<ValidationOutcome>('update_proxy_chain_config_in_runtime', {
|
|
proxyChainConfig,
|
|
}),
|
|
invokeUwpTool: () => __TAURI_INVOKE<null>('invoke_uwp_tool'),
|
|
copyClashEnv: () => __TAURI_INVOKE<null>('copy_clash_env'),
|
|
/** Merges one selection pair into fresh backend state to avoid stale-list overwrites. */
|
|
recordSelectedNode: (groupName: string, node: string) =>
|
|
__TAURI_INVOKE<null>('record_selected_node', { groupName, node }),
|
|
switchProxyNode: (groupName: string, proxyName: string, unfix: boolean) =>
|
|
__TAURI_INVOKE<null>('switch_proxy_node', { groupName, proxyName, unfix }),
|
|
saveDnsConfig: (dnsConfig: YamlMapping) =>
|
|
__TAURI_INVOKE<null>('save_dns_config', { dnsConfig }),
|
|
applyDnsConfig: (apply: boolean) =>
|
|
__TAURI_INVOKE<null>('apply_dns_config', { apply }),
|
|
setDnsOverride: (
|
|
profileUid: string,
|
|
enabled: boolean,
|
|
confirmation: string | null,
|
|
) =>
|
|
__TAURI_INVOKE<DnsOverrideOutcome>('set_dns_override', {
|
|
profileUid,
|
|
enabled,
|
|
confirmation,
|
|
}),
|
|
takeDnsOverrideNotice: () =>
|
|
__TAURI_INVOKE<boolean>('take_dns_override_notice'),
|
|
takeServiceFallbackNotice: () =>
|
|
__TAURI_INVOKE<ServiceFallbackNotice | null>(
|
|
'take_service_fallback_notice',
|
|
),
|
|
getCoreStartupError: () =>
|
|
__TAURI_INVOKE<CoreFailure | null>('get_core_startup_error'),
|
|
takeServiceRepairNotice: () =>
|
|
__TAURI_INVOKE<boolean>('take_service_repair_notice'),
|
|
takeServiceOwnerNotice: () =>
|
|
__TAURI_INVOKE<string | null>('take_service_owner_notice'),
|
|
takeDiscardedKeysNotice: () =>
|
|
__TAURI_INVOKE<string | null>('take_discarded_keys_notice'),
|
|
getDnsConfigContent: () =>
|
|
__TAURI_INVOKE<string | null>('get_dns_config_content'),
|
|
validateDnsConfig: () =>
|
|
__TAURI_INVOKE<ValidationOutcome>('validate_dns_config'),
|
|
getClashLogs: () => __TAURI_INVOKE<string[]>('get_clash_logs'),
|
|
/** 获取Verge配置 */
|
|
getVergeConfig: () => __TAURI_INVOKE<IVerge_Serialize>('get_verge_config'),
|
|
/** 修改Verge配置 */
|
|
patchVergeConfig: (payload: IVerge_Deserialize) =>
|
|
__TAURI_INVOKE<null>('patch_verge_config', { payload }),
|
|
testDelay: (url: string) => __TAURI_INVOKE<number>('test_delay', { url }),
|
|
getAppDir: () => __TAURI_INVOKE<string>('get_app_dir'),
|
|
copyIconFile: (path: string, iconInfo: IconInfo) =>
|
|
__TAURI_INVOKE<string>('copy_icon_file', { path, iconInfo }),
|
|
downloadIconCache: (url: string, name: string) =>
|
|
__TAURI_INVOKE<string>('download_icon_cache', { url, name }),
|
|
openDevtools: () => __TAURI_INVOKE<void>('open_devtools'),
|
|
exitApp: () => __TAURI_INVOKE<void>('exit_app'),
|
|
getNetworkInterfacesInfo: () =>
|
|
__TAURI_INVOKE<NetworkInterfaceView_Serialize[]>(
|
|
'get_network_interfaces_info',
|
|
),
|
|
getProfiles: () => __TAURI_INVOKE<IProfiles_Serialize>('get_profiles'),
|
|
enhanceProfiles: () => __TAURI_INVOKE<ValidationOutcome>('enhance_profiles'),
|
|
patchProfilesConfig: (profiles: ProfileSelection_Deserialize) =>
|
|
__TAURI_INVOKE<ValidationOutcome>('patch_profiles_config', { profiles }),
|
|
viewProfile: (index: string) =>
|
|
__TAURI_INVOKE<null>('view_profile', { index }),
|
|
patchProfile: (index: string, profile: ProfilePatch_Deserialize) =>
|
|
__TAURI_INVOKE<null>('patch_profile', { index, profile }),
|
|
createProfile: (item: ProfileCreate_Deserialize, fileData: string | null) =>
|
|
__TAURI_INVOKE<null>('create_profile', { item, fileData }),
|
|
importProfile: (url: string, option: PrfOption_Deserialize | null) =>
|
|
__TAURI_INVOKE<null>('import_profile', { url, option }),
|
|
reorderProfile: (activeId: string, overId: string) =>
|
|
__TAURI_INVOKE<null>('reorder_profile', { activeId, overId }),
|
|
updateProfile: (index: string, option: PrfOption_Deserialize | null) =>
|
|
__TAURI_INVOKE<null>('update_profile', { index, option }),
|
|
deleteProfile: (index: string) =>
|
|
__TAURI_INVOKE<null>('delete_profile', { index }),
|
|
readProfileFile: (index: string) =>
|
|
__TAURI_INVOKE<string>('read_profile_file', { index }),
|
|
/** 保存profiles的配置 */
|
|
saveProfileFile: (index: string, fileData: string | null) =>
|
|
__TAURI_INVOKE<ValidationOutcome>('save_profile_file', { index, fileData }),
|
|
getNextUpdateTime: (uid: string) =>
|
|
__TAURI_INVOKE<number | null>('get_next_update_time', { uid }),
|
|
createLocalBackup: () => __TAURI_INVOKE<null>('create_local_backup'),
|
|
listLocalBackup: () => __TAURI_INVOKE<LocalBackupFile[]>('list_local_backup'),
|
|
deleteLocalBackup: (filename: string) =>
|
|
__TAURI_INVOKE<null>('delete_local_backup', { filename }),
|
|
restoreLocalBackup: (filename: string) =>
|
|
__TAURI_INVOKE<null>('restore_local_backup', { filename }),
|
|
importLocalBackup: (source: string) =>
|
|
__TAURI_INVOKE<string>('import_local_backup', { source }),
|
|
exportLocalBackup: (filename: string, destination: string) =>
|
|
__TAURI_INVOKE<null>('export_local_backup', { filename, destination }),
|
|
createWebdavBackup: () => __TAURI_INVOKE<null>('create_webdav_backup'),
|
|
saveWebdavConfig: (url: string, username: string, password: string) =>
|
|
__TAURI_INVOKE<null>('save_webdav_config', { url, username, password }),
|
|
listWebdavBackup: () => __TAURI_INVOKE<WebDavFile[]>('list_webdav_backup'),
|
|
deleteWebdavBackup: (filename: string) =>
|
|
__TAURI_INVOKE<null>('delete_webdav_backup', { filename }),
|
|
restoreWebdavBackup: (filename: string) =>
|
|
__TAURI_INVOKE<null>('restore_webdav_backup', { filename }),
|
|
getUnlockItems: () =>
|
|
__TAURI_INVOKE<UnlockItem_Serialize[]>('get_unlock_items'),
|
|
checkMediaUnlock: (onComplete: Channel<UnlockItem_Deserialize>) =>
|
|
__TAURI_INVOKE<UnlockItem_Serialize[]>('check_media_unlock', {
|
|
onComplete,
|
|
}),
|
|
checkMediaUnlockItem: (name: string) =>
|
|
__TAURI_INVOKE<UnlockItem_Serialize>('check_media_unlock_item', { name }),
|
|
}
|
|
|
|
/* Types */
|
|
export type AutoProxy = {
|
|
enable: boolean
|
|
url: string
|
|
}
|
|
|
|
export type ClashInfo = ClashInfo_Serialize | ClashInfo_Deserialize
|
|
|
|
export type ClashInfo_Deserialize = {
|
|
/** clash core port */
|
|
mixed_port: number
|
|
socks_port: number
|
|
port: number
|
|
/** same as `external-controller` */
|
|
server: string
|
|
/** clash secret */
|
|
secret?: string | null
|
|
}
|
|
|
|
export type ClashInfo_Serialize = {
|
|
/** clash core port */
|
|
mixed_port: number
|
|
socks_port: number
|
|
port: number
|
|
/** same as `external-controller` */
|
|
server: string
|
|
/** clash secret */
|
|
secret: string | null
|
|
}
|
|
|
|
/** Structured command failure returned to the frontend. */
|
|
export type CommandFailure =
|
|
| CommandFailure_Serialize
|
|
| CommandFailure_Deserialize
|
|
|
|
/** Structured command failure returned to the frontend. */
|
|
export type CommandFailure_Deserialize = {
|
|
/** Stable frontend identifier, when classified. */
|
|
code?: string | null
|
|
/** Human-readable diagnostic detail. */
|
|
detail: string
|
|
/** Requested operation when known by the command. */
|
|
operation?: FailedOperation | null
|
|
}
|
|
|
|
/** Structured command failure returned to the frontend. */
|
|
export type CommandFailure_Serialize = {
|
|
/** Stable frontend identifier, when classified. */
|
|
code?: string
|
|
/** Human-readable diagnostic detail. */
|
|
detail: string
|
|
/** Requested operation when known by the command. */
|
|
operation?: FailedOperation
|
|
}
|
|
|
|
/** Why the Core is not running, kept until a Core starts again. */
|
|
export type CoreFailure =
|
|
| { kind: 'startFailed'; detail: string }
|
|
| { kind: 'serviceCoreStopped'; detail: string }
|
|
|
|
export type CoreUpgradeReport = {
|
|
/** False when the managed core was already at the latest version. */
|
|
upgraded: boolean
|
|
}
|
|
|
|
export type DelayHistory = {
|
|
time: string
|
|
delay: number
|
|
}
|
|
|
|
export type DnsOverrideOutcome =
|
|
| { status: 'applied' }
|
|
| { status: 'confirmation_required'; source: string }
|
|
|
|
/** Same wire shape as the updater plugin's JS `DownloadEvent`. */
|
|
export type DownloadEvent = DownloadEvent_Serialize | DownloadEvent_Deserialize
|
|
|
|
/** Same wire shape as the updater plugin's JS `DownloadEvent`. */
|
|
export type DownloadEvent_Deserialize =
|
|
| {
|
|
event: 'Started'
|
|
data: {
|
|
contentLength?: number | null
|
|
}
|
|
}
|
|
| {
|
|
event: 'Progress'
|
|
data: {
|
|
chunkLength: number
|
|
}
|
|
}
|
|
| { event: 'Finished' }
|
|
|
|
/** Same wire shape as the updater plugin's JS `DownloadEvent`. */
|
|
export type DownloadEvent_Serialize =
|
|
| {
|
|
event: 'Started'
|
|
data: {
|
|
contentLength: number | null
|
|
}
|
|
}
|
|
| {
|
|
event: 'Progress'
|
|
data: {
|
|
chunkLength: number
|
|
}
|
|
}
|
|
| { event: 'Finished' }
|
|
|
|
/** Operation associated with a pending failure. */
|
|
export type FailedOperation =
|
|
| 'systemProxyEnable'
|
|
| 'systemProxyDisable'
|
|
| 'systemProxyRestore'
|
|
| 'systemProxyGuard'
|
|
|
|
/** Define the `profiles.yaml` schema */
|
|
export type IProfiles = IProfiles_Serialize | IProfiles_Deserialize
|
|
|
|
/** Define the `profiles.yaml` schema */
|
|
export type IProfiles_Deserialize = {
|
|
current?: string | null
|
|
items?: PrfItem_Deserialize[] | null
|
|
}
|
|
|
|
/** Define the `profiles.yaml` schema */
|
|
export type IProfiles_Serialize = {
|
|
current: string | null
|
|
items: PrfItem_Serialize[] | null
|
|
}
|
|
|
|
/** ### `verge.yaml` schema */
|
|
export type IVerge = IVerge_Serialize | IVerge_Deserialize
|
|
|
|
export type IVergeTestItem =
|
|
| IVergeTestItem_Serialize
|
|
| IVergeTestItem_Deserialize
|
|
|
|
export type IVergeTestItem_Deserialize = {
|
|
uid?: string | null
|
|
name?: string | null
|
|
icon?: string | null
|
|
url?: string | null
|
|
}
|
|
|
|
export type IVergeTestItem_Serialize = {
|
|
uid: string | null
|
|
name: string | null
|
|
icon: string | null
|
|
url: string | null
|
|
}
|
|
|
|
export type IVergeTheme = IVergeTheme_Serialize | IVergeTheme_Deserialize
|
|
|
|
export type IVergeTheme_Deserialize = {
|
|
primary_color?: string | null
|
|
secondary_color?: string | null
|
|
primary_text?: string | null
|
|
secondary_text?: string | null
|
|
info_color?: string | null
|
|
error_color?: string | null
|
|
warning_color?: string | null
|
|
success_color?: string | null
|
|
font_family?: string | null
|
|
css_injection?: string | null
|
|
}
|
|
|
|
export type IVergeTheme_Serialize = {
|
|
primary_color: string | null
|
|
secondary_color: string | null
|
|
primary_text: string | null
|
|
secondary_text: string | null
|
|
info_color: string | null
|
|
error_color: string | null
|
|
warning_color: string | null
|
|
success_color: string | null
|
|
font_family: string | null
|
|
css_injection: string | null
|
|
}
|
|
|
|
/** ### `verge.yaml` schema */
|
|
export type IVerge_Deserialize = {
|
|
/** silent | error | warn | info | debug | trace */
|
|
app_log_level?: string | null
|
|
/** Maximum app log size in KiB. */
|
|
app_log_max_size?: number | null
|
|
app_log_max_count?: number | null
|
|
language?: string | null
|
|
/** `light` or `dark` or `system` */
|
|
theme_mode?: string | null
|
|
tray_event?: string | null
|
|
env_type?: string | null
|
|
start_page?: string | null
|
|
startup_script?: string | null
|
|
traffic_graph?: boolean | null
|
|
/** show memory info (only for Mihomo) */
|
|
enable_memory_usage?: boolean | null
|
|
enable_group_icon?: boolean | null
|
|
pause_render_traffic_stats_on_blur?: boolean | null
|
|
common_tray_icon?: boolean | null
|
|
menu_icon?: string | null
|
|
menu_order?: string[] | null
|
|
proxy_group_tools_position?: string | null
|
|
notice_position?: string | null
|
|
collapse_navbar?: boolean | null
|
|
sysproxy_tray_icon?: boolean | null
|
|
tun_tray_icon?: boolean | null
|
|
enable_tun_mode?: boolean | null
|
|
enable_auto_launch?: boolean | null
|
|
enable_silent_start?: boolean | null
|
|
enable_system_proxy?: boolean | null
|
|
enable_proxy_guard?: boolean | null
|
|
enable_bypass_check?: boolean | null
|
|
/** Initial DNS override preference for profiles without a saved setting. */
|
|
enable_dns_settings?: boolean | null
|
|
profile_dns_settings?: { [key in string]: ProfileDnsSettings_Deserialize }
|
|
use_default_bypass?: boolean | null
|
|
system_proxy_bypass?: string | null
|
|
proxy_guard_duration?: number | null
|
|
proxy_auto_config?: boolean | null
|
|
pac_file_content?: string | null
|
|
proxy_host?: string | null
|
|
theme_setting?: IVergeTheme_Deserialize | null
|
|
web_ui_list?: string[] | null
|
|
clash_core?: string | null
|
|
/** format: {func},{key} */
|
|
hotkeys?: string[] | null
|
|
enable_global_hotkey?: boolean | null
|
|
home_cards?: JsonValue | null
|
|
auto_close_connection?: boolean | null
|
|
auto_check_update?: boolean | null
|
|
default_latency_test?: string | null
|
|
default_latency_timeout?: number | null
|
|
enable_auto_delay_detection?: boolean | null
|
|
/** 自动检测当前节点延迟的间隔(分钟) */
|
|
auto_delay_detection_interval_minutes?: number | null
|
|
enable_builtin_enhanced?: boolean | null
|
|
proxy_layout_column?: number | null
|
|
test_list?: IVergeTestItem_Deserialize[] | null
|
|
/** 0: 不清理; 1: 1天;2: 7天; 3: 30天; 4: 90天 */
|
|
auto_log_clean?: number | null
|
|
enable_auto_backup_schedule?: boolean | null
|
|
/** Automatic backup interval in hours */
|
|
auto_backup_interval_hours?: number | null
|
|
auto_backup_on_change?: boolean | null
|
|
verge_mixed_port?: number | null
|
|
verge_socks_port?: number | null
|
|
verge_socks_enabled?: boolean | null
|
|
verge_port?: number | null
|
|
verge_http_enabled?: boolean | null
|
|
webdav_url?: string | null
|
|
webdav_username?: string | null
|
|
webdav_password?: string | null
|
|
tray_proxy_groups_display_mode?: string | null
|
|
tray_inline_outbound_modes?: boolean | null
|
|
enable_auto_light_weight_mode?: boolean | null
|
|
/** 自动进入轻量模式的延迟(分钟) */
|
|
auto_light_weight_minutes?: number | null
|
|
enable_hover_jump_navigator?: boolean | null
|
|
/** 代理页面自动滚动延迟(毫秒) */
|
|
hover_jump_navigator_delay?: number | null
|
|
enable_external_controller?: boolean | null
|
|
tray_icon?: string | null
|
|
verge_redir_port?: number | null
|
|
verge_redir_enabled?: boolean | null
|
|
verge_tproxy_port?: number | null
|
|
verge_tproxy_enabled?: boolean | null
|
|
enable_tray_speed?: boolean | null
|
|
}
|
|
|
|
/** ### `verge.yaml` schema */
|
|
export type IVerge_Serialize = {
|
|
/** silent | error | warn | info | debug | trace */
|
|
app_log_level: string | null
|
|
/** Maximum app log size in KiB. */
|
|
app_log_max_size: number | null
|
|
app_log_max_count: number | null
|
|
language: string | null
|
|
/** `light` or `dark` or `system` */
|
|
theme_mode: string | null
|
|
tray_event: string | null
|
|
env_type: string | null
|
|
start_page: string | null
|
|
startup_script: string | null
|
|
traffic_graph: boolean | null
|
|
/** show memory info (only for Mihomo) */
|
|
enable_memory_usage: boolean | null
|
|
enable_group_icon?: boolean
|
|
pause_render_traffic_stats_on_blur: boolean | null
|
|
common_tray_icon?: boolean
|
|
menu_icon?: string
|
|
menu_order?: string[]
|
|
proxy_group_tools_position?: string
|
|
notice_position?: string
|
|
collapse_navbar: boolean | null
|
|
sysproxy_tray_icon: boolean | null
|
|
tun_tray_icon: boolean | null
|
|
enable_tun_mode: boolean | null
|
|
enable_auto_launch: boolean | null
|
|
enable_silent_start: boolean | null
|
|
enable_system_proxy: boolean | null
|
|
enable_proxy_guard: boolean | null
|
|
enable_bypass_check: boolean | null
|
|
/** Initial DNS override preference for profiles without a saved setting. */
|
|
enable_dns_settings: boolean | null
|
|
profile_dns_settings?: { [key in string]: ProfileDnsSettings_Serialize }
|
|
use_default_bypass: boolean | null
|
|
system_proxy_bypass: string | null
|
|
proxy_guard_duration: number | null
|
|
proxy_auto_config: boolean | null
|
|
pac_file_content: string | null
|
|
proxy_host: string | null
|
|
theme_setting: IVergeTheme_Serialize | null
|
|
web_ui_list: string[] | null
|
|
clash_core?: string
|
|
/** format: {func},{key} */
|
|
hotkeys?: string[]
|
|
enable_global_hotkey: boolean | null
|
|
home_cards: JsonValue | null
|
|
auto_close_connection: boolean | null
|
|
auto_check_update: boolean | null
|
|
default_latency_test: string | null
|
|
default_latency_timeout: number | null
|
|
enable_auto_delay_detection: boolean | null
|
|
/** 自动检测当前节点延迟的间隔(分钟) */
|
|
auto_delay_detection_interval_minutes: number | null
|
|
enable_builtin_enhanced: boolean | null
|
|
proxy_layout_column: number | null
|
|
test_list: IVergeTestItem_Serialize[] | null
|
|
/** 0: 不清理; 1: 1天;2: 7天; 3: 30天; 4: 90天 */
|
|
auto_log_clean: number | null
|
|
enable_auto_backup_schedule: boolean | null
|
|
/** Automatic backup interval in hours */
|
|
auto_backup_interval_hours: number | null
|
|
auto_backup_on_change: boolean | null
|
|
verge_mixed_port: number | null
|
|
verge_socks_port: number | null
|
|
verge_socks_enabled: boolean | null
|
|
verge_port: number | null
|
|
verge_http_enabled: boolean | null
|
|
webdav_url?: string
|
|
webdav_username?: string
|
|
webdav_password?: string
|
|
tray_proxy_groups_display_mode?: string
|
|
tray_inline_outbound_modes: boolean | null
|
|
enable_auto_light_weight_mode: boolean | null
|
|
/** 自动进入轻量模式的延迟(分钟) */
|
|
auto_light_weight_minutes: number | null
|
|
enable_hover_jump_navigator: boolean | null
|
|
/** 代理页面自动滚动延迟(毫秒) */
|
|
hover_jump_navigator_delay: number | null
|
|
enable_external_controller: boolean | null
|
|
tray_icon?: string | null
|
|
verge_redir_port?: number | null
|
|
verge_redir_enabled?: boolean | null
|
|
verge_tproxy_port?: number | null
|
|
verge_tproxy_enabled?: boolean | null
|
|
enable_tray_speed?: boolean | null
|
|
}
|
|
|
|
export type IconInfo = {
|
|
name: string
|
|
previous_t: string
|
|
current_t: string
|
|
}
|
|
|
|
export type InstallUpdateOutcome = 'installed' | 'cancelled' | 'update_changed'
|
|
|
|
export type InterfaceAddress =
|
|
| ({ V4: IpAddress } & { V6?: never })
|
|
| ({ V6: IpAddress } & { V4?: never })
|
|
|
|
export type IpAddress = {
|
|
ip: string
|
|
}
|
|
|
|
export type JsonValue =
|
|
| null
|
|
| boolean
|
|
| number
|
|
| null
|
|
| string
|
|
| JsonValue[]
|
|
| { [key in string]: JsonValue }
|
|
|
|
export type ListenerProbe = {
|
|
address: string
|
|
transports: ListenerTransport[]
|
|
}
|
|
|
|
export type ListenerProbeOutcome =
|
|
| { status: 'available' }
|
|
| { status: 'conflict'; port: number; transport: ListenerTransport }
|
|
| { status: 'invalid'; message: string }
|
|
| { status: 'indeterminate'; message: string }
|
|
|
|
export type ListenerTransport = 'tcp' | 'udp'
|
|
|
|
export type LocalBackupFile = {
|
|
filename: string
|
|
path: string
|
|
last_modified: string
|
|
content_length: number
|
|
}
|
|
|
|
export type NetworkInterfaceView =
|
|
| NetworkInterfaceView_Serialize
|
|
| NetworkInterfaceView_Deserialize
|
|
|
|
export type NetworkInterfaceView_Deserialize = {
|
|
name: string
|
|
addr: InterfaceAddress[]
|
|
mac_addr?: string | null
|
|
}
|
|
|
|
export type NetworkInterfaceView_Serialize = {
|
|
name: string
|
|
addr: InterfaceAddress[]
|
|
mac_addr: string | null
|
|
}
|
|
|
|
export type NoticeStatus =
|
|
| 'info'
|
|
| 'import_sub_url::ok'
|
|
| 'import_sub_url::error'
|
|
| 'set_config::error'
|
|
| 'core_start::error'
|
|
| 'service_core::repair_required'
|
|
| 'service_core::app_data_not_owned'
|
|
| 'service_core::sidecar_fallback'
|
|
| 'dns_override::auto_disabled'
|
|
| 'enhance::discarded_keys'
|
|
| 'tun_mode::auto_disabled'
|
|
| 'tun_mode::auto_disable_failed'
|
|
| 'app_restart::core_stop_failed'
|
|
| 'app_quit::core_stop_failed'
|
|
| 'update_with_clash_proxy'
|
|
| 'update_failed_even_with_clash'
|
|
| 'reactivate_profiles::error'
|
|
| 'update_failed'
|
|
| 'config_validate::boot_error'
|
|
| 'config_validate::error'
|
|
| 'config_validate::process_terminated'
|
|
| 'config_validate::script_error'
|
|
| 'config_validate::script_syntax_error'
|
|
| 'config_validate::script_missing_main'
|
|
| 'config_validate::file_not_found'
|
|
| 'config_validate::yaml_syntax_error'
|
|
| 'config_validate::yaml_read_error'
|
|
| 'config_validate::yaml_mapping_error'
|
|
| 'config_validate::merge_syntax_error'
|
|
| 'config_validate::merge_mapping_error'
|
|
| 'config_core::change_success'
|
|
| 'config_core::change_error'
|
|
| 'mixed_port::fallback'
|
|
| 'mixed_port::fallback_error'
|
|
|
|
export type PendingAction =
|
|
| 'install'
|
|
| 'uninstall'
|
|
| 'reinstall'
|
|
| 'forceReinstall'
|
|
|
|
/** Latest unresolved failure for one stable code. */
|
|
export type PendingFailure = {
|
|
/** Stable code used as the table key. */
|
|
code: string
|
|
/** Full diagnostic context chain. */
|
|
detail: string
|
|
operation: FailedOperation
|
|
/** Monotonic identity for repeated failures under the same code. */
|
|
sequence: number
|
|
}
|
|
|
|
export type PlatformVergeFields =
|
|
| PlatformVergeFields_Serialize
|
|
| PlatformVergeFields_Deserialize
|
|
|
|
export type PlatformVergeFields_Deserialize = {
|
|
tray_icon?: string | null
|
|
verge_redir_port?: number | null
|
|
verge_redir_enabled?: boolean | null
|
|
verge_tproxy_port?: number | null
|
|
verge_tproxy_enabled?: boolean | null
|
|
enable_tray_speed?: boolean | null
|
|
}
|
|
|
|
export type PlatformVergeFields_Serialize = {
|
|
tray_icon?: string | null
|
|
verge_redir_port?: number | null
|
|
verge_redir_enabled?: boolean | null
|
|
verge_tproxy_port?: number | null
|
|
verge_tproxy_enabled?: boolean | null
|
|
enable_tray_speed?: boolean | null
|
|
}
|
|
|
|
export type PrfExtra = {
|
|
upload: number
|
|
download: number
|
|
total: number
|
|
expire: number
|
|
}
|
|
|
|
export type PrfItem = PrfItem_Serialize | PrfItem_Deserialize
|
|
|
|
export type PrfItem_Deserialize = {
|
|
uid?: string | null
|
|
/** enum value: remote | local | script | merge */
|
|
type?: string | null
|
|
name?: string | null
|
|
file?: string | null
|
|
desc?: string | null
|
|
url?: string | null
|
|
selected?: PrfSelected_Deserialize[] | null
|
|
extra?: PrfExtra | null
|
|
updated?: number | null
|
|
option?: PrfOption_Deserialize | null
|
|
home?: string | null
|
|
}
|
|
|
|
export type PrfItem_Serialize = {
|
|
uid: string | null
|
|
/** enum value: remote | local | script | merge */
|
|
type: string | null
|
|
name: string | null
|
|
file: string | null
|
|
desc?: string
|
|
url?: string
|
|
selected?: PrfSelected_Serialize[]
|
|
extra?: PrfExtra
|
|
updated: number | null
|
|
option?: PrfOption_Serialize
|
|
home?: string
|
|
}
|
|
|
|
export type PrfOption = PrfOption_Serialize | PrfOption_Deserialize
|
|
|
|
export type PrfOption_Deserialize = {
|
|
user_agent?: string | null
|
|
with_proxy?: boolean | null
|
|
self_proxy?: boolean | null
|
|
update_interval?: number | null
|
|
/**
|
|
* HTTP request timeout in seconds
|
|
* default is 60 seconds
|
|
*/
|
|
timeout_seconds?: number | null
|
|
/** default is `false` */
|
|
danger_accept_invalid_certs?: boolean | null
|
|
allow_auto_update?: boolean | null
|
|
merge?: string | null
|
|
script?: string | null
|
|
rules?: string | null
|
|
proxies?: string | null
|
|
groups?: string | null
|
|
}
|
|
|
|
export type PrfOption_Serialize = {
|
|
user_agent?: string
|
|
with_proxy?: boolean
|
|
self_proxy?: boolean
|
|
update_interval?: number
|
|
/**
|
|
* HTTP request timeout in seconds
|
|
* default is 60 seconds
|
|
*/
|
|
timeout_seconds?: number
|
|
/** default is `false` */
|
|
danger_accept_invalid_certs?: boolean
|
|
allow_auto_update?: boolean
|
|
merge: string | null
|
|
script: string | null
|
|
rules: string | null
|
|
proxies: string | null
|
|
groups: string | null
|
|
}
|
|
|
|
export type PrfSelected = PrfSelected_Serialize | PrfSelected_Deserialize
|
|
|
|
export type PrfSelected_Deserialize = {
|
|
name?: string | null
|
|
now?: string | null
|
|
}
|
|
|
|
export type PrfSelected_Serialize = {
|
|
name: string | null
|
|
now: string | null
|
|
}
|
|
|
|
export type ProfileCreate = ProfileCreate_Serialize | ProfileCreate_Deserialize
|
|
|
|
export type ProfileCreate_Deserialize = {
|
|
type?: string | null
|
|
name?: string | null
|
|
desc?: string | null
|
|
url?: string | null
|
|
option?: PrfOption_Deserialize | null
|
|
}
|
|
|
|
export type ProfileCreate_Serialize = {
|
|
type: string | null
|
|
name: string | null
|
|
desc: string | null
|
|
url: string | null
|
|
option: PrfOption_Serialize | null
|
|
}
|
|
|
|
export type ProfileDnsSettings =
|
|
| ProfileDnsSettings_Serialize
|
|
| ProfileDnsSettings_Deserialize
|
|
|
|
export type ProfileDnsSettings_Deserialize = {
|
|
enabled: boolean
|
|
confirmation?: string | null
|
|
}
|
|
|
|
export type ProfileDnsSettings_Serialize = {
|
|
enabled: boolean
|
|
confirmation?: string
|
|
}
|
|
|
|
export type ProfilePatch = ProfilePatch_Serialize | ProfilePatch_Deserialize
|
|
|
|
export type ProfilePatch_Deserialize = {
|
|
type?: string | null
|
|
name?: string | null
|
|
desc?: string | null
|
|
file?: string | null
|
|
url?: string | null
|
|
selected?: PrfSelected_Deserialize[] | null
|
|
extra?: PrfExtra | null
|
|
updated?: number | null
|
|
option?: PrfOption_Deserialize | null
|
|
}
|
|
|
|
export type ProfilePatch_Serialize = {
|
|
type: string | null
|
|
name: string | null
|
|
desc: string | null
|
|
file: string | null
|
|
url: string | null
|
|
selected: PrfSelected_Serialize[] | null
|
|
extra: PrfExtra | null
|
|
updated: number | null
|
|
option: PrfOption_Serialize | null
|
|
}
|
|
|
|
export type ProfileSelection =
|
|
| ProfileSelection_Serialize
|
|
| ProfileSelection_Deserialize
|
|
|
|
export type ProfileSelection_Deserialize = {
|
|
current?: string | null
|
|
}
|
|
|
|
export type ProfileSelection_Serialize = {
|
|
current: string | null
|
|
}
|
|
|
|
export type ProfileUpdatePayload = {
|
|
uid: string
|
|
}
|
|
|
|
export type ProxyCapabilities = {
|
|
udp: boolean
|
|
xudp: boolean
|
|
tfo: boolean
|
|
mptcp: boolean
|
|
smux: boolean
|
|
}
|
|
|
|
export type ProxyGroupView =
|
|
| ProxyGroupView_Serialize
|
|
| ProxyGroupView_Deserialize
|
|
|
|
export type ProxyGroupView_Deserialize = {
|
|
name: string
|
|
type: string
|
|
now?: string | null
|
|
fixed?: string | null
|
|
hidden?: boolean | null
|
|
icon?: string | null
|
|
testUrl?: string | null
|
|
history: DelayHistory[]
|
|
members: ProxyMemberRef[]
|
|
} & ProxyCapabilities
|
|
|
|
export type ProxyGroupView_Serialize = {
|
|
name: string
|
|
type: string
|
|
now?: string
|
|
fixed?: string
|
|
hidden?: boolean
|
|
icon?: string
|
|
testUrl?: string
|
|
history: DelayHistory[]
|
|
members: ProxyMemberRef[]
|
|
} & ProxyCapabilities
|
|
|
|
export type ProxyMemberRef =
|
|
| { kind: 'group'; name: string }
|
|
| { kind: 'node'; name: string; recordId: string }
|
|
| { kind: 'unresolved'; name: string; reason: ProxyMemberUnresolvedReason }
|
|
|
|
export type ProxyMemberUnresolvedReason =
|
|
| 'missing'
|
|
| 'ambiguous'
|
|
| 'provider-unavailable'
|
|
|
|
export type ProxyNodeSource =
|
|
| { kind: 'core'; proxyName: string }
|
|
| { kind: 'provider'; providerName: string; proxyName: string }
|
|
|
|
export type ProxyNodeView = ProxyNodeView_Serialize | ProxyNodeView_Deserialize
|
|
|
|
export type ProxyNodeView_Deserialize = {
|
|
recordId: string
|
|
name: string
|
|
type: string
|
|
history: DelayHistory[]
|
|
id?: string | null
|
|
hidden?: boolean | null
|
|
icon?: string | null
|
|
testUrl?: string | null
|
|
source: ProxyNodeSource
|
|
} & ProxyCapabilities
|
|
|
|
export type ProxyNodeView_Serialize = {
|
|
recordId: string
|
|
name: string
|
|
type: string
|
|
history: DelayHistory[]
|
|
id?: string
|
|
hidden?: boolean
|
|
icon?: string
|
|
testUrl?: string
|
|
source: ProxyNodeSource
|
|
} & ProxyCapabilities
|
|
|
|
export type ProxyPortSettings = {
|
|
mixedPort: number
|
|
socks: ToggleableProxyPort
|
|
http: ToggleableProxyPort
|
|
redir: ToggleableProxyPort
|
|
tproxy: ToggleableProxyPort
|
|
}
|
|
|
|
export type ProxyProviderVehicleType = 'HTTP' | 'File' | 'Inline'
|
|
|
|
export type ProxyProviderView =
|
|
| ProxyProviderView_Serialize
|
|
| ProxyProviderView_Deserialize
|
|
|
|
export type ProxyProviderView_Deserialize = {
|
|
name: string
|
|
vehicleType: ProxyProviderVehicleType
|
|
updatedAt?: string | null
|
|
subscriptionInfo?: ProxySubscriptionInfo | null
|
|
proxyRecordIds: string[]
|
|
}
|
|
|
|
export type ProxyProviderView_Serialize = {
|
|
name: string
|
|
vehicleType: ProxyProviderVehicleType
|
|
updatedAt?: string
|
|
subscriptionInfo?: ProxySubscriptionInfo
|
|
proxyRecordIds: string[]
|
|
}
|
|
|
|
export type ProxySubscriptionInfo = {
|
|
upload: number
|
|
download: number
|
|
total: number
|
|
expire: number
|
|
}
|
|
|
|
export type ProxyViewOrderSource = 'runtime' | 'fallback'
|
|
|
|
export type ProxyViewProviderState = 'ready' | 'unavailable'
|
|
|
|
export type ProxyViewV1 = ProxyViewV1_Serialize | ProxyViewV1_Deserialize
|
|
|
|
export type ProxyViewV1_Deserialize = {
|
|
schemaVersion: number
|
|
orderSource: ProxyViewOrderSource
|
|
providerState: ProxyViewProviderState
|
|
global?: ProxyGroupView_Deserialize | null
|
|
direct?: string | null
|
|
groups: ProxyGroupView_Deserialize[]
|
|
records: { [key in string]: ProxyNodeView_Deserialize }
|
|
standalone: string[]
|
|
providers: ProxyProviderView_Deserialize[]
|
|
}
|
|
|
|
export type ProxyViewV1_Serialize = {
|
|
schemaVersion: number
|
|
orderSource: ProxyViewOrderSource
|
|
providerState: ProxyViewProviderState
|
|
global: ProxyGroupView_Serialize | null
|
|
direct: string | null
|
|
groups: ProxyGroupView_Serialize[]
|
|
records: { [key in string]: ProxyNodeView_Serialize }
|
|
standalone: string[]
|
|
providers: ProxyProviderView_Serialize[]
|
|
}
|
|
|
|
export type RunStateView = RunStateView_Serialize | RunStateView_Deserialize
|
|
|
|
export type RunStateView_Deserialize = {
|
|
mode: RunningMode
|
|
service: ServiceHealthKind
|
|
serviceUnavailableReason?: string | null
|
|
pendingAction?: PendingAction | null
|
|
sidecarAllowed: boolean
|
|
isAdmin: boolean
|
|
opInFlight: boolean
|
|
serviceUsable: boolean
|
|
tunCapable: boolean
|
|
serviceNeedsAttention: boolean
|
|
}
|
|
|
|
export type RunStateView_Serialize = {
|
|
mode: RunningMode
|
|
service: ServiceHealthKind
|
|
serviceUnavailableReason: string | null
|
|
pendingAction: PendingAction | null
|
|
sidecarAllowed: boolean
|
|
isAdmin: boolean
|
|
opInFlight: boolean
|
|
serviceUsable: boolean
|
|
tunCapable: boolean
|
|
serviceNeedsAttention: boolean
|
|
}
|
|
|
|
export type RunningMode = 'Service' | 'Sidecar' | 'NotRunning'
|
|
|
|
export type RuntimeLogs = { [key in string]: [string, string][] }
|
|
|
|
export type SaveProxyPortsOutcome =
|
|
| { status: 'saved' }
|
|
| { status: 'conflict'; port: number; transport: ListenerTransport }
|
|
|
|
/** Why the Service was unavailable when the core fell back to Sidecar. */
|
|
export type ServiceFallbackNotice =
|
|
| { kind: 'unavailable' }
|
|
| { kind: 'coreRejected'; reason: string }
|
|
| { kind: 'notAutoStarted' }
|
|
|
|
export type ServiceHealthKind =
|
|
| 'unknown'
|
|
| 'ready'
|
|
| 'notInstalled'
|
|
| 'versionMismatch'
|
|
| 'unavailable'
|
|
|
|
export type ServiceInstallOutcome =
|
|
| { status: 'installed' }
|
|
| { status: 'sidecar'; reason: string }
|
|
|
|
/** A removal has a revision too, so a delayed read cannot restore a resolved failure. */
|
|
export type SidecarFailureSnapshot =
|
|
| SidecarFailureSnapshot_Serialize
|
|
| SidecarFailureSnapshot_Deserialize
|
|
|
|
/** A removal has a revision too, so a delayed read cannot restore a resolved failure. */
|
|
export type SidecarFailureSnapshot_Deserialize = {
|
|
revision: number
|
|
detail?: string | null
|
|
}
|
|
|
|
/** A removal has a revision too, so a delayed read cannot restore a resolved failure. */
|
|
export type SidecarFailureSnapshot_Serialize = {
|
|
revision: number
|
|
detail: string | null
|
|
}
|
|
|
|
export type SystemInfo = {
|
|
system_name: string
|
|
system_version: string
|
|
}
|
|
|
|
export type SystemProxy = {
|
|
enable: boolean
|
|
server: string
|
|
bypass: string
|
|
}
|
|
|
|
export type ToggleableProxyPort = {
|
|
enabled: boolean
|
|
port: number
|
|
}
|
|
|
|
export type UnlockItem = UnlockItem_Serialize | UnlockItem_Deserialize
|
|
|
|
export type UnlockItem_Deserialize = {
|
|
name: string
|
|
status: string
|
|
region?: string | null
|
|
check_time?: string | null
|
|
}
|
|
|
|
export type UnlockItem_Serialize = {
|
|
name: string
|
|
status: string
|
|
region: string | null
|
|
check_time: string | null
|
|
}
|
|
|
|
export type ValidationErrorKind =
|
|
| 'fileMissing'
|
|
| 'fileRead'
|
|
| 'yamlSyntax'
|
|
| 'yamlMapping'
|
|
| 'scriptSyntax'
|
|
| 'scriptMissingMain'
|
|
| 'coreRejected'
|
|
| 'processTerminated'
|
|
| 'timeout'
|
|
|
|
export type ValidationOutcome =
|
|
| { status: 'valid' }
|
|
| { status: 'invalid'; kind: ValidationErrorKind; message: string }
|
|
| { status: 'skipped'; reason: ValidationSkipReason }
|
|
| { status: 'busy' }
|
|
|
|
export type ValidationSkipReason = 'exiting' | 'debounced'
|
|
|
|
export type VergeEventPayloads =
|
|
| VergeEventPayloads_Serialize
|
|
| VergeEventPayloads_Deserialize
|
|
|
|
export type VergeEventPayloads_Deserialize = {
|
|
'verge://refresh-clash-config': null
|
|
'verge://refresh-verge-config': null
|
|
'verge://refresh-profiles': null
|
|
'verge://refresh-proxy-config': null
|
|
'verge://notice-message': [NoticeStatus, string]
|
|
'profile-changed': string
|
|
'verge://timer-updated': string
|
|
'profile-update-started': ProfileUpdatePayload
|
|
'profile-update-completed': ProfileUpdatePayload
|
|
'verge://run-state-changed': RunStateView_Deserialize
|
|
'verge://pending-failures-changed': null
|
|
}
|
|
|
|
export type VergeEventPayloads_Serialize = {
|
|
'verge://refresh-clash-config': null
|
|
'verge://refresh-verge-config': null
|
|
'verge://refresh-profiles': null
|
|
'verge://refresh-proxy-config': null
|
|
'verge://notice-message': [NoticeStatus, string]
|
|
'profile-changed': string
|
|
'verge://timer-updated': string
|
|
'profile-update-started': ProfileUpdatePayload
|
|
'profile-update-completed': ProfileUpdatePayload
|
|
'verge://run-state-changed': RunStateView_Serialize
|
|
'verge://pending-failures-changed': null
|
|
}
|
|
|
|
export type WebDavFile = {
|
|
href: string
|
|
last_modified: string
|
|
}
|
|
|
|
export type YamlMapping = { [key in string]: JsonValue }
|
|
|
|
export type YamlValue = JsonValue
|