feat: add button to open logs folder
This commit is contained in:
1 parent
e927ac9506
commit
a438070268
4 files changed
+28
-1
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
import { ipc } from '@/ipc/manager';
|
||||||
|
|
||||||
|
export function openLogDirectory() {
|
||||||
|
return ipc.client.system.openLogDirectory();
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
import { os } from '@orpc/server';
|
import { os } from '@orpc/server';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { networkInterfaces } from 'os';
|
import { networkInterfaces } from 'os';
|
||||||
|
import { shell } from 'electron';
|
||||||
|
import { getAgentDir } from '../../utils/paths';
|
||||||
|
|
||||||
// Schema for IP info
|
// Schema for IP info
|
||||||
const IpInfoSchema = z.object({
|
const IpInfoSchema = z.object({
|
||||||
@@ -61,4 +63,10 @@ export const systemHandler = os.router({
|
|||||||
|
|
||||||
return results;
|
return results;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
// Open log directory in file explorer
|
||||||
|
openLogDirectory: os.output(z.void()).handler(async () => {
|
||||||
|
const logDir = getAgentDir();
|
||||||
|
await shell.openPath(logDir);
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
@@ -30,6 +30,7 @@ i18n
|
|||||||
deleteBackup: 'Delete Backup',
|
deleteBackup: 'Delete Backup',
|
||||||
backupCurrent: 'Backup Current',
|
backupCurrent: 'Backup Current',
|
||||||
retry: 'Retry',
|
retry: 'Retry',
|
||||||
|
openLogs: 'Open Log Directory',
|
||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
generic: 'An unexpected error occurred.',
|
generic: 'An unexpected error occurred.',
|
||||||
@@ -77,6 +78,7 @@ i18n
|
|||||||
version: 'Version',
|
version: 'Version',
|
||||||
platform: 'Platform',
|
platform: 'Platform',
|
||||||
license: 'License',
|
license: 'License',
|
||||||
|
openLogDir: 'Open',
|
||||||
account: {
|
account: {
|
||||||
title: 'Account Settings',
|
title: 'Account Settings',
|
||||||
description: 'Configure automatic account refresh and sync.',
|
description: 'Configure automatic account refresh and sync.',
|
||||||
@@ -304,6 +306,7 @@ i18n
|
|||||||
deleteBackup: '删除备份',
|
deleteBackup: '删除备份',
|
||||||
backupCurrent: '备份当前账号',
|
backupCurrent: '备份当前账号',
|
||||||
retry: '重试',
|
retry: '重试',
|
||||||
|
openLogs: '打开日志目录',
|
||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
generic: '发生未知错误。',
|
generic: '发生未知错误。',
|
||||||
@@ -351,6 +354,7 @@ i18n
|
|||||||
version: '版本',
|
version: '版本',
|
||||||
platform: '平台',
|
platform: '平台',
|
||||||
license: '许可证',
|
license: '许可证',
|
||||||
|
openLogDir: '打开',
|
||||||
account: {
|
account: {
|
||||||
title: '账号设置',
|
title: '账号设置',
|
||||||
description: '配置自动刷新和同步账号。',
|
description: '配置自动刷新和同步账号。',
|
||||||
|
|||||||
+11
-1
@@ -17,9 +17,10 @@ import { getAppVersion, getPlatform } from '@/actions/app';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { setAppLanguage } from '@/actions/language';
|
import { setAppLanguage } from '@/actions/language';
|
||||||
import { useAppConfig } from '@/hooks/useAppConfig';
|
import { useAppConfig } from '@/hooks/useAppConfig';
|
||||||
import { Loader2 } from 'lucide-react';
|
import { Loader2, FolderOpen } from 'lucide-react';
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { ProxyConfig } from '@/types/config';
|
import { ProxyConfig } from '@/types/config';
|
||||||
|
import { openLogDirectory } from '@/actions/system';
|
||||||
|
|
||||||
function SettingsPage() {
|
function SettingsPage() {
|
||||||
const { theme, setTheme } = useTheme();
|
const { theme, setTheme } = useTheme();
|
||||||
@@ -193,6 +194,15 @@ function SettingsPage() {
|
|||||||
|
|
||||||
<div className="text-muted-foreground">{t('settings.license')}</div>
|
<div className="text-muted-foreground">{t('settings.license')}</div>
|
||||||
<div className="font-medium">CC BY-NC-SA 4.0</div>
|
<div className="font-medium">CC BY-NC-SA 4.0</div>
|
||||||
|
|
||||||
|
<div className="text-muted-foreground">{t('action.openLogs')}</div>
|
||||||
|
<button
|
||||||
|
onClick={() => openLogDirectory()}
|
||||||
|
className="flex items-center gap-2 font-medium text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300"
|
||||||
|
>
|
||||||
|
<FolderOpen className="h-4 w-4" />
|
||||||
|
<span>{t('settings.openLogDir', 'Open')}</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in new issue
Block a user