This commit is contained in:
2026-01-30 12:56:00 +08:00
parent 91f24cb462
commit dcbbda951e
89 changed files with 13486 additions and 72 deletions

12
web/src/lib/invoke.ts Normal file
View File

@@ -0,0 +1,12 @@
import {invoke} from "@tauri-apps/api/core";
import {toast} from "sonner";
export async function invokeCommand<R>(command: string, data?: Record<string, unknown>): Promise<R> {
try {
return await invoke<R>(command, data);
} catch (e) {
toast.error(e as unknown as string);
throw e;
}
}

59
web/src/lib/types.ts Normal file
View File

@@ -0,0 +1,59 @@
export interface AppConfig {
logLevel: 'Trace' | 'Debug' | 'Info' | 'Warn' | 'Error',
autoStart: boolean,
silentStart: boolean,
mihomo: MihomoConfig,
}
export interface MihomoConfig {
logLevel: 'Debug' | 'Info' | 'Warn' | 'Error' | 'Silent'
tunMode: boolean
allowLan: boolean
ipv6: boolean
uniLatency: boolean
mix: Port,
http: Port,
socks: Port
}
export interface Port {
port: number;
enabled: boolean
}
export interface TunConfig {
enable: boolean
stack: 'system' | 'gvisor' | 'mixed'
dnsHijack: string[]
autoDetectInterface?: boolean
autoRoute?: boolean
mtu?: number
gso?: boolean
gsoMaxSize?: number
autoRedirect?: boolean
strictRoute?: boolean
disableIcmpForwarding?: boolean
routeAddressSet?: string[]
routeExcludeAddressSet?: string[]
routeAddress?: string[]
inet4RouteAddress?: string[]
inet6RouteAddress?: string[]
endpointIndependentNat?: boolean
includeInterface?: string[]
excludeInterface?: string[]
includeUid?: number[]
includeUidRange?: string[]
excludeUid?: number[]
excludeUidRange?: string[]
includeAndroidUser?: number[]
includePackage?: string[]
excludePackage?: string[]
}
export interface ServiceStatus {
installed: boolean
sidecar: boolean
status: 'Ready' | { "Unavailable": string }
}

6
web/src/lib/utils.ts Normal file
View File

@@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}