Skip to content

feat: merge dev into alpha - comprehensive improvements and bug fixes#150

Closed
mkdir700 wants to merge 8 commits intoalphafrom
dev
Closed

feat: merge dev into alpha - comprehensive improvements and bug fixes#150
mkdir700 wants to merge 8 commits intoalphafrom
dev

Conversation

@mkdir700
Copy link
Owner

🚀 Dev to Alpha Merge

此 PR 将 dev 分支的最新开发成果合并到 alpha 分支,包含多项重要功能改进、bug 修复和系统优化。

📋 主要变更内容

🆕 新功能特性

1. 字幕复制功能 (#140)

  • 快捷键支持: 新增 Ctrl+C 字幕复制功能
  • 智能复制: 支持复制选中文本或当前完整字幕
  • 用户反馈: 添加轻量级 toast 通知显示复制状态
  • 国际化: 完整的多语言支持

2. 字典服务 API (#143)

  • 前端接口: 在 preload 层暴露 DictionaryService API
  • 生产就绪: 18 个comprehensive测试用例,100% 通过率
  • 错误处理: 优雅处理网络错误和各种响应格式

3. 品牌重塑

  • 完整更名: 从 Cherry Studio 全面重塑为 EchoPlayer
  • 系统路径: 更新配置目录从 .cherrystudio.echoplayer
  • 用户界面: 更新托盘服务提示和用户代理字符串

🔧 重要修复

1. 播放器可靠性提升 (#141)

  • 根本解决: 修复键盘快捷键播放/暂停间歇性失效问题
  • 状态同步: 实现状态同步、乐观更新和延迟验证机制
  • 测试覆盖: 47 个测试用例,100% 通过率

2. 字幕显示优化 (#138)

  • 时间边界检查: 添加 useSubtitleOverlay 时间边界检查
  • 显示逻辑: 确保字幕仅在时间范围内显示

3. 跨平台构建修复 (#145)

  • macOS 构建: 修复在 macOS 上构建 Windows 目标的 FFmpeg 问题

🧪 测试状况

  • 字典服务: 18 个测试用例,100% 通过
  • 播放器: 47 个测试用例,100% 通过
  • 跨平台: Windows/macOS/Linux 构建验证

📱 用户体验提升

  1. 播放控制: 播放/暂停操作更加可靠稳定
  2. 字幕操作: 新增便捷的字幕复制功能
  3. 字典查询: API 可用于后续字典功能开发
  4. 显示效果: 字幕显示逻辑更加精确
  5. 品牌一致: 统一的 EchoPlayer 品牌体验

Ready for alpha testing 🎉

mkdir700 and others added 8 commits September 12, 2025 18:10
…pplication

- Update README acknowledgments table to reflect correct project name
- Replace tray service tooltip from "Cherry Studio" to "EchoPlayer"
- Update temporary directory path from "CherryStudio" to "EchoPlayer"
- Change config directory from ".cherrystudio" to ".echoplayer"
- Update MCP directory path configuration for new branding
- Modify executable file names for AppImage and portable versions
- Update User-Agent string to use "EchoPlayer" instead of "CherryStudio"

This comprehensive rebranding ensures consistent naming across all user-facing
elements, system paths, and application identifiers while maintaining
functionality and preserving existing user configurations through path updates.
…138)

- Add time boundary check in useSubtitleOverlay hook
- Ensure overlay only displays when current time is within subtitle time range
- Fixes issue where overlay showed previous subtitle content after its end time
- Preserves SubtitleListPanel highlighting functionality by keeping useSubtitleEngine unchanged
* fix(player): improve play/pause button reliability

Fix intermittent play/pause failures by implementing state synchronization,
optimistic updates, and delayed verification mechanisms.

## Root Cause
- requestTogglePlay relied on videoController.isPaused() which could be
  out of sync with internal state
- Async play() operations could fail without proper error recovery
- State inconsistencies between video element and orchestrator context

## Solution
- Use internal context state as authoritative source for play/pause decisions
- Add syncPlaybackState() method to detect and fix state mismatches
- Implement optimistic updates with failure rollback
- Add delayed verification and retry mechanisms
- Enhance error handling for DOMExceptions

## Changes
- PlayerOrchestrator: Add state sync, optimistic updates, retry logic
- usePlayerCommands: Add detailed debugging logs and result verification
- Tests: Add 19 comprehensive test cases covering all scenarios

## Test Coverage
- 47 total test cases (100% pass rate)
- State synchronization scenarios
- Async operation handling
- Error recovery mechanisms
- Edge cases and boundary conditions
- Real usage scenarios (shortcuts, browser limitations)

Resolves the issue where play/pause would occasionally fail to resume
playback via keyboard shortcuts, requiring mouse click to recover.

* Update src/renderer/src/pages/player/engine/__tests__/PlayerOrchestrator.playback-reliability.test.ts
…prehensive tests (#143)

- Add dictionary API to preload layer for frontend access
- Create comprehensive test suite for DictionaryService with 18 test cases
- Test coverage includes success scenarios, error handling, HTML parsing robustness, parameter processing, and edge cases
- Verify API can handle various dictionary response formats and gracefully handle network errors
- All tests pass, demonstrating production-ready robustness

API Usage:
```typescript
const result = await window.api.dictionary.queryEudic('hello', 'greeting context');
if (result.success) {
  console.log(result.data); // { word, phonetic, definitions, examples, translations }
}
```
…ets (#145)

* fix(build): fix FFmpeg cross-platform build on macOS for Windows targets

- Add cross-env dependency for cross-platform environment variables
- Update Windows build scripts to set BUILD_TARGET_PLATFORM and BUILD_TARGET_ARCH
- Modify download-ffmpeg.ts to prioritize environment variables over command arguments
- Update vite plugin to avoid duplicate FFmpeg downloads
- Fix release scripts to download all platform FFmpeg binaries before building
- Ensure correct FFmpeg binaries are included for each target platform

Resolves issue where building Windows packages on macOS would include macOS FFmpeg binaries instead of Windows ones.

* fix(build): improve FFmpeg download in CI environments

- Replace direct tsx command with npm run for better CI compatibility
- Add CI-specific handling with proper environment variable passing
- Convert hard failures to warnings to prevent CI build blocking
- Improve error messages and debugging information

Fixes Windows CI build failure: spawn tsx ENOENT

* fix(build): ensure FFmpeg is properly downloaded in Windows CI

- Use npm run ffmpeg:download on Windows for better compatibility
- Pass environment variables to ensure correct platform detection
- Throw errors on download failure to prevent incomplete builds
- Keep direct tsx usage on Unix systems for performance

This ensures CI builds never skip FFmpeg download and always include
the correct FFmpeg binaries for the target platform.
…ion (#140)

* feat(player): add subtitle copy shortcut with Ctrl+C

- Add copy_subtitle shortcut to constants with CommandOrControl+C
- Implement copy functionality in usePlayerShortcuts hook
- Support copying selected text or current subtitle based on display mode
- Add success/error notifications for copy operations
- Remove obsolete keyboard handling from SubtitleContent component
- Add i18n label support for copy_subtitle shortcut

* fix(player): enable text selection in subtitle tokens for copy functionality

- Change WordToken user-select from 'none' to 'text' to allow native text selection
- Add debug logging to copy function to help diagnose selection issues
- This enables Ctrl+C to copy selected subtitle text properly

* fix(player): use custom subtitle selection for copy functionality

- Use selectedText from useSubtitleOverlayUI instead of window.getSelection()
- Integrate with custom selection system used by SubtitleContent component
- Restore WordToken user-select: none to maintain custom selection behavior
- Update copy logic to properly detect custom selected text vs full subtitle
- Remove window.getSelection() debugging code as it's no longer used

* debug: add logging to copy function to diagnose selectedText state

* feat(player): add DOM-based selected text detection for copy

- Add fallback to DOM query when selectedText state is empty
- Check for selected tokens by background color style
- Maintains both state-based and DOM-based selection detection
- This should fix the issue where selectedText state gets cleared before copy

* simplify: remove word selection feature, keep only full subtitle copy

- Remove all selected text detection logic (selectedText state and DOM queries)
- Simplify copy function to only copy current subtitle based on display mode
- Remove dependency on useSubtitleOverlayUI hook
- Clean up notification message to show copied character count
- This makes the copy functionality simple and reliable

* feat(player): add lightweight toast notifications for subtitle copy

- Add Ctrl+C shortcut to copy current subtitle based on display mode
- Replace intrusive NotificationService with lightweight toast positioned above subtitle overlay
- Implement custom event system for decoupled toast communication between components
- Add i18n support for copy success/failure messages in zh-cn.json
- Toast automatically hides after 2 seconds with smooth fade transition
- Support copying original, translated, or bilingual subtitle content based on current display mode
- Position toast relative to subtitle overlay for better UX during immersive video watching

This improves user experience by providing non-intrusive feedback while maintaining
clean component architecture and supporting internationalization.

* Update src/renderer/src/pages/player/components/SubtitleOverlay.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update src/renderer/src/pages/player/components/SubtitleOverlay.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update src/renderer/src/pages/player/components/SubtitleOverlay.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* 📝 Add docstrings to `copy-subtitle-shortcut` (#142)

Docstrings generation was requested by @mkdir700.

* #140 (comment)

The following files were modified:

* `src/renderer/src/pages/player/hooks/usePlayerShortcuts.ts`

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update

* refactor: use design tokens in Toast components and add theming best practices

- Replace hardcoded values with design tokens in ToastContainer and ToastContent
- Use ANIMATION_DURATION, EASING, FONT_SIZES, FONT_WEIGHTS, SPACING, Z_INDEX, GLASS_EFFECT tokens
- Reduce toast display duration from 2000ms to 800ms for better UX
- Add comprehensive theming best practices to CLAUDE.md
- Document mixed approach: CSS variables for theme-related properties, JS variables for design constants

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 12, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mkdir700
Copy link
Owner Author

关闭此 PR,因为包含重复提交。已通过 cherry-pick 方式修复 alpha 分支,将重新创建干净的 PR。

@mkdir700 mkdir700 closed this Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant