Commit Graph

18 Commits

Author SHA1 Message Date
github-actions[bot] ebfe021b50 style: auto format 2026-04-14 15:15:05 +00:00
dependabot[bot] df6b73d866
chore(deps-dev): bump msw from 2.4.3 to 2.12.14 (#21483)
* chore(deps-dev): bump msw from 2.4.3 to 2.12.14

Bumps [msw](https://github.com/mswjs/msw) from 2.4.3 to 2.12.14.
- [Release notes](https://github.com/mswjs/msw/releases)
- [Changelog](https://github.com/mswjs/msw/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mswjs/msw/compare/v2.4.3...v2.12.14)

---
updated-dependencies:
- dependency-name: msw
  dependency-version: 2.12.14
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: remove supertest

MSW's setupServer() works by patching Node's http module (via @mswjs/interceptors) to intercept outgoing requests. supertest's requests to http://127.0.0.1:1200 go through the same patched http module which causes server bad request

* chore(patch): add patch for @mswjs/interceptors@0.41.3

* fix(server): update server listen options to bypass unhandled requests

* chore: update patch for @mswjs/interceptors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tony <TonyRL@users.noreply.github.com>
2026-03-25 02:31:42 +08:00
Tony 1acb805799
style: migrate eslint to oxlint (#21224)
* chore: add oxlint support

* style: apply autofix

* style: apply autofix for toSorted

* style: use alternative api for nsfw-flag jsPlugins

* fix: git diff

* fix: codeql

* test: console.log

* style: update lint workflow to use Checkstyle SARIF converter

* style: remove debug log from extractDateFromURL function

* chore: use oxlint-json-to-sarif

* test: console.log

* test: remove console.log

* test: update cookie data expectation in getCookies test

https://github.com/mccutchen/go-httpbin/pull/235 breaks this

* style: type-aware linting

* style: enable type-aware linting for oxlint
2026-02-28 21:23:11 +08:00
DIYgod 81ff849337
feat(tests): add comprehensive unit tests for various utility functions and views (#20779)
* 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
2025-12-29 17:34:48 +08:00
github-actions[bot] a28890a135 style: auto format 2025-11-27 02:55:46 +00:00
Tony f68f81c49d
fix(utils/common-config): import parseDate and timezone functions for date handling (#19023) 2025-05-06 02:07:35 +08:00
COxDE 2962c6f64f
feat(middleware): process feed title and description using LLM (#16464)
* feat(middleware): add title translation using LLM

* refactor: combine title and description

* fix: camelCase for variables

* refactor: try to update the test case

---------
2024-08-22 02:15:00 +08:00
Tony 41c6861d88
fix(got): posting form as x-www-form-urlencoded (#15348) 2024-04-24 00:10:53 +08:00
Rongrong f3cf86cd72
fix(core/utils/wechat-mp): empty description when request blocked by WAF (#15294)
* fix(core/utils/wechat-mp): empty description when request blocked by WAF

Silently falling back to the fallback method would generate empty
description. Fixed by throwing an error when failed to extract
item_show_type from the page.

Some misc warnings are also added to make bug reporting easier.

Signed-off-by: Rongrong <i@rong.moe>

* fix(core/utils/wechat-mp): err msg for unknown page

Signed-off-by: Rongrong <i@rong.moe>

* test(core/utils/wechat-mp): fix coverage

Signed-off-by: Rongrong <i@rong.moe>

* fix(core/utils/wechat-mp): ESLint no-await-in-loop

Signed-off-by: Rongrong <i@rong.moe>

* fix(core/utils/wechat-mp): normalizeUrl: &amp; -> &

Signed-off-by: Rongrong <i@rong.moe>

* feat(core/utils/wechat-mp): do not prompt raising an issue when blocked
by WAF

Signed-off-by: Rongrong <i@rong.moe>

* feat(core/utils/wechat-mp): recognize deleted page

Signed-off-by: Rongrong <i@rong.moe>

* feat(core/utils/wechat-mp): log when error

Prevent errors from being completely suppressed if the caller catches
them.

Signed-off-by: Rongrong <i@rong.moe>

---------

Signed-off-by: Rongrong <i@rong.moe>
2024-04-22 02:19:33 +08:00
Rongrong a99b35f257
feat(core/utils/wechat-mp): major rewrite (#15276)
* feat(core/utils/wechat-mp): major rewrite

* Support more `item_show_type`: `APP_MSG_PAGE`, `VIDEO_SHARE_PAGE`,
`AUDIO_SHARE_PAGE`, and `IMG_SHARE_PAGE`. Previously only the first one
could be parsed properly. There are still some other known types waiting
for live examples for further adaptation. If this is the case, a
fallback method will try to generate entries using mostly OpenGraph
metadata. Meanwhile, the administrator of self-hosted instances will see
warnings in the log, asking them to report the URL as a new live
example. Still, `VIDEO_SHARE_PAGE` explicitly uses the fallback method
without any warning, as there is no possible approach to generate a
video/iframe URL from page metadata.

* Show audio and videos in `APP_MSG_PAGE`. However, not all videos
can be shown due to the same reason as `VIDEO_SHARE_PAGE`.

* Show the location where the article is sent.

* Some bugs, mostly due to outdated cheerio selector, are fixed.

* Add a new sub-route `wechat-mp` to `/test` to make things easier.

* All changes are well-tested.

Signed-off-by: Rongrong <i@rong.moe>

* style(core/utils/wechat-mp): fix ESLint & CodeQL errors

Signed-off-by: Rongrong <i@rong.moe>

* style(core/utils/wechat-mp): fix a DeepScan issue

Signed-off-by: Rongrong <i@rong.moe>

* style(core/utils/wechat-mp): fix ESLint error

Another try w/ pre-commit hook disabled.

Signed-off-by: Rongrong <i@rong.moe>

---------

Signed-off-by: Rongrong <i@rong.moe>
2024-04-18 22:05:32 +08:00
DIYgod bf4e5dd78f
test: fix caces 2024-03-31 23:13:22 +08:00
DIYgod bec0ba0705
test: request headers 2024-03-30 18:29:38 +08:00
DIYgod 2a366ef56d
test: rss-parser test 2024-03-27 16:18:37 +08:00
DIYgod a87ec36450
test: got test 2024-03-27 16:15:39 +08:00
DIYgod bcd5f6ff8b
test: rand-user-agent test 2024-03-27 15:37:51 +08:00
DIYgod 3016a2f44f
test: fix wechat-mp test 2024-03-27 14:53:43 +08:00
DIYgod 760f48b8cf
test: fix common-config test 2024-03-27 14:49:43 +08:00
DIYgod eec2a71953
test: setup msw 2024-03-27 14:26:20 +08:00