feat: add export diagnostic info functionality (#2856)

This commit is contained in:
Tunglies
2025-03-03 05:58:12 +08:00
committed by GitHub
parent 277390e597
commit aff504bddc
10 changed files with 87 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
import { useRef } from "react";
import { useCallback, useRef } from "react";
import { useTranslation } from "react-i18next";
import { Typography } from "@mui/material";
import {
@@ -7,6 +7,7 @@ import {
openCoreDir,
openLogsDir,
openDevTools,
exportDiagnosticInfo,
} from "@/services/cmds";
import { check as checkUpdate } from "@tauri-apps/plugin-updater";
import { useVerge } from "@/hooks/use-verge";
@@ -21,6 +22,7 @@ import { LayoutViewer } from "./mods/layout-viewer";
import { UpdateViewer } from "./mods/update-viewer";
import { BackupViewer } from "./mods/backup-viewer";
import { TooltipIcon } from "@/components/base/base-tooltip-icon";
import { ContentCopyRounded } from "@mui/icons-material";
interface Props {
onError?: (err: Error) => void;
@@ -51,6 +53,11 @@ const SettingVergeAdvanced = ({ onError }: Props) => {
}
};
const onExportDiagnosticInfo = useCallback(async () => {
await exportDiagnosticInfo();
Notice.success(t("Copy Success"), 1000);
}, []);
return (
<SettingList title={t("Verge Advanced Setting")}>
<ThemeViewer ref={themeRef} />
@@ -111,6 +118,16 @@ const SettingVergeAdvanced = ({ onError }: Props) => {
label={t("Exit")}
/>
<SettingItem
label={t("Export Diagnostic Info")}
extra={
<TooltipIcon
icon={ContentCopyRounded}
onClick={onExportDiagnosticInfo}
/>
}
></SettingItem>
<SettingItem label={t("Verge Version")}>
<Typography sx={{ py: "7px", pr: 1 }}>v{version}</Typography>
</SettingItem>

View File

@@ -349,6 +349,8 @@
"Portable Updater Error": "The portable version does not support in-app updates. Please manually download and replace it",
"Break Change Update Error": "This version is a major update and does not support in-app updates. Please uninstall it and manually download and install the new version",
"Open Dev Tools": "Dev Tools",
"Export Diagnostic Info": "Export Diagnostic Info",
"Export Diagnostic Info For Issue Reporting": "Export Diagnostic Info For Issue Reporting",
"Exit": "Exit",
"Verge Version": "Verge Version",
"ReadOnly": "ReadOnly",

View File

@@ -191,6 +191,10 @@ export async function exitApp() {
return invoke("exit_app");
}
export async function exportDiagnosticInfo() {
return invoke("export_diagnostic_info");
}
export async function copyIconFile(
path: string,
name: "common" | "sysproxy" | "tun",