chore: update
This commit is contained in:
@@ -31,10 +31,7 @@ use tauri::{
|
||||
tray::{MouseButton, MouseButtonState, TrayIconEvent},
|
||||
};
|
||||
|
||||
// TODO:
|
||||
// - 定时更新代理菜单(5s)
|
||||
// - 前端选择节点/代理组测速后,发送 event 事件,Tray 监听此事件
|
||||
// - 是否需要将可变菜单抽离存储起来,后续直接更新对应菜单实例,无需重新创建菜单(待考虑)
|
||||
// TODO: 是否需要将可变菜单抽离存储起来,后续直接更新对应菜单实例,无需重新创建菜单(待考虑)
|
||||
|
||||
#[derive(Clone)]
|
||||
struct TrayState {}
|
||||
|
||||
@@ -53,7 +53,7 @@ export const ClashInfoCard = () => {
|
||||
{t("Mixed Port")}
|
||||
</Typography>
|
||||
<Typography variant="body2" fontWeight="medium">
|
||||
{clashConfig["mixed-port"] || "-"}
|
||||
{clashConfig.mixedPort || "-"}
|
||||
</Typography>
|
||||
</Stack>
|
||||
<Divider />
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useLockFn } from "ahooks";
|
||||
import useSWR, { mutate } from "swr";
|
||||
import { getVersion } from "tauri-plugin-mihomo-api";
|
||||
|
||||
import {
|
||||
getClashInfo,
|
||||
patchClashConfig,
|
||||
getRuntimeConfig,
|
||||
} from "@/services/cmds";
|
||||
import { getVersion } from "tauri-plugin-mihomo-api";
|
||||
|
||||
export const useClash = () => {
|
||||
const { data: clash, mutate: mutateClash } = useSWR(
|
||||
|
||||
@@ -2,14 +2,18 @@ import { listen } from "@tauri-apps/api/event";
|
||||
import React, { createContext, use, useEffect, useMemo, useRef } from "react";
|
||||
import useSWR from "swr";
|
||||
import {
|
||||
BaseConfig,
|
||||
getBaseConfig,
|
||||
getRuleProviders,
|
||||
getRules,
|
||||
ProxyProvider,
|
||||
Rule,
|
||||
RuleProvider,
|
||||
} from "tauri-plugin-mihomo-api";
|
||||
|
||||
import { useClashInfo } from "@/hooks/use-clash";
|
||||
// import { useClashInfo } from "@/hooks/use-clash";
|
||||
import { useVerge } from "@/hooks/use-verge";
|
||||
import { useVisibility } from "@/hooks/use-visibility";
|
||||
// import { useVisibility } from "@/hooks/use-visibility";
|
||||
import {
|
||||
calcuProxies,
|
||||
calcuProxyProviders,
|
||||
@@ -31,16 +35,16 @@ interface ConnectionWithSpeed extends IConnectionsItem {
|
||||
curDownload: number;
|
||||
}
|
||||
|
||||
// 定义AppDataContext类型 - 使用宽松类型
|
||||
// 定义AppDataContext类型
|
||||
interface AppDataContextType {
|
||||
proxies: any;
|
||||
clashConfig: any;
|
||||
rules: any[];
|
||||
clashConfig: BaseConfig;
|
||||
rules: Rule[];
|
||||
sysproxy: any;
|
||||
runningMode?: string;
|
||||
uptime: number;
|
||||
proxyProviders: any;
|
||||
ruleProviders: any;
|
||||
proxyProviders: Record<string, ProxyProvider>;
|
||||
ruleProviders: Record<string, RuleProvider>;
|
||||
// connections: {
|
||||
// data: ConnectionWithSpeed[];
|
||||
// count: number;
|
||||
@@ -69,8 +73,8 @@ export const AppDataProvider = ({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) => {
|
||||
const pageVisible = useVisibility();
|
||||
const { clashInfo } = useClashInfo();
|
||||
// const pageVisible = useVisibility();
|
||||
// const { clashInfo } = useClashInfo();
|
||||
const { verge } = useVerge();
|
||||
|
||||
// 存储上一次连接数据用于速度计算
|
||||
@@ -157,6 +161,8 @@ export const AppDataProvider = ({
|
||||
|
||||
lastProfileId = newProfileId;
|
||||
lastUpdateTime = now;
|
||||
refreshRules();
|
||||
refreshRuleProviders();
|
||||
});
|
||||
|
||||
// 监听Clash配置刷新事件(enhance操作等)
|
||||
@@ -502,7 +508,7 @@ export const AppDataProvider = ({
|
||||
refreshProxyProviders,
|
||||
refreshRuleProviders,
|
||||
refreshAll,
|
||||
};
|
||||
} as AppDataContextType;
|
||||
}, [
|
||||
proxiesData,
|
||||
clashConfig,
|
||||
|
||||
Reference in New Issue
Block a user