* perf: use only one WASM alloc for xxhash
* perf(deps): lazy load mercury-parser and use googleapis/youtube instead of heavy googleapis
* perf(dx): lazy load dev registry
speed up npm dev script
* perf: close playwright browser on destroy
* fix: show exception msg in prod
* revert: "perf: use only one WASM alloc for xxhash"
This reverts commit 01ecdd48d09a046dce05f440814dcbec0323a7de.
* perf: use only one WASM alloc for xxhash
* test: add claim for worker
* fix: missing piece from 8dd9c9a
* feat: add namespace to the chunkfilename
* fix: keep var naming
* refactor: use patchwright
* refactor: migrate setRequestInterception and waitUntil
* fix: overwrite ua
* refactor: drop puppeteer cookie/requestfinished shims
Migrate page.cookies/setCookie and browser.cookies/setCookie call sites to the native context APIs (page.context().cookies/addCookies), rewrite requestfinished handlers to await request.response() instead of consuming the synchronous puppeteer-shaped payload, and remove the now-redundant browser.close context-cleanup wrapper. Playwright already handles all of these natively; the shims existed only for the puppeteer -> playwright migration.
* refactor: remove page.authenticate, page.setUserAgent, browser.newPage(), browser.userAgent() shims
update cookie utility tests
* refactor: replace browser instance with context in Playwright usage across multiple routes
- Updated all instances of `browser` to `context` in Playwright-related functions for consistency and improved resource management.
- Ensured proper closure of context after operations to prevent memory leaks.
- Adjusted request interception methods to utilize the new context variable.
* fix: direct type import
* refactor: remove Puppeteer compatibility layers and unify page handling with Playwright
* fix: test case
* chore: bump patchright to v1.60.0
* chore: pin patchright to 1.59.1
nft can't resolve browser.json due to https://github.com/microsoft/playwright/pull/40093
* chore: pin to node 24.15 for playwright
browser install on node 24.16 stucks due to https://github.com/microsoft/playwright/issues/40724
* fix: update patchright and patchright-core to version 1.60.2 and adjust minify-docker.js for compatibility
* fix: import BrowserContext from patchright
* fix(cache): call JSON.stringify when storing value in cache.tryGet
The value is returned as-is, so we may assume that it's not JSON
stringified inside `getValueFunc`. Otherwise, the caller already needs
to distinguish between values that are either JSON parsed or not.
* Revert "fix(routes/mastodon): don't refresh account ID cache (#20663)"
This reverts commit c2cff410fa.
* test: add test
* test: lint
* use puppeteer
* fix typo
* fix fetch page one by one
* use deprecated method
* bypass Disallow await inside of loops
* use one browser for the whole route
* bypass Disallow await inside of loops
* use one browser even if marked deprecated by doc
* use Promise.all()
* fix new destory -> destroy
- Remove Worker-specific route filtering (worker_namespaces) to include all 1537 namespaces in Worker builds
- Remove popularity analytics logic (foloAnalysisTop100) as Worker can now handle all routes
- Update node:child_process alias in tsdown config to use dedicated shim file
- Inline child_process shim in node-module.ts to avoid import cycles
- Fix tough-cookie import in telecompaper route (use named import CookieJar)
- Remove ESModule rules from wrangler.toml (not needed)
This enables full RSSHub functionality on Cloudflare Workers with no memory/size limitations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
- Add Cloudflare Workers KV cache implementation with TTL support
- Create xxhash-wasm shim using Web Crypto API to replace incompatible WebAssembly
- Unify cache middleware to use single cache.ts via tsdown-worker.config.ts alias
- Update dependencies: wrangler, @cloudflare/puppeteer, @cloudflare/workers-types
- Configure automatic KV namespace provisioning without manual ID configuration
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
* feat: deploy RSSHub to Cloudflare Workers
- Create Worker entry point (lib/worker.ts) with polyfills
- Implement Worker-specific app configuration (lib/app.worker.tsx)
- Add automatic .worker.ts resolution plugin for cleaner config
- Simplify build configuration with only 3 essential shims
- Enable static asset serving via Cloudflare Static Assets feature
- Support dynamic route loading with proper module aliasing
🤖 Generated with Claude Code
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* feat(worker): add puppeteer and request-rewriter support
- Add @cloudflare/puppeteer for Browser Rendering API support
- Create puppeteer.worker.ts with Cloudflare Browser binding
- Add request-rewriter Worker version with static browser headers
- Add vm module shim to node-module.ts for JSDOM compatibility
- Configure __dirname/__filename in tsdown for CommonJS compat
- Update wrangler.toml with BROWSER binding configuration
- Dynamically extract namespaces from foloAnalysisTop100 for routes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(cache): restore synchronous initialization for tests
The async initialization caused cache tests to fail because the cache
module wasn't ready when tests ran. Restored synchronous imports while
keeping Worker-specific no-op behavior.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test(worker): add automated Worker integration tests
- Add miniflare for Worker environment simulation
- Create lib/worker.worker.test.ts with integration tests
- Test basic routes (/test/1, /, unknown routes)
- Test RSS feed routes (hackernews, v2ex)
- Test error handling for puppeteer routes without BROWSER binding
- Add worker-test npm script
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor(worker): use test routes for Worker integration tests
- Replace third-party routes (hackernews, v2ex, weibo) with /test/* routes
- Remove miniflare dependency (wrangler includes it internally)
- Simplify test setup using wrangler's unstable_dev API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(test): make header-generator test less flaky
The header-generator library may return different platform values due to
internal randomness. Update test to check for valid format instead of
exact value.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(test): exclude worker tests from vitest coverage run
Worker tests require the dist-worker bundle to be built first,
which is not part of the regular CI test workflow. These tests
should be run separately using 'pnpm worker-test'.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test(worker): add automated Worker integration tests
- Add worker-build step to CI workflow before running tests
- Revert exclusion of worker tests from vitest coverage run
- Worker tests now run as part of the regular test suite
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(worker): fix routes.js alias path in worker build config
Change alias key from absolute path to relative import path to match
how it's imported in lib/registry.ts. This fixes the worker build
failing with "Could not resolve '../assets/build/routes.js'" error.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* ci: trigger CI re-run
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(ci): build worker routes before worker-build
The worker build requires routes-worker.js which is generated by
running build:routes with WORKER_BUILD=true. This was missing in CI,
causing the worker build to fail with "Could not resolve routes.js".
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(test): increase timeout for Worker integration tests
Worker tests need more time in CI environments. Increase individual
test timeouts from default 10s to 30s for each test case.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
* feat(tests): add comprehensive unit tests for various utility functions and views
- Implement tests for cache utility to ensure proper behavior with no cache and TTL keys.
- Add tests for common utilities including string manipulation and path handling.
- Introduce tests for directory import functionality to validate file imports and pattern matching.
- Create tests for git hash retrieval to handle fallback scenarios.
- Develop tests for deprecated got utility to verify response handling and retry logic.
- Enhance got utility tests to include request hooks and search parameter handling.
- Mock header generator tests to validate user agent handling.
- Expand helpers tests to cover current path retrieval and duration parsing.
- Implement tests for ofetch utility to ensure proper proxy handling and logging.
- Add OpenTelemetry metric tests to validate metric serialization.
- Create proxy tests to verify multi-proxy selection and failure handling.
- Introduce request rewriter tests to validate fetch and get wrapper functionality.
- Add timezone utility tests to handle various input types.
- Implement view tests for Atom and RSS rendering to ensure correct output.
- Create index view tests to validate debug information display based on configuration.
* refactor: remove deprecated got implementation and associated tests
* test: expand coverage for api, middleware, and utils
* feat(nix): add flake module and offline-friendly build
* chore(nix): upgrade to Node.js 24 and pnpm 10
Update devenv.nix to match project dependencies:
- Upgrade Node.js from 22 to 24 (aligns with Dockerfile node:24-bookworm)
- Upgrade pnpm from 9 to 10 (aligns with package.json pnpm@10.22.0)
* test: fix buffer-get test timeout
Replace external URL with mock server endpoint to prevent test timeout.
The test was trying to fetch from http://example.com which is not mocked,
causing it to timeout. Now uses http://rsshub.test/headers which is
properly mocked in the test setup.
* Initial plan
* Replace @tonyrl/rand-user-agent with header-generator and add sec-ch-* headers
Co-authored-by: TonyRL <11386903+TonyRL@users.noreply.github.com>
* Extract unwanted UA validation into standalone isValidUserAgent function
Co-authored-by: TonyRL <11386903+TonyRL@users.noreply.github.com>
* Add headerGeneratorPreset option to got and ofetch utilities
* Replace randUserAgent usage in lib/routes with headerGeneratorPreset option
Co-authored-by: TonyRL <11386903+TonyRL@users.noreply.github.com>
* chore: pin header-generator to exact match
* fix: replace randUserAgent with a static user agent string in config
* Remove deprecated _randUserAgent function and related tests
Co-authored-by: TonyRL <11386903+TonyRL@users.noreply.github.com>
* refactor: rename to header-generator
* Changes before error encountered
Co-authored-by: TonyRL <11386903+TonyRL@users.noreply.github.com>
* fix: update generateHeaders parameter type to Partial<HeaderGeneratorOptions>
* fix: add ios preset
* fix: rename headerGeneratorPreset to headerGeneratorOptions
* feat: add MODERN_IOS preset and update header-generator patch hash
* fix: use ios preset
* fix: update FetchOptions to include headerGeneratorOptions type
* refactor: simplify header generation and update header inclusion list
* fix: remove header-generator patch
* refactor: update user-agent handling in requests and tests
* test: remove redundant headerGeneratorOptions test and add new ofetch header preset test
* test: add custom user-agent test for ofetch
* test: update user-agent expectation in ofetch headers test
* Update lib/utils/ofetch.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* refactor: replace hardcoded headers with generatedHeaders in fetch and get request handlers
* refactor: rename test suite from rand-user-agent to header-generator and remove unused dependency
* Update lib/utils/header-generator.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TonyRL <11386903+TonyRL@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>