Skip to content

fix(weread): resolve shelf auth fallback#518

Merged
jackwener merged 3 commits intojackwener:mainfrom
Astro-Han:worktree-fix-cookie-host-perms
Mar 27, 2026
Merged

fix(weread): resolve shelf auth fallback#518
jackwener merged 3 commits intojackwener:mainfrom
Astro-Han:worktree-fix-cookie-host-perms

Conversation

@Astro-Han
Copy link
Copy Markdown
Contributor

Description

Fixes weread shelf for issue #497.

This PR fixes two layers of the failure:

  • add extension host_permissions so chrome.cookies.getAll() can read WeRead cookies again
  • make weread shelf fall back to the current session's /web/shelf structured cache when the private Node-side API returns AUTH_REQUIRED

The fallback is scoped to the current wr_vid session and keeps the original auth error when no valid current-session cache exists.

Related issue: #497

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (if new adapter)
  • Updated docs/adapters/index.md table (if new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (if new adapter)
  • Updated README.md / README.zh-CN.md when command discoverability changed
  • Used positional args for the command's primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

Verification run locally:

pnpm build
pnpm exec vitest run tests/e2e/public-commands.test.ts --testNamePattern 'weread'
/Users/yuhan/workspace/oss/opencli/node_modules/.bin/vitest run src/
/Users/yuhan/workspace/oss/opencli/node_modules/.bin/tsc --noEmit
node dist/main.js weread shelf --limit 5 -f json

Example weread shelf output after the fix:

[
  {
    "title": "文明、现代化、价值投资与中国",
    "author": "李录",
    "progress": "-",
    "bookId": "29196155"
  },
  {
    "title": "金钱博弈",
    "author": "单伟建",
    "progress": "-",
    "bookId": "44026161"
  }
]

@jackwener jackwener merged commit 0085d63 into jackwener:main Mar 27, 2026
20 of 22 checks passed
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.

2 participants