How douweb010/multipost-extension works
Project type and purpose
• This is a browser extension (Chrome/Edge) built in TypeScript + React.
• Purpose: allow users to publish or synchronize content (text, images, videos) from any web page to multiple social media platforms with one click.
File structure
• Top-level configuration and CI/CD
• package.json, pnpm-lock.yaml, tsconfig.json, build scripts (makefile)
• .github/workflows for automated releases and issue management
• Husky, ESLint, Prettier, Stylelint for code quality
• src folder organized by “execution context”:
• background/ – MV3 service worker entry point and platform-agnostic services (tabs.ts, trust-domain.ts)
• contents/ – injected content script (extension.ts) plus helpers and scrapers for each target site
• popup/, options/, sidepanel/ – React UIs served in different extension panels
• components/ – shared React components (Header, Sidepanel Tabs, Sync tabs)
• sync/ – core business logic for “account,” “article,” “dynamic,” “video” synchronization; each platform has its own implementation under corresponding subfolder
• tabs/, utils/, types/ – utility modules, type definitions, keep-alive functions
• Localization: locales/{en,zh_CN}/messages.json
• Styling: tailwind.config.js, postcss.config.js, src/style.css
README for additional insights
• Confirms it’s a content-publishing extension with no backend/API keys.
• Mentions modular registration of platforms in sync/common.ts.
• Uses Plasmo or standard Chrome MV3 APIs.
a. Main components
• UI Layer
• Popup UI
• Options page
• Sidepanel UI (Sync tabs: About, Settings, Article, Video, Dynamic)
• Content Script Layer
• Scraper modules for each site (csdn, zhihu, jianshu, etc.)
• Helper modules (bilibili, weibo, common)
• Background Service Worker
• Chrome API services (tabs management, trust-domain checks)
• Message broker for UI ↔ content ↔ sync
• Sync Engine
• Registry (sync/common.ts)
• Account sync (bilibili, tiktok, etc.)
• Article sync (weixin, zhihu, jiangjin, etc.)
• Dynamic sync (social feeds)
• Video sync (youtube, douyin, etc.)
• External Systems
• Social platform HTTP APIs
• OAuth or no-auth endpoints (depending on platform)
b. Relationships and data flows
2. User selects action (publish now, schedule) → Popup sends message to background via chrome.runtime.sendMessage
3. Background checks trust-domain, obtains current tab info → dispatches “scrape request” to content script on that tab
4. Content script executes scraper pipeline → returns structured content to background
5. Background invokes Sync Engine modules (account/auth, article/video/dynamic)
6. Each sync module formats payload and performs HTTP calls to platform endpoints
7. Success/failure responses bubble back through background → UI displays status
c. Architectural patterns and design principles
• MV3 Event-Driven: background service worker reacts to messages and Chrome events
• Modular Plugin Architecture: each platform is a pluggable module under sync/ or contents/helper/
• Single Responsibility: clear separation between UI (React), orchestration (background), scraping (content), and publishing (sync modules)
• Registry Pattern: sync/common.ts auto-registers all platform modules
d. Key technologies
• TypeScript for type safety
• React + TSX for UI panels
• Tailwind CSS / PostCSS for styling
• Chrome Extension MV3 APIs
• pnpm, Husky, ESLint, Prettier, GitHub Actions for development workflow
Final reminders
• Essential pieces: UI panels, Chrome APIs, message bus, scrapers, sync modules, external platforms
• You don’t need to show every single platform file; group them logically (e.g., “Article Sync Modules: {zhihu, jianshu, …}”)