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

Skip to content

feat: baijiahao platform sync#50

Merged
timerring merged 1 commit intomainfrom
dev
Dec 31, 2025
Merged

feat: baijiahao platform sync#50
timerring merged 1 commit intomainfrom
dev

Conversation

@timerring
Copy link
Member

Summary

Add Baijiahao (百家号) platform support, allowing users to sync articles to Baijiahao with one click.

Related Issue

Closes #

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • Other (please describe):

Changes Made

  • Added src/platforms/baijiahao.js - Baijiahao platform configuration file
  • Registered Baijiahao platform in src/platforms/index.js
  • Added Baijiahao to frontend platform list in src/inject.js
  • Added Baijiahao login detection and content sync logic in src/background.js
  • Added Baijiahao domain permissions in manifest.json

Implementation Details

Key Changes:

  • Login detection: Uses BDUSS cookie to determine login status, calls https://baijiahao.baidu.com/builder/app/appinfo API to fetch username and avatar
  • Content sync: Uses the same clipboard paste approach as WeChat Official Account to preserve original styling
    • Title: Filled using contenteditable div + execCommand
    • Body: Pasted via ClipboardEvent paste event into the UEditor iframe

Technical Notes:

  • Baijiahao editor uses UEditor rich text editor with content inside an iframe
  • Baijiahao API requires cookie authentication, /builder/app/appinfo endpoint returns user info directly
  • Uses official icon: https://pic.rmb.bdstatic.com/10e1e2b43c35577e1315f0f6aad6ba24.vnd.microsoft.icon

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, open md.doocs.org or local editor
  2. Click publish button, verify Baijiahao appears in the platform list
  3. After logging into Baijiahao, verify login status correctly displays username and avatar
  4. Select Baijiahao and click sync, verify title and content are correctly filled in Baijiahao editor

Screenshots/Videos

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

Baijiahao publish page URL: https://baijiahao.baidu.com/builder/rc/edit?type=news

@timerring timerring self-assigned this Dec 31, 2025
@timerring timerring added the enhancement New feature or request label Dec 31, 2025
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 e670edb into main Dec 31, 2025
@timerring timerring deleted the dev branch December 31, 2025 05:08
@timerring timerring linked an issue Dec 31, 2025 that may be closed by this pull request
1 task
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]: Add Baijiahao Support

1 participant