refactor: change core binary name

This commit is contained in:
MystiPanda
2024-06-19 10:04:28 +08:00
parent 6fa0f92ceb
commit 28ab08a7ca
16 changed files with 113 additions and 82 deletions

View File

@@ -70,8 +70,8 @@ export const LayoutTraffic = () => {
);
/* --------- meta memory information --------- */
const isMetaCore = verge?.clash_core?.includes("clash-meta");
const displayMemory = isMetaCore && (verge?.enable_memory_usage ?? true);
const displayMemory = verge?.enable_memory_usage ?? true;
const { data: memory = { inuse: 0 } } = useSWRSubscription<
MemoryUsage,

View File

@@ -12,8 +12,8 @@ import { closeAllConnections, upgradeCore } from "@/services/api";
import getSystem from "@/utils/get-system";
const VALID_CORE = [
{ name: "Clash Meta", core: "clash-meta" },
{ name: "Clash Meta Alpha", core: "clash-meta-alpha" },
{ name: "Mihomo", core: "verge-mihomo" },
{ name: "Mihomo Alpha", core: "verge-mihomo-alpha" },
];
const OS = getSystem();
@@ -31,7 +31,7 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
close: () => setOpen(false),
}));
const { clash_core = "clash-meta" } = verge ?? {};
const { clash_core = "verge-mihomo" } = verge ?? {};
const onCoreChange = useLockFn(async (core: string) => {
if (core === clash_core) return;

View File

@@ -23,7 +23,7 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
const [open, setOpen] = useState(false);
const [values, setValues] = useState({
stack: "gvisor",
device: "Meta",
device: "Mihomo",
autoRoute: true,
autoDetectInterface: true,
dnsHijack: ["any:53"],
@@ -36,7 +36,7 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
setOpen(true);
setValues({
stack: clash?.tun.stack ?? "gvisor",
device: clash?.tun.device ?? "Meta",
device: clash?.tun.device ?? "Mihomo",
autoRoute: clash?.tun["auto-route"] ?? true,
autoDetectInterface: clash?.tun["auto-detect-interface"] ?? true,
dnsHijack: clash?.tun["dns-hijack"] ?? ["any:53"],
@@ -51,7 +51,7 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
try {
let tun = {
stack: values.stack,
device: values.device === "" ? "Meta" : values.device,
device: values.device === "" ? "Mihomo" : values.device,
"auto-route": values.autoRoute,
"auto-detect-interface": values.autoDetectInterface,
"dns-hijack": values.dnsHijack[0] === "" ? [] : values.dnsHijack,
@@ -90,7 +90,7 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
onClick={async () => {
let tun = {
stack: "gvisor",
device: "Meta",
device: "Mihomo",
"auto-route": true,
"auto-detect-interface": true,
"dns-hijack": ["any:53"],
@@ -99,7 +99,7 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
};
setValues({
stack: "gvisor",
device: "Meta",
device: "Mihomo",
autoRoute: true,
autoDetectInterface: true,
dnsHijack: ["any:53"],
@@ -151,7 +151,7 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
spellCheck="false"
sx={{ width: 250 }}
value={values.device}
placeholder="Meta"
placeholder="Mihomo"
onChange={(e) =>
setValues((v) => ({ ...v, device: e.target.value }))
}

View File

@@ -27,7 +27,7 @@ export const useClash = () => {
const version = versionData?.premium
? `${versionData.version} Premium`
: versionData?.meta
? `${versionData.version} Meta`
? `${versionData.version} Mihomo`
: versionData?.version || "-";
return {

View File

@@ -24,12 +24,7 @@ const ProxyPage = () => {
const { verge } = useVerge();
const modeList = useMemo(() => {
if (verge?.clash_core?.includes("clash-meta")) {
return ["rule", "global", "direct"];
}
return ["rule", "global", "direct", "script"];
}, [verge?.clash_core]);
const modeList = ["rule", "global", "direct"];
const curMode = clashConfig?.mode?.toLowerCase();