28 Commits
Author SHA1 Message Date
fb13e1ab48 feat(route/shenzhen/zjj): 深圳市级和区级住建局 (#23928)
* feat(utils): add structured markdown table renderer

Add renderMarkdownTable and renderOptionsMarkdownTable helpers that build GFM tables from validated data, with column alignment, cell escaping and a shorthand for parameter option tables. Include tests covering existing route descriptions and migration cases.

* feat(route/gov/shenzhen/zjj): expand sections and add table layout

Replace the single notification category with 19 public-information sections. Add a table layout for the policy section, generate the parameter table from the shared section config, switch to HTTPS, and tighten the handler typings.

* feat(route/gov/shenzhen/gkmlpt): add shared API helpers

Add zod-validated article types and shared helpers for the Guangdong disclosure platform: fetch article lists with a P-256 dispatcher to avoid bad ecpoint errors, map articles to feed items, build category links, and derive lookup maps and parameter options from category definitions.

* feat(route/gov/shenzhen/szft): add Futian housing bureau route

Add the Futian District Housing and Construction Bureau feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* feat(route/gov/shenzhen/szlh): add Luohu housing bureau route

Add the Luohu District Housing and Construction Bureau feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* feat(route/gov/shenzhen/szns): add Nanshan housing bureau route

Add the Nanshan District Housing and Construction Bureau feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* feat(route/gov/shenzhen/yantian): add Yantian housing bureau route

Add the Yantian District Housing and Construction Bureau feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* feat(route/gov/shenzhen/baoan): add Bao'an housing bureau route

Add the Bao'an District Housing and Construction Bureau feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* feat(route/gov/shenzhen/lg): add Longgang housing bureau route

Add the Longgang District Housing and Construction Bureau feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* feat(route/gov/shenzhen/szlhq): add Longhua housing bureau route

Add the Longhua District Housing and Construction Bureau feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* feat(route/gov/shenzhen/szpsq): add Pingshan housing center route

Add the Pingshan District Housing Security Center feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* feat(route/gov/shenzhen/szgm): add Guangming housing bureau route

Add the Guangming District Housing and Construction Bureau feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* feat(route/gov/shenzhen/dpxq): add Dapeng housing bureau route

Add the Dapeng New District Housing and Construction Bureau feed on top of the shared gkmlpt helpers. Derive category options from the platform directory tree, document them in the description, and expose a radar rule for the disclosure index.

* refactor(route/gov/shenzhen): scope markdown table helper to Shenzhen

Move render-markdown-table from the global lib/utils into the Shenzhen gov routes so the helper sits alongside its only consumers, and drop its test file. Update every Shenzhen route to import from the new location.

* feat(utils): support ecdhCurve in ofetch requests

Add an ecdhCurve option to ofetch so callers can pin the ECDHE curve in the TLS handshake, working around hosts whose exchange ends in a point OpenSSL rejects (bad ecpoint). Thread it through proxy dispatchers and direct agents, and include it in their cache keys so differently configured connections are not reused. Unlike an explicit dispatcher, proxied requests still honour the configured proxy.

* refactor(route/gov/shenzhen/gkmlpt): use ecdhCurve fetch option

Pass ecdhCurve: 'P-256' through ofetch instead of an explicit undici dispatcher, so the district requests work around bad ecpoint errors without bypassing the configured proxy.

* refactor(route/gov/shenzhen/gkmlpt): import parseDate from utils/time

Follow the consolidated time utilities by importing parseDate from @/utils/time instead of the standalone @/utils/parse-date module.

* fix(route/gov/shenzhen): use plain markdown tables in descriptions and test ecdhCurve

Drop the route-local markdown table renderer and write the caty tables by
hand like the neighbouring routes. Cover the ecdhCurve option on both the
direct agent and the proxy dispatcher in the request rewriter tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: DIYgod <i@diygod.me>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 10:36:16 +08:00
Tony 0410bd5f19 refactor(utils/time): use Temporal API (#23931)
* refactor(utils): use Temporal API

* refactor(route): migrate to @/utils/time

* fix(route/rfi): use Temporal for duration

* style: add oxlint rule for temporal

* fix: merge duplicated parse duration

* fix: remove duplicated convertDateToISO8601

* fix: remove outdated check

* fix: remove fake date
2026-11-19 05:47:25 +08:00
Tony 1f481e461d fix(proxy): fix pac parsing (#23678)
* fix(proxy): fix pac parsing

* feat(proxy)!: drop multi proxy

* feat: pac in playwright

* fix(proxy): cache dispatcher

* fix(proxy): prevent resolver failing if config change

* fix: use agent from undici
2026-10-26 04:53:11 +08:00
pseudoyu e0b3b98401 fix(core): stop SOCKS proxies other than socks5 from crashing startup
Since #22401 every socks* PROXY_URI is handed to undici's ProxyAgent,
which only accepts socks5: and socks:. A socks5h, socks4 or socks4a
URI fell through to its HTTP proxy path and threw "Invalid URL
protocol" while the proxy module loaded, so the server never started,
even though unify-proxy listed all of them as supported.

Pass socks5h to undici as socks5: its SOCKS5 client sends host names
to the proxy, so DNS still resolves there, as playwright.ts already
assumes. undici has no SOCKS4 support, so drop socks4 and socks4a from
the accepted protocols, which logs the supported list and disables the
proxy like any other unsupported protocol.
2026-10-15 08:29:37 +08:00
Tony 3bc1cc248d chore: bump to msw v3 (#23463)
* chore: bump to msw v3

* refactor: anti-slop

* test: use vi.stubEnv for REDIS_URL in redis error test

* refactor: move remote debugging registration into a conditional block

* chore: add code coverage upload for github
2026-10-03 06:36:19 +08:00
Tony c33b727844 feat(core): allow adjusting min tls version (#23410) 2026-09-28 01:07:53 +08:00
Tony 4b25ea7751 feat(core): prefer HTTP/2 (#23402)
* feat(core): prefer HTTP/2

* feat(fetch): add allowH2 option to control HTTP/2 usage in ofetch
2026-09-27 01:13:41 +08:00
dependabot[bot]andTony a84b41faa3 chore(deps-dev): bump eslint-plugin-unicorn from 74.0.0 to 75.0.0 (#23338)
* chore(deps-dev): bump eslint-plugin-unicorn from 74.0.0 to 75.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 74.0.0 to 75.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v74.0.0...v75.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 75.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

* style: fix unicorn-js/prefer-combined-guards

* style: fix prefer-smaller-scope

* style: fix prefer-continue

* style: fix prefer-early-return

* style: fix prefer-iterator-helpers

* style: add v75 recommended preset

---------

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-09-22 07:08:43 +08:00
Tony 08a38f0a5e refactor: typing house-keeping (#23074)
* refactor: typing house-keeping

* fix: fix parse date not accepting strict mode

* refactor: use npm package

* fix: address review
2026-08-22 23:58:30 +08:00
Tony bb12119123 refactor: enforce typecheck (#22917)
* feat(types): add upvotes, downvotes, and comments to DataItem

* refactor: fix TS2339

* refactor: fix TS2322

* refactor: fix TS2322

* refactor: fix TS2345

* refactor: fix TS2339

* refactor: fix TS2322

* refactor: fix TS2345

* refactor: fix TS2531/2532/18048/18047

* refactor: fix TS18046/TS2571

* refactor: fix TS2538

* refactor: fix TS2554/2769/2558

* refactor: fix TS2362/2363

* refactor: fix TS2353/TS2561

* refactor: fix TS2741/2739/2740

* refactor: fix TS2304 TS2307 TS2305 TS2614 TS2552 TS2551

* refactor: fix TS2352

* refactor: fix TS2604 TS17001

* refactor: fix TS2367 TS2366

* refactor: fix TS2493

* refactor: fix TS2454

* refactor: fix TS2790

* refactor: fix TS2488

* refactor: fix TS2677

* refactor: fix TS18048/18049/2532

* refactor: fix TS2322

* refactor: fix TS2344

* refactor: fix TS2339

* refactor: fix TS2339

* refactor: fix TS2365

* refactor: fix TS1117

* refactor: fix  TS2561

* refactor: fix TS2555

* refactor: fix TS2503

* refactor: fix TS2339

mobile api no longer work

* fix: clean slop

* fix: use Context instead of any

* fix: fix more typing after merge

* fix: add void return for ctx.redirect in handler

* chore: add type check to lint and husky

* fix: remove ts ignore

* chore: add oxlint rule

* fix: suppress build artifact

* fix: update getArticles to use cache

* fix: codeql

* fix(route/typeless): use async gunzip

* fix: address review

* fix: address review

* fix: double quotes escape
2026-08-04 09:00:41 +08:00
Tony 0ab18ff80e test: refactor tests (#22677)
* test: refactor tests

* test: run *.worker.ts unit tests inside workerd
2026-07-10 23:26:43 +08:00
Vanilla a1c7cea6b7 feat(lib/utils/proxy/index.ts): Allow socks proxy for dispatcher. (#22401) 2026-07-10 19:22:02 +08:00
dependabot[bot]andTony 417ab04f06 chore(deps-dev): bump eslint-plugin-unicorn from 66.0.0 to 68.0.0 (#22310)
* chore(deps-dev): bump eslint-plugin-unicorn from 66.0.0 to 68.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 66.0.0 to 68.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v66.0.0...v68.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 68.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

* style: fix no-useless-coercion

* style: fix prefer-boolean-return

* style: fix no-useless-logical-operand

* style: fix prefer-single-replace

* style: fix consistent-conditional-object-spread

* style: fix no-useless-else

* style: fix prefer-unicode-code-point-escapes

* style: fix operator-assignment

* style: fix prefer-continue

* style: fix prefer-math-constants

* style: fix prefer-hoisting-branch-code

* style: fix prefer-array-slice

* style: fix consistent-class-member-order

* style: fix no-return-array-push

* style: fix prefer-promise-with-resolvers

* style: fix no-array-concat-in-loop

* style: fix no-loop-iterable-mutation

* style: fix no-invalid-argument-count

* style: fix no-duplicate-if-branches

* style: fix prefer-else-if

* style: fix no-unreadable-for-of-expression

* style: fix logical-assignment-operators

* style: fix default-export-style

* style: revert false positve in prefer-type-literal-last in #22274

* style: fix arrow-body-style

* style: add v68 recommended preset

* style: refactor GraphQL queries to use template literals for better readability

---------

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-06-20 23:11:27 +08:00
dependabot[bot]andTony 873618e99d chore(deps-dev): bump eslint-plugin-unicorn from 65.0.1 to 66.0.0 (#22274)
* chore(deps-dev): bump eslint-plugin-unicorn from 65.0.1 to 66.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 65.0.1 to 66.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v65.0.1...v66.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 66.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

* style: fix unicorn-js/prefer-url-href

* style: oxlint disable

* style: fix unicorn-js/no-useless-else

* style: no-unsafe-string-replacement

* style: fix no-duplicate-loops

* style: fix prefer-number-is-safe-integer

* style: fix prefer-single-array-predicate

* style: fix no-object-methods-with-collections

* style: fix no-useless-boolean-cast

* style: fix no-useless-template-literals

* style: fix no-negated-array-predicate

* style: fix prefer-direct-iteration

* style: fix consistent-optional-chaining

* style: fix prefer-simple-sort-comparator

* style: fix prefer-global-number-constants

* style: fix prefer-type-literal-last

* style: fix require-array-sort-compare.

* style: fix prefer-early-return

* style: fix prefer-short-arrow-method

* style: fix prefer-array-from-map

* style: fix prefer-scoped-selector

* style: fix no-global-object-property-assignment

* style: fix no-unnecessary-global-this

* style: fix no-unreadable-object-destructuring

* style: fix no-invalid-argument-count

* style: fix prefer-smaller-scope

* style: fix prefer-iterator-to-array.

* style: fix prefer-object-iterable-methods

* style: fix typo

* style: fix max-nested-calls

* style: fix no-incorrect-template-string-interpolation

* style: fix no-break-in-nested-loop

* style: fix prefer-await

* style: fix no-computed-property-existence-check

* style: fix prefer-number-coercion

* style: fix no-empty-file

* style: update eslint unicorn v66 recommended preset

* style: add unicorn/prefer-spread to oxlint-disable comments

* style: fix no-array-reduce

* style: delete github/no-then as it's covered by unicorn/prefer-await

---------

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-06-16 14:43:42 +08:00
DIYgod 566f028aaf refactor: migrate browser automation to Playwright (#21901)
* refactor: migrate browser automation to Playwright

* ci: update browser checks for Playwright
2026-05-04 21:16:18 +08:00
github-actions[bot] ebfe021b50 style: auto format 2026-04-14 15:15:05 +00: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] edfac9f24c style: auto format 2025-11-27 05:54:33 +00:00
github-actions[bot] 838eb3c7ff style: auto format 2025-11-27 05:49:33 +00:00
github-actions[bot] a28890a135 style: auto format 2025-11-27 02:55:46 +00:00
pseudoyu 3d9ac5c6ee feat(lib/proxy): support multiple proxier by PROXY_URIS env 2025-06-24 11:05:14 +08:00
DIYgod d83c951d8c fix: proxy auth 2024-03-31 02:28:26 +08:00
DIYgod a828b3dd1c feat: request rewriter 2024-03-30 18:21:14 +08:00
DIYgod 759c03cd23 feat: intercept undici and use fetch dispatcher 2024-03-28 02:45:08 +08:00
DIYgod f837345f36 fix: remove require 2024-03-24 21:20:18 +08:00
DIYgod 38e42156a0 feat: replace jest with vitest 2024-03-03 18:57:07 +08:00
DIYgod b8a2301590 test: pac-proxy and unify-proxy 2024-02-25 17:16:10 +08:00
DIYgod 2e7bd66940 test: puppeteer 2024-01-31 02:14:48 +08:00