Skip to content

feat(settings): 合并内外两个'关于' + 一键导出错误日志#286

Merged
appergb merged 1 commit into
mainfrom
feat/settings-about-merge-export-log
May 6, 2026
Merged

feat(settings): 合并内外两个'关于' + 一键导出错误日志#286
appergb merged 1 commit into
mainfrom
feat/settings-about-merge-export-log

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 6, 2026

User description

用户反馈

  1. 设置内外两个"关于"重复:设置侧栏有 "关于" tab,弹窗(菜单栏 → 设置)也有 "关于",体验割裂
  2. 需要一键导出错误日志:跨 macOS / Windows,让用户选保存位置,便于反馈排查

T2 合并"关于"

  • 删 `Settings.tsx` 的 `'about'` tab(enum + SECTION_ORDER + 渲染分支 + AboutSection 函数)
  • `SettingsModal.tsx` 的 `AboutMini` 接管所有内容:
    • source GitHub 链接 ✅
    • QQ 群行(1078960553 + 复制按钮)✅ 保留所有数据
    • docs / feedback / privacy / localFirst / 检查更新(已有)

T3 一键导出错误日志

改动
Cargo + npm 引入 `tauri-plugin-dialog`
Backend `lib.rs` plugin init + `log_dir_path` 改 `pub fn`
Backend `commands.rs` `export_error_log(target_path: String) -> Result<(), String>` 用 `std::fs::copy`
Frontend `ipc.ts` `exportErrorLog` wrapper:plugin-dialog `save` 选路径 → invoke 后端
Frontend `AboutMini` 新增"导出错误日志"行 + busy/ok/err 状态 + tooltip 显示实际路径

跨平台支持:log 路径 mac `~/Library/Logs/OpenLess/openless.log`、windows `%LOCALAPPDATA%\OpenLess\Logs\openless.log`,前端调用一致。

5 locale 同步翻译(10 个新 key)

`source / qq / qqDesc / copyQq / exportErrorLog / exportErrorLogDesc / exportErrorLogBtn / exporting / exportSuccess / exportFailed` 同时加到 zh-CN / en / zh-TW / ja / ko,保证 `typeof zhCN` 类型完整不破坏编译。

验证

  • `npx tsc --noEmit` 通过
  • `vite build` 通过
  • `cargo check` 通过(plugin-dialog 与 tauri ~2.10 兼容)
  • PR CI `Windows Tauri checks` + `pr_agent_job`
  • 本地 build 后真机点"导出错误日志"测 dialog 弹出 + 文件落盘

解耦说明

保留 `settings.about.*` i18n 块(即使 UI 不再用),避免破坏其他可能引用;下个清理 PR 再统一删。


PR Type

Bug fix, Enhancement


Description

  • Merge duplicate About sections into modal

  • Add one-click error log export via native dialog

  • Add QQ group number copy with visual feedback

  • Update all locale files with new keys


Diagram Walkthrough

flowchart LR
  A["Remove 'about' tab from Settings"]
  B["Merge content into AboutMini (SettingsModal)"]
  C["Add backend export_error_log command"]
  D["Add frontend IPC & UI for log export"]
  E["Add tauri-plugin-dialog dependency"]
  F["Update 5 locale files"]
  A -- "moves to" --> B
  C -- "invoked by" --> D
  E -- "native save dialog" --> D
  F -- "new i18n keys" --> B
  F -- "new i18n keys" --> D
Loading

File Walkthrough

Relevant files
Enhancement
10 files
commands.rs
Add export_error_log command                                                         
+14/-0   
lib.rs
Register dialog plugin and log command                                     
+3/-1     
SettingsModal.tsx
Merge About content and add log export UI                               
+79/-2   
en.ts
Add English i18n keys for About and log export                     
+10/-0   
ja.ts
Add Japanese i18n keys for About and log export                   
+10/-0   
ko.ts
Add Korean i18n keys for About and log export                       
+10/-0   
zh-CN.ts
Add Simplified Chinese i18n keys for About and log export
+10/-0   
zh-TW.ts
Add Traditional Chinese i18n keys for About and log export
+10/-0   
ipc.ts
Add exportErrorLog IPC wrapper with save dialog                   
+18/-0   
Settings.tsx
Remove About section and tab                                                         
+4/-61   
Dependencies
2 files
package.json
Add @tauri-apps/plugin-dialog dependency                                 
+1/-0     
Cargo.toml
Add tauri-plugin-dialog dependency                                             
+1/-0     

用户反馈:
1. 设置侧栏内有"关于" tab,弹窗里也有一个"关于",重复入口让人混乱
2. 需要"一键导出错误日志"功能,让用户选择保存位置,跨 macOS/Windows

## 设置"关于"合并 (T2)
- Settings.tsx 删 'about' 从 SettingsSectionId / SECTION_ORDER / 渲染分支 + 整个 AboutSection 函数(保留 settings.about i18n 块以防其他引用)
- SettingsModal.tsx 的 AboutMini 接管所有内容:
  - 新增 source GitHub 链接(迁自 AboutSection)
  - 新增 QQ 群行(含 1078960553 群号 + 复制按钮,逻辑迁自 AboutSection)
  - 保留原有 docs / feedback / privacy / localFirst pill / AboutUpdateControl

## 一键导出错误日志 (T3)
- Cargo.toml + package.json 引入 tauri-plugin-dialog(拿原生 save dialog)
- lib.rs:plugin init + log_dir_path 改 pub fn 让 commands.rs 能调
- commands.rs:新增 export_error_log(target_path) — std::fs::copy
  log_dir_path()/openless.log → target_path(mac:
  ~/Library/Logs/OpenLess/openless.log,windows:
  %LOCALAPPDATA%\OpenLess\Logs\openless.log)
- ipc.ts:exportErrorLog wrapper —— save dialog 选路径 → invoke 后端复制
- AboutMini 新增"导出错误日志"行:busy / ok / err 状态 + 实际保存路径 tooltip

## 5 个 locale 同步
modal.about 块统一新增 10 个 key(保证 typeof zhCN 类型完整不破坏编译):
- source / qq / qqDesc / copyQq
- exportErrorLog / exportErrorLogDesc / exportErrorLogBtn
- exporting / exportSuccess / exportFailed

zh-CN / zh-TW / en 用产品惯用术语;ja / ko 沿用 Beta 翻译风格。

## 验证
- npx tsc --noEmit 通过(5 locale 类型一致)
- vite build 通过
- cargo check 通过(plugin-dialog 与锁定的 tauri ~2.10 兼容)
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Stale Timeout

The success path starts a 4-second timer that resets exportStatus, but that timer is never cleared on unmount. If the user exports a log and closes the modal before the timer fires, React will update state on an unmounted component, which can produce warnings and leave a dangling timeout.

const onExportLog = async () => {
  setExportStatus('busy');
  setExportMessage('');
  try {
    const ts = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
    const target = await exportErrorLog(`openless-${ts}.log`);
    if (target == null) {
      setExportStatus('idle');
      return;
    }
    setExportStatus('ok');
    setExportMessage(target);
    window.setTimeout(() => setExportStatus('idle'), 4000);
  } catch (err) {

@appergb appergb merged commit eaf1dbe into main May 6, 2026
2 checks passed
appergb pushed a commit that referenced this pull request May 6, 2026
Release run 25419948896 三平台 (Linux / Win / mac arm64) 都挂在
tauri build 启动检查:

    Found version mismatched Tauri packages.
    tauri (v2.10.3) : @tauri-apps/api (v2.11.0)

根因翻转:
- 之前 (PR #281) Rust crate 漂上 2.11 而 npm 没发,所以锁 ~2.10 把 Rust
  拉下来。
- 这次 PR #286 加 @tauri-apps/plugin-dialog 时 npm 解析把
  @tauri-apps/api 升到 2.11.0(plugin-dialog 依赖 ^2.11.0),
  Rust 还锁 ~2.10 → 反向 mismatch。

修复:
- Cargo.toml 锁 ~2.11
- cargo update 让 tauri / tauri-runtime / tauri-runtime-wry 三件套都升到
  2.11.0(连带 wry 0.54.4 → 0.55.1 等 transitive 依赖)。

后续如果 Tauri 团队再发 2.12 而 npm 滞后,回头看 PR #281 同款做法处理。
@appergb appergb deleted the feat/settings-about-merge-export-log branch May 6, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant