Files
readest/apps/readest-app/extensions/send-to-readest/package.json
T
Huang Xin f6dfd09d82 feat(send): browser extension that clips pages into Readest as EPUBs (#4266)
Replaces the URL-only placeholder extension with a full MV3 page-clipper
that builds a self-contained EPUB on the user's machine and uploads it
to the inbox.

- Captures the rendered DOM in a content script, then runs Readability,
  asset bundling, and EPUB build through the shared
  `convertToEpub({kind: 'page'})` pipeline inside a Chrome offscreen
  document (the SW lacks DOMParser).
- Uploads the resulting EPUB directly from the offscreen page to the
  new `POST /api/send/inbox/file` endpoint — keeps the bytes in one
  realm because `runtime.sendMessage` JSON-serialises ArrayBuffer to
  `{}` between extension contexts.
- Adds a long-lived Port + ping handshake between SW, offscreen, and
  the on-demand capture content script so neither idle-eviction nor
  load-order races can hang the popup.
- Localised popup, badge feedback, key-as-content i18n (`_('English source')`)
  with an extract script that seeds locale stubs from i18n-langs.json
  and writes a static-imports map for the runtime. All 33 locales
  fully translated.
- Server: `pages/api/send/inbox/file.ts` accepts a raw EPUB body
  (Content-Type: application/epub+zip), enforces the inbox pending cap,
  stores to the existing send-inbox R2 bucket as `kind='file'`.
  `assetBundler` now sets `credentials: 'include'` in the non-Tauri
  branch so the extension SW carries paywalled-CDN cookies.
- 47 vitest cases for the extension shell (upload, badge, auth, lazy,
  popup state machine, auth-bridge token sync) + 8 cases for the new
  server endpoint. CI's `test_web_app` invokes both via the extended
  `test:pr:web` plus a `build-browser-ext` step that catches webpack
  alias / Tauri-stub regressions.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 14:45:29 +02:00

29 lines
858 B
JSON

{
"name": "@readest/send-to-readest-extension",
"version": "0.2.0",
"private": true,
"description": "Browser extension that clips the current web page into the user's Readest library as a self-contained EPUB.",
"scripts": {
"build": "webpack --mode production",
"dev": "webpack --watch --mode development",
"clean": "rimraf dist",
"i18n:extract": "node scripts/extract-i18n.mjs",
"i18n:check": "node scripts/extract-i18n.mjs --check"
},
"dependencies": {
"@mozilla/readability": "^0.6.0",
"@zip.js/zip.js": "^2.8.16",
"dompurify": "^3.4.0"
},
"devDependencies": {
"@types/chrome": "^0.0.270",
"@types/dompurify": "^3.0.5",
"copy-webpack-plugin": "^14.0.0",
"rimraf": "^6.0.1",
"ts-loader": "^9.5.1",
"typescript": "^5.6.3",
"webpack": "^5.97.1",
"webpack-cli": "^5.1.4"
}
}