Skip to content

feat(wps-pdf): add convert command (WPS PDF / pdf.wps.cn document format conversion)#2029

Open
hzgfly-ai wants to merge 1 commit into
jackwener:mainfrom
hzgfly-ai:feat/wps-convert
Open

feat(wps-pdf): add convert command (WPS PDF / pdf.wps.cn document format conversion)#2029
hzgfly-ai wants to merge 1 commit into
jackwener:mainfrom
hzgfly-ai:feat/wps-convert

Conversation

@hzgfly-ai

@hzgfly-ai hzgfly-ai commented Jun 26, 2026

Copy link
Copy Markdown

What

Adds a new site adapter: wps-pdf convert — WPS PDF online document format conversion (the pdf.wps.cn subsite, not the WPS main site). Despite the "pdf" in the domain, this service handles PDF ↔ Word/Excel/PPT, image ↔ document, plus PDF operations (split / encrypt / watermark / ...). It reuses the user's existing logged-in WPS membership session.

opencli wps-pdf convert report.pdf --to docx -o report.docx
opencli wps-pdf convert contract.docx --to pdf

36 conversion directions, end-to-end verified.

How

  • Strategy.COOKIE + browser: true. The wps_sid auth cookie is HTTP-Only, so only the browser page context can attach it. The whole flow (upload → sign → commit → poll → download) runs inside page.evaluate against pdf.wps.cn's same-origin APIs.
  • Does not crack signing. Request signatures are produced by WPS's own /api/v1/sign endpoint; the adapter only reproduces the exact request fields. This stays stable even if WPS changes its signing algorithm — and keeps the approach session-reuse, not a bypass of access control.
  • No new dependencies; uses @jackwener/opencli/registry + @jackwener/opencli/errors only. Known failures throw typed errors (ArgumentError / AuthRequiredError / CommandExecutionError).

Checks

  • npm run build → manifest regenerated (wps-pdf convert registered)
  • npx tsc --noEmit → pass
  • opencli validate → PASS, 0 errors / 0 warnings for wps-pdf

Reference

Full reverse-engineering notes & self-repair map (what to re-reverse when WPS changes its frontend): https://github.com/hzgfly-ai/wps-convert

WPS PDF online document format conversion (pdf.wps.cn) — PDF <-> Word/
Excel/PPT, image <-> document, plus PDF operations (split/encrypt/
watermark/...), reusing the browser's existing WPS membership session.

- Strategy.COOKIE + browser:true: the wps_sid auth cookie is HTTP-Only,
  so only the browser page context can attach it; the conversion flow
  runs inside page.evaluate against pdf.wps.cn's same-origin APIs.
- Does NOT crack signing: request signatures are computed by WPS's own
  /api/v1/sign endpoint; the adapter only reproduces the exact request
  fields. Stable across signing-algorithm changes.
- 36 conversion directions, end-to-end verified.

Full reverse-engineering notes / self-repair map:
https://github.com/hzgfly-ai/wps-convert
@hzgfly-ai hzgfly-ai changed the title feat(wps): add convert command (WPS document format conversion) feat(wps-pdf): add convert command (WPS PDF / pdf.wps.cn document format conversion) Jun 26, 2026
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