Skip to content

fix: ack MULTIPOST_EXTENSION_PUBLISH so callers don't hit timeout#211

Closed
harryisfish wants to merge 269 commits into
mainfrom
feature/ack-publish-message
Closed

fix: ack MULTIPOST_EXTENSION_PUBLISH so callers don't hit timeout#211
harryisfish wants to merge 269 commits into
mainfrom
feature/ack-publish-message

Conversation

@harryisfish
Copy link
Copy Markdown
Contributor

Summary

The web client (`leaperone/MultiPost` → `apps/web/lib/extension/index.ts` `funcPublish`) sends a `MULTIPOST_EXTENSION_PUBLISH` message through the content-script bridge, which uses `chrome.runtime.sendMessage` and awaits the response. The background handler opened a popup but never called `sendResponse` — combined with the listener's `return true` (kept the port open), this meant `funcPublish` always waited the full 30s before reporting a fake failure.

Evidence (web-side PostHog, 7 days)

event count
`publish_initiated` 812
`publish_failed` 792 (all "Request timeout after 30000ms")
`publish_success` 0

That's a 97.5% false failure rate — but the actual publish flow works fine for users; only the web-side promise hangs.

Change

One-line ACK in the `MULTIPOST_EXTENSION_PUBLISH` branch:

```ts
sendResponse({ queued: true });
```

The popup-driven publish flow is unchanged. The real result still flows through `MULTIPOST_EXTENSION_PUBLISH_NOW` later.

Companion PR

The web side has a complementary fix (`leaperone/MultiPost#251`) that splits the event into `publish_dispatched` and drops timeout-flavored `publish_failed` reports. With both PRs landed, `funcPublish` will resolve with `{ success: true }` immediately upon ACK, and the false-failure noise goes away.

Test plan

  • Build extension, load unpacked in Chrome
  • Open multipost.app, trigger a publish — verify popup opens and the caller's promise resolves quickly (not after 30s)
  • No regression in actual publish flow (MULTIPOST_EXTENSION_PUBLISH_NOW path)

harryisfish and others added 30 commits February 2, 2025 22:36
* feat: add CSDN article sync support with image upload and publishing

* feat: add Article tab with content import and sync functionality

* chore: update project dependencies and eslint configuration

* feat: enhance article sync with cover image, digest, and platform selection

* feat: improve content processing and image handling during article sync
harryisfish and others added 25 commits November 28, 2025 15:53
- Add video publishing support for: alipay, chejiahao, dayu, dewu,
  netease, pinduoduo, qie, sohu, vivovideo, yiche, yidian
- Add account detection for new platforms
- Update douyin video publishing logic
- Add i18n keys for new platforms

Excluded package.json, pnpm-lock.yaml, and .gitignore changes
from original PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update @mozilla/readability from 0.5.0 to 0.6.0
- Add pnpm overrides to force update vulnerable dependencies
- Fix 17 out of 19 security vulnerabilities (89% reduction)
- Remaining 2 vulnerabilities have no official patches yet

Security improvements:
- High severity: 6 → 0 (100% fixed)
- Moderate severity: 8 → 1 (87.5% fixed)
- Low severity: 4 → 1 (75% fixed)

Remaining vulnerabilities (development-only, no production impact):
- @parcel/reporter-dev-server (moderate)
- tsup (low)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
- Add dynamic/substack.ts for Notes publishing (supports images/videos)
- Add article/substack.ts for long-form article publishing (supports cover image)
- Register Substack in DynamicInfoMap and ArticleInfoMap
- Add i18n translations for Substack platform name

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: migrate from ESLint/Prettier/Stylelint to Biome

- Remove ESLint, Prettier, Stylelint and related dependencies
- Add @biomejs/biome for linting and formatting
- Update package.json scripts: lint, lint:fix, format
- Update lint-staged config to use biome
- Update VS Code extensions recommendations
- Format all source files with biome

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: use react-jsx transform to avoid explicit React imports

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: change video inject functions return type to Promise<void>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: resolve all lint warnings

- Remove unreachable code in eastmoney.ts and dayu.ts
- Remove unused uploadImage function and imageFiles parameter in eastmoney.ts
- Remove unused QiEVideoUploader class definition in qie.ts
- Fix useless else in dayu.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
- Add post type button click after initial new post button
- Add input event dispatch for file uploads
- Use arrayBuffer instead of blob for file processing
- Add comprehensive debug logging for troubleshooting
- Fix autoPublish logic to properly trigger share button

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Use ClipboardEvent for pasting content instead of execCommand
- Update file input selector to match Facebook's exact accept attribute
- Use last file input element for uploads (matching reference implementation)
- Use arrayBuffer instead of blob for file processing
- Add input event dispatch after change event for uploads
- Search for editor by aria-placeholder to find correct textbox
- Fix autoPublish flag (was isAutoPublish)
- Add comprehensive debug logging

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update trigger button selector to use top-bar container
- Find editor by data-placeholder attribute for better accuracy
- Use innerText instead of innerHTML for content input
- Combine images and videos into single mediaFiles array
- Add 8 file limit check with debug logging
- Fix autoPublish flag (was isAutoPublish)
- Add comprehensive debug logging
- Simplify code structure by removing separate uploadFiles function

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update selectors for Reddit's new UI components (shadowRoot access)
- Use faceplate-textarea-input for title input
- Use r-post-media-input for file uploads
- Click Image & Video tab when media files present
- Find content editor as third contenteditable div
- Add title length limit (300 chars)
- Use r-post-form-submit-button for submit
- Fix autoPublish flag (was isAutoPublish)
- Simplify code structure and add debug logging

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Change from TEXT to IMAGE type to match the updated publishing flow.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add Maimai (脉脉) dynamic publishing support
- Add Juejin (掘金) dynamic publishing support
- Update Juejin article publishing to use autoPublish flag
- Add i18n translations for Maimai platform

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Cast Element to HTMLElement for DOM properties like offsetParent,
click(), focus(), value.

Files fixed:
- alipay.ts, netease.ts, pinduoduo.ts, sohu.ts, vivovideo.ts,
  yiche.ts, yidian.ts: fix offsetParent and click() type errors
- chejiahao.ts: fix multiple type issues including NodeListOf casts
- dayu.ts: fix maxlength -> maxLength and NodeListOf cast

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix autoPublish -> isAutoPublish in 7 platform sync files
- Fix ArticleData.content -> htmlContent in article/juejin.ts
- Fix webhook.ts content property type access
- Remove deprecated index_old.tsx
- Update options page to always redirect to multipost.app

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add developer documentation link
- Update platform list with YouTube
- Remove deprecated scraper features section
Removed Twitter and Bento.me contact links from README.
- Simplify drag-and-drop simulation in dynamic Kuaishou publisher
- Add autoPublish check before clicking publish button in video Kuaishou
- Use production BASE_URL consistently in popup instead of localhost in dev

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: resolve dependabot security alerts via pnpm overrides

Override vulnerable transitive dependencies to patched versions:
- rollup: >=4.59.0 (arbitrary file write via path traversal)
- svelte: >=5.53.5 (multiple SSR XSS vulnerabilities)
- minimatch: >=10.2.3 (ReDoS)
- ajv: >=8.18.0 (ReDoS with $data option)
- devalue: >=5.6.3 (DoS via memory/CPU exhaustion)
- @isaacs/brace-expansion: >=5.0.1 (uncontrolled resource consumption)
- lodash: >=4.17.23 (prototype pollution)

Note: @parcel/reporter-dev-server and tsup have no patched versions
available yet (dev-only dependencies, lower risk).

* fix: correct overrides after review

- Revert svelte override to ^4.2.19 (v5 is breaking change, v5-only
  CVEs don't apply to this project)
- Remove lodash override (>=4.17.23 caused lodash to be dropped from
  tree instead of upgraded; lodash is optional dep, low risk)
- Remove @isaacs/brace-expansion override (package not in dependency
  tree, override had no effect)

---------

Co-authored-by: Harry <harry@Harrys-Mac-mini.local>
The web client (apps/web/lib/extension/index.ts funcPublish) sends a
MULTIPOST_EXTENSION_PUBLISH message through the content-script bridge,
which uses chrome.runtime.sendMessage and awaits the response. The
background handler opened a popup but never called sendResponse - combined
with the listener's return true (kept the port open), this meant
funcPublish always waited the full 30s before reporting a fake failure.

Production impact (web-side PostHog over 7 days):
  publish_initiated  = 812
  publish_failed     = 792  (all Request timeout after 30000ms)
  publish_success    = 0

This change adds a synchronous sendResponse({ queued: true }) so the
caller resolves immediately. The popup-driven publish flow is unchanged;
the real result still flows through MULTIPOST_EXTENSION_PUBLISH_NOW.
@leaperone-bot
Copy link
Copy Markdown

🤖 Leo

Code Review

⏳ 等待审查...

最后更新: 2026-05-20 14:55 · 2a372a2

@cunoe cunoe closed this Jun 5, 2026
@cunoe cunoe deleted the feature/ack-publish-message branch June 5, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants