diff --git a/src/actions/system.ts b/src/actions/system.ts new file mode 100644 index 0000000..31a885b --- /dev/null +++ b/src/actions/system.ts @@ -0,0 +1,5 @@ +import { ipc } from '@/ipc/manager'; + +export function openLogDirectory() { + return ipc.client.system.openLogDirectory(); +} diff --git a/src/ipc/system/handler.ts b/src/ipc/system/handler.ts index e033d6b..3a88cea 100644 --- a/src/ipc/system/handler.ts +++ b/src/ipc/system/handler.ts @@ -1,6 +1,8 @@ import { os } from '@orpc/server'; import { z } from 'zod'; import { networkInterfaces } from 'os'; +import { shell } from 'electron'; +import { getAgentDir } from '../../utils/paths'; // Schema for IP info const IpInfoSchema = z.object({ @@ -61,4 +63,10 @@ export const systemHandler = os.router({ return results; }), + + // Open log directory in file explorer + openLogDirectory: os.output(z.void()).handler(async () => { + const logDir = getAgentDir(); + await shell.openPath(logDir); + }), }); diff --git a/src/localization/i18n.ts b/src/localization/i18n.ts index e3d4f29..3ad4af2 100644 --- a/src/localization/i18n.ts +++ b/src/localization/i18n.ts @@ -30,6 +30,7 @@ i18n deleteBackup: 'Delete Backup', backupCurrent: 'Backup Current', retry: 'Retry', + openLogs: 'Open Log Directory', }, error: { generic: 'An unexpected error occurred.', @@ -77,6 +78,7 @@ i18n version: 'Version', platform: 'Platform', license: 'License', + openLogDir: 'Open', account: { title: 'Account Settings', description: 'Configure automatic account refresh and sync.', @@ -304,6 +306,7 @@ i18n deleteBackup: '删除备份', backupCurrent: '备份当前账号', retry: '重试', + openLogs: '打开日志目录', }, error: { generic: '发生未知错误。', @@ -351,6 +354,7 @@ i18n version: '版本', platform: '平台', license: '许可证', + openLogDir: '打开', account: { title: '账号设置', description: '配置自动刷新和同步账号。', diff --git a/src/routes/settings.tsx b/src/routes/settings.tsx index afc0bc7..ca42ee1 100644 --- a/src/routes/settings.tsx +++ b/src/routes/settings.tsx @@ -17,9 +17,10 @@ import { getAppVersion, getPlatform } from '@/actions/app'; import { useTranslation } from 'react-i18next'; import { setAppLanguage } from '@/actions/language'; import { useAppConfig } from '@/hooks/useAppConfig'; -import { Loader2 } from 'lucide-react'; +import { Loader2, FolderOpen } from 'lucide-react'; import { useState, useEffect } from 'react'; import { ProxyConfig } from '@/types/config'; +import { openLogDirectory } from '@/actions/system'; function SettingsPage() { const { theme, setTheme } = useTheme(); @@ -193,6 +194,15 @@ function SettingsPage() {
{t('settings.license')}
CC BY-NC-SA 4.0
+ +
{t('action.openLogs')}
+