mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-08 02:52:07 +08:00
refactor: knip cleanup (#7468)
* chore(frontend): expand Knip reports * chore: remove unused Mihomo changelog sync script * refactor: remove unused value exports * refactor: remove unused type exports * refactor: remove circular route dependencies * chore(frontend): move Knip scope to config * chore(i18n): remove stale portable update message
This commit is contained in:
@@ -100,10 +100,6 @@ export async function getRuntimeYaml() {
|
||||
return invoke<string | null>('get_runtime_yaml')
|
||||
}
|
||||
|
||||
export async function getRuntimeExists() {
|
||||
return invoke<string[]>('get_runtime_exists')
|
||||
}
|
||||
|
||||
export async function getRuntimeLogs() {
|
||||
return invoke<Record<string, [string, string][]>>('get_runtime_logs')
|
||||
}
|
||||
@@ -264,10 +260,6 @@ export async function getClashLogs() {
|
||||
}, [])
|
||||
}
|
||||
|
||||
export async function clearLogs() {
|
||||
return invoke<void>('clear_logs')
|
||||
}
|
||||
|
||||
export async function getVergeConfig() {
|
||||
return invoke<IVergeConfig>('get_verge_config')
|
||||
}
|
||||
@@ -302,23 +294,10 @@ export async function getAutotemProxy() {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getAutoLaunchStatus() {
|
||||
try {
|
||||
return await invoke<boolean>('get_auto_launch_status')
|
||||
} catch (error) {
|
||||
console.error('获取自启动状态失败:', error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export async function changeClashCore(clashCore: string) {
|
||||
return invoke<string | null>('change_clash_core', { clashCore })
|
||||
}
|
||||
|
||||
export async function startCore() {
|
||||
return invoke<void>('start_core')
|
||||
}
|
||||
|
||||
export async function stopCore() {
|
||||
return invoke<void>('stop_core')
|
||||
}
|
||||
@@ -355,38 +334,6 @@ export const openWebUrl = async (url: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
export async function cmdGetProxyDelay(
|
||||
name: string,
|
||||
timeout: number,
|
||||
url?: string,
|
||||
) {
|
||||
// 确保URL不为空
|
||||
const testUrl = url || 'http://cp.cloudflare.com/generate_204'
|
||||
|
||||
try {
|
||||
// 不再在前端编码代理名称,由后端统一处理编码
|
||||
const result = await invoke<{ delay: number }>(
|
||||
'clash_api_get_proxy_delay',
|
||||
{
|
||||
name,
|
||||
url: testUrl, // 传递经过验证的URL
|
||||
timeout,
|
||||
},
|
||||
)
|
||||
|
||||
// 验证返回结果中是否有delay字段,并且值是一个有效的数字
|
||||
if (result && typeof result.delay === 'number') {
|
||||
return result
|
||||
} else {
|
||||
// 返回一个有效的结果对象,但标记为超时
|
||||
return { delay: 1e6 }
|
||||
}
|
||||
} catch {
|
||||
// 返回一个有效的结果对象,但标记为错误
|
||||
return { delay: 1e6 }
|
||||
}
|
||||
}
|
||||
|
||||
export async function cmdTestDelay(url: string) {
|
||||
return invoke<number>('test_delay', { url })
|
||||
}
|
||||
@@ -397,10 +344,6 @@ export async function invoke_uwp_tool() {
|
||||
)
|
||||
}
|
||||
|
||||
export async function getPortableFlag() {
|
||||
return invoke<boolean>('get_portable_flag')
|
||||
}
|
||||
|
||||
export async function openDevTools() {
|
||||
return invoke('open_devtools')
|
||||
}
|
||||
@@ -518,14 +461,6 @@ export async function listLocalBackup() {
|
||||
return invoke<ILocalBackupFile[]>('list_local_backup')
|
||||
}
|
||||
|
||||
export async function scriptValidateNotice(status: string, msg: string) {
|
||||
return invoke<void>('script_validate_notice', { status, msg })
|
||||
}
|
||||
|
||||
export async function validateScriptFile(filePath: string) {
|
||||
return invoke<ValidationOutcome>('validate_script_file', { filePath })
|
||||
}
|
||||
|
||||
// 获取当前运行模式
|
||||
export const getRunningMode = async () => {
|
||||
return invoke<string>('get_running_mode')
|
||||
@@ -546,16 +481,6 @@ export const uninstallService = async () => {
|
||||
return invoke<void>('uninstall_service')
|
||||
}
|
||||
|
||||
// 重装系统服务
|
||||
export const reinstallService = async () => {
|
||||
return invoke<void>('reinstall_service')
|
||||
}
|
||||
|
||||
// 修复系统服务
|
||||
export const repairService = async () => {
|
||||
return invoke<void>('repair_service')
|
||||
}
|
||||
|
||||
// 系统服务是否可用
|
||||
export const isServiceAvailable = async () => {
|
||||
try {
|
||||
@@ -569,10 +494,6 @@ export const entry_lightweight_mode = async () => {
|
||||
return invoke<void>('entry_lightweight_mode')
|
||||
}
|
||||
|
||||
export const exit_lightweight_mode = async () => {
|
||||
return invoke<void>('exit_lightweight_mode')
|
||||
}
|
||||
|
||||
export const isAdmin = async () => {
|
||||
try {
|
||||
return await invoke<boolean>('app_is_admin')
|
||||
|
||||
Reference in New Issue
Block a user