Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: sohu platform sync#73

Merged
timerring merged 1 commit intomainfrom
dev
Jan 7, 2026
Merged

feat: sohu platform sync#73
timerring merged 1 commit intomainfrom
dev

Conversation

@timerring
Copy link
Member

Summary / 概述

Add support for Sohu Media Platform (搜狐号) as a new publishing target.

Related Issue / 关联 Issue

Closes #72

Type of Change / 更改类型

  • Bug fix / 修复 Bug
  • New feature / 新功能
  • Breaking change / 破坏性更改
  • Documentation update / 文档更新
  • Performance improvement / 性能优化
  • Code refactoring / 代码重构
  • Other / 其他

Changes Made / 更改内容

  • Added Sohu Media Platform (搜狐号) to the list of supported platforms
  • Implemented login detection using localStorage data (currentAccount and vuex)
  • Implemented content synchronization using ClipboardEvent paste to Quill editor
  • Added host permissions for *.sohu.com and mp.sohu.com in manifest.json

Implementation Details / 实现细节

Key Changes / 主要更改:

  • Created src/platforms/sohu.js with platform configuration and login config
  • Added Sohu imports and exports to src/platforms/index.js
  • Added Sohu to PLATFORMS array in src/inject.js
  • Added special handling in src/background.js for:
    • Login detection: Reads user info from localStorage via chrome.scripting.executeScript
    • Content sync: Uses ClipboardEvent with DataTransfer to paste HTML content

Technical Notes / 技术说明:

  • Sohu uses a Quill-based rich text editor (.ql-editor)
  • Login detection reads from localStorage.currentAccount or localStorage.vuex as the API requires authenticated cookies that Service Workers cannot access
  • Content filling uses the same approach as WeChat Official Account - creating a ClipboardEvent with HTML data to preserve formatting (bold, italic, etc.)
  • Title is filled using native value setter to trigger proper input events

Testing / 测试

Testing Checklist / 测试清单

  • I have tested this code locally
  • All existing tests pass
  • I have added tests for new functionality
  • I have tested on the affected platform(s)
  • I have verified the changes work in the target browser(s)

Manual Testing Steps / 手动测试步骤

  1. Load the extension in Chrome
  2. Log in to Sohu Media Platform (mp.sohu.com)
  3. Open the COSE sync dialog - verify Sohu shows as logged in with username and avatar
  4. Select Sohu and sync an article - verify title and content are filled correctly with formatting preserved

Screenshots/Videos / 截图/视频

N/A

Reviewer Checklist / 审阅者清单

  • Code follows the project's style guidelines
  • Changes are well-documented
  • No breaking changes or clearly documented if present
  • Security implications have been considered
  • Performance impact has been evaluated
  • All discussions have been resolved

Additional Notes / 补充说明

  • Sohu's page load can be slow, so extended timeouts are used for login detection
  • The login detection prioritizes reusing existing Sohu tabs to avoid creating unnecessary tabs

@timerring timerring self-assigned this Jan 7, 2026
@timerring timerring added the enhancement New feature or request label Jan 7, 2026
Copy link
Member Author

@timerring timerring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@timerring timerring merged commit d0d56ed into main Jan 7, 2026
@timerring timerring deleted the dev branch January 7, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Platform]: Sohu 搜狐号

1 participant