From af81ecac58c0f858ddb5a2fbfc650e5dea1a13a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 08:19:33 +0000 Subject: [PATCH 1/7] chore(deps): bump @scalar/hono-api-reference from 0.10.9 to 0.10.10 (#21817) Bumps [@scalar/hono-api-reference](https://github.com/scalar/scalar/tree/HEAD/integrations/hono) from 0.10.9 to 0.10.10. - [Release notes](https://github.com/scalar/scalar/releases) - [Changelog](https://github.com/scalar/scalar/blob/main/integrations/hono/CHANGELOG.md) - [Commits](https://github.com/scalar/scalar/commits/HEAD/integrations/hono) --- updated-dependencies: - dependency-name: "@scalar/hono-api-reference" dependency-version: 0.10.10 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 481fc6382fb0..1f5ddc9f86c9 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "@opentelemetry/sdk-trace-base": "2.7.0", "@opentelemetry/semantic-conventions": "1.40.0", "@rss3/sdk": "0.0.25", - "@scalar/hono-api-reference": "0.10.9", + "@scalar/hono-api-reference": "0.10.10", "@sentry/node": "10.49.0", "aes-js": "3.1.2", "cheerio": "1.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2ba92eaca36c..8db4f350b85c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -80,8 +80,8 @@ importers: specifier: 0.0.25 version: 0.0.25 '@scalar/hono-api-reference': - specifier: 0.10.9 - version: 0.10.9(hono@4.12.14) + specifier: 0.10.10 + version: 0.10.10(hono@4.12.14) '@sentry/node': specifier: 10.49.0 version: 10.49.0(@opentelemetry/exporter-trace-otlp-http@0.215.0(@opentelemetry/api@1.9.1)) @@ -2580,22 +2580,22 @@ packages: '@rss3/sdk@0.0.25': resolution: {integrity: sha512-jyXT4YTwefxxRZ0tt5xjbnw8e7zPg2OGdo/0xb+h/7qWnMNhLtWpc95DsYs/1C/I0rIyiDpZBhLI2DieQ9y+tw==} - '@scalar/client-side-rendering@0.1.2': - resolution: {integrity: sha512-gX2QIc+lpErO9RWkJmt02sBZoCOjyZ7EiLLEyGj7x9UKkk7E4zj6Wbk1eUPo6i3oIwhtZ+Vybj/xzexCK2bxwA==} + '@scalar/client-side-rendering@0.1.3': + resolution: {integrity: sha512-rUI5EQA8y0xivzqc/AwExZYW8HRfQSFxPxvvuLjHTCATpKz0xcQBGVJQIPOmp78NJyO8mnQmltE1AxIdtvdPGg==} engines: {node: '>=22'} - '@scalar/helpers@0.5.1': - resolution: {integrity: sha512-9VvPfv8b+YZVIFwR3SWeq4Y8ij/kU3/kf2M6NKcbf2iVyh63d8s0ssap5m/nOhiz/Puidv/29MAJlJCA0LRssA==} + '@scalar/helpers@0.5.2': + resolution: {integrity: sha512-Pi1GAl8jO6ungmGj2sjDfCfqiBNrKW6HXDZmminV94ybGU/KtRLOqHwd0n9FIhY3j0RYGpGC0VCuniCICfQPHg==} engines: {node: '>=22'} - '@scalar/hono-api-reference@0.10.9': - resolution: {integrity: sha512-XLsdXGp8ta7fjYgcwD8xyopsF5KfO5h1qJMoNTjb4Tm1giu+TEkH+m+aBS3cv5FN9LA91Uym8SLWJm8yhgkdOA==} + '@scalar/hono-api-reference@0.10.10': + resolution: {integrity: sha512-fAd+9UeCdF73O7kFFABNkBmpnrDRjX1wW94kgt+OHjqB5Uca4l0HvJTkh1O4k7afjsZx8VavA0x0FQ4Qgu9ZnQ==} engines: {node: '>=22'} peerDependencies: hono: ^4.12.5 - '@scalar/types@0.9.1': - resolution: {integrity: sha512-3EbkhtQc+XuDE8Ur1MPosM3YTACFIFNba4M3vGulqv8jcvhMXT+KWPvGUJxq0CDvySqjGa8cE6w85v8T+MjDng==} + '@scalar/types@0.9.2': + resolution: {integrity: sha512-aLn7QTHafpjrN/whup7U5/CHaoPPaYMNtz4L/2yfN5GDSy3AbDM7kV1q8s3nMQIhvC1uscxfriV+KhEND+xHvA==} engines: {node: '>=22'} '@scure/base@2.0.0': @@ -8224,20 +8224,20 @@ snapshots: '@rss3/api-core': 0.0.25 '@rss3/api-utils': 0.0.25 - '@scalar/client-side-rendering@0.1.2': + '@scalar/client-side-rendering@0.1.3': dependencies: - '@scalar/types': 0.9.1 + '@scalar/types': 0.9.2 - '@scalar/helpers@0.5.1': {} + '@scalar/helpers@0.5.2': {} - '@scalar/hono-api-reference@0.10.9(hono@4.12.14)': + '@scalar/hono-api-reference@0.10.10(hono@4.12.14)': dependencies: - '@scalar/client-side-rendering': 0.1.2 + '@scalar/client-side-rendering': 0.1.3 hono: 4.12.14 - '@scalar/types@0.9.1': + '@scalar/types@0.9.2': dependencies: - '@scalar/helpers': 0.5.1 + '@scalar/helpers': 0.5.2 nanoid: 5.1.9 type-fest: 5.6.0 zod: 4.3.6 From 6528dc0a2fb0bd62817367717879417a107e3a24 Mon Sep 17 00:00:00 2001 From: kjasn Date: Fri, 24 Apr 2026 18:59:58 +0800 Subject: [PATCH 2/7] feat: add token option for zaimanhua route (#21815) * feat: zaimanhua use cookie * feat: zaimanhua recent update and comic update add token option * Update lib/routes/zaimanhua/update.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- lib/config.ts | 8 +++++++- lib/routes/zaimanhua/comic.ts | 37 +++++++++++++++++++++------------- lib/routes/zaimanhua/update.ts | 31 ++++++++++++++++++---------- 3 files changed, 50 insertions(+), 26 deletions(-) diff --git a/lib/config.ts b/lib/config.ts index fea6a950ee1f..095457d681a2 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -241,6 +241,7 @@ type ConfigEnvKeys = | 'YOUTUBE_CLIENT_SECRET' | 'YOUTUBE_REFRESH_TOKEN' | 'YOUTUBE_VIDEO_EMBED_URL' + | 'ZAIMANHUA_TOKEN' | 'ZHIHU_COOKIES' | 'ZODGAME_COOKIE' | 'ZSXQ_ACCESS_TOKEN' @@ -692,6 +693,9 @@ export type Config = { refreshToken?: string; videoEmbedUrl?: string; }; + zaimanhua: { + token?: string; + }; zhihu: { cookies?: string; }; @@ -1192,6 +1196,9 @@ const calculateValue = () => { refreshToken: envs.YOUTUBE_REFRESH_TOKEN, videoEmbedUrl: envs.YOUTUBE_VIDEO_EMBED_URL || 'https://www.youtube-nocookie.com/embed/', }, + zaimanhua: { + token: envs.ZAIMANHUA_TOKEN, + }, zhihu: { cookies: envs.ZHIHU_COOKIES, }, @@ -1211,7 +1218,6 @@ const calculateValue = () => { } }; calculateValue(); - (async () => { if (envs.REMOTE_CONFIG) { const { default: logger } = await import('@/utils/logger'); diff --git a/lib/routes/zaimanhua/comic.ts b/lib/routes/zaimanhua/comic.ts index 227f1e400f11..420e9d527bde 100644 --- a/lib/routes/zaimanhua/comic.ts +++ b/lib/routes/zaimanhua/comic.ts @@ -12,9 +12,15 @@ export const route: Route = { path: '/comic/:id', categories: ['anime'], parameters: { id: '漫画ID' }, - example: '/zaimanhua/comic/14488', + example: '/zaimanhua/comic/57069', features: { - requireConfig: false, + requireConfig: [ + { + name: 'ZAIMANHUA_TOKEN', + optional: true, + description: '用户登录后,可以从浏览器开发者工具 Network 面板中的请求信息中获取 token,使用请求中的 `Authorization` 的值,完整设置为 `Bearer `,或直接设置 token 并由路由自动补齐 `Bearer ` 前缀。', + }, + ], requirePuppeteer: false, antiCrawler: false, supportBT: false, @@ -30,6 +36,9 @@ export const route: Route = { ], name: '漫画更新', maintainers: ['kjasn'], + description: `::: Warning +未登录用户无法获取到所有漫画,需要设置\`ZAIMANHUA_TOKEN\`环境变量以使用 API 授权访问。 +:::`, handler, }; @@ -38,12 +47,17 @@ async function handler(ctx) { const id = ctx.req.param('id'); const currentComicUrl = `${baseUrl}/api/v1/comic2/comic/detail?id=${id}`; - const response = await ofetch(currentComicUrl, { - headers: { - 'user-agent': config.trueUA, - referer: baseUrl, - }, - }); + const headers: Record = { + 'user-agent': config.trueUA, + referer: baseUrl, + }; + + const token = config.zaimanhua.token; + if (token) { + headers.Authorization = token.startsWith('Bearer ') ? token : `Bearer ${token}`; + } + + const response = await ofetch(currentComicUrl, { headers }); const comicInfo = response.data.comicInfo; const status = comicInfo.chapterList[0].title; // 更新状态 @@ -58,12 +72,7 @@ async function handler(ctx) { return await cache.tryGet(chapterUrl, async () => { // 获取章节内容 - const chapterResponse = await ofetch(chapterUrl, { - headers: { - 'user-agent': config.trueUA, - referer: baseUrl, - }, - }); + const chapterResponse = await ofetch(chapterUrl, { headers }); const chapterData = chapterResponse.data; const description = renderComic(chapterData.chapterInfo.page_url || []); diff --git a/lib/routes/zaimanhua/update.ts b/lib/routes/zaimanhua/update.ts index 32267ebb4649..a856183c3326 100644 --- a/lib/routes/zaimanhua/update.ts +++ b/lib/routes/zaimanhua/update.ts @@ -13,7 +13,13 @@ export const route: Route = { categories: ['anime'], example: '/zaimanhua/update', features: { - requireConfig: false, + requireConfig: [ + { + name: 'ZAIMANHUA_TOKEN', + optional: true, + description: '可从浏览器开发者工具中抓取站点请求头 `Authorization` 的 Bearer token,并配置为环境变量。可设置为完整值 `Bearer `,或仅设置 token 由路由自动补齐 `Bearer ` 前缀。', + }, + ], requirePuppeteer: false, antiCrawler: false, supportBT: false, @@ -29,15 +35,23 @@ export const route: Route = { ], name: '最近更新', maintainers: ['kjasn'], + description: `::: Warning +建议设置\`ZAIMANHUA_TOKEN\`环境变量以使用 API 授权访问。 +:::`, handler: async () => { const baseUrl = 'https://manhua.zaimanhua.com'; const currentUrl = `${baseUrl}/api/v1/comic2/update_list?status&theme&zone&cate&firstLetter&sortType&page=1&size=20`; + const headers: Record = { + 'user-agent': config.trueUA, + referer: baseUrl, + }; + const token = config.zaimanhua.token; + if (token) { + headers.Authorization = token.startsWith('Bearer ') ? token : `Bearer ${token}`; + } const response = await ofetch(currentUrl, { - headers: { - 'user-agent': config.trueUA, - referer: baseUrl, - }, + headers, }); // 近期更新漫画数据 @@ -53,12 +67,7 @@ export const route: Route = { return await cache.tryGet(chapterUrl, async () => { // 获取章节内容 - const chapterResponse = await ofetch(chapterUrl, { - headers: { - 'user-agent': config.trueUA, - referer: baseUrl, - }, - }); + const chapterResponse = await ofetch(chapterUrl, { headers }); const chapterData = chapterResponse.data; const description = renderComic(chapterData.chapterInfo.page_url || []); From 293c9cd8792aabb2ab7dc4911ce271ac90e1b4f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 19:03:25 +0800 Subject: [PATCH 3/7] chore(deps): bump re2js from 2.2.0 to 2.2.2 (#21816) Bumps [re2js](https://github.com/le0pard/re2js) from 2.2.0 to 2.2.2. - [Release notes](https://github.com/le0pard/re2js/releases) - [Commits](https://github.com/le0pard/re2js/compare/2.2.0...2.2.2) --- updated-dependencies: - dependency-name: re2js dependency-version: 2.2.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 1f5ddc9f86c9..455aff6a3d64 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "puppeteer-real-browser": "1.4.4", "query-string": "9.3.1", "rate-limiter-flexible": "11.0.1", - "re2js": "2.2.0", + "re2js": "2.2.2", "rebrowser-puppeteer": "24.8.1", "rfc4648": "1.5.4", "rss-parser": "3.13.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8db4f350b85c..eb92353c7aa5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -218,8 +218,8 @@ importers: specifier: 11.0.1 version: 11.0.1 re2js: - specifier: 2.2.0 - version: 2.2.0 + specifier: 2.2.2 + version: 2.2.2 rebrowser-puppeteer: specifier: 24.8.1 version: 24.8.1(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -5442,8 +5442,8 @@ packages: rate-limiter-flexible@11.0.1: resolution: {integrity: sha512-hvyCUefjRund2N6hro2H8Dql7OvB6+B3Qv2FLWWbdsdyQScXf4+N0tM0Bryz11awTtNxx6C1QbHYb1rCiAx7pA==} - re2js@2.2.0: - resolution: {integrity: sha512-IoEpLLg1dljnBkHzFwwHtCKJGEozP1/Qc2i2orS+QA7NNP7ZU3dy7Dzmc8sXlL9KcukZ3EB/go5h48GcF60SVQ==} + re2js@2.2.2: + resolution: {integrity: sha512-DM7coRnfIsNcb66VYpalw9KSWuCAH/l2lBaNgKs6W+Va+6pKup070hS35ysS7hDofHC8tSd5alZ4UpiP83F37w==} readable-stream@3.6.2: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} @@ -11498,7 +11498,7 @@ snapshots: rate-limiter-flexible@11.0.1: {} - re2js@2.2.0: {} + re2js@2.2.2: {} readable-stream@3.6.2: dependencies: From 11a66114f50ae422c03680a48a1c57ef00d4e69e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 19:20:48 +0800 Subject: [PATCH 4/7] chore(deps): bump devenv from `863b420` to `c873d21` (#21820) Bumps [devenv](https://github.com/cachix/devenv) from `863b420` to `c873d21`. - [Release notes](https://github.com/cachix/devenv/releases) - [Commits](https://github.com/cachix/devenv/compare/863b4204725efaeeb73811e376f928232b720646...c873d21f80b6b43f121258f5e6fd3b34afa7b930) --- updated-dependencies: - dependency-name: devenv dependency-version: c873d21f80b6b43f121258f5e6fd3b34afa7b930 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 3bd737cfd9ee..0f4d019d1e9d 100644 --- a/flake.lock +++ b/flake.lock @@ -163,11 +163,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1776863933, - "narHash": "sha256-v9NoQFSln9n5zqVWUWUc9PajsMaGmga51HOAJqMx7Qw=", + "lastModified": 1776968239, + "narHash": "sha256-4kuGE6iwtCrd6BsGMvLBis8Bbn04c0V5T1Yt6Tmmtyc=", "owner": "cachix", "repo": "devenv", - "rev": "863b4204725efaeeb73811e376f928232b720646", + "rev": "c873d21f80b6b43f121258f5e6fd3b34afa7b930", "type": "github" }, "original": { From bd5f3a5b06c48b8b17073fa1cb5efb244178a427 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 11:22:34 +0000 Subject: [PATCH 5/7] chore(nix): update dependencies hash to sha256-ek3LN43FqwmLGh4qk54DZ8FwZZs9DmUKVUPDzwKOj6c= --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 5f850421f23a..953bb26a73f4 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ deps = pkgs.fetchPnpmDeps { pname = "rsshub"; src = ./.; - hash = "sha256-JSMYPsZo2shfh/f6yQ+dOujhSkS3Ras0DcOo378pej4="; + hash = "sha256-ek3LN43FqwmLGh4qk54DZ8FwZZs9DmUKVUPDzwKOj6c="; fetcherVersion = 2; }; in From bd31ae13ae4c5d987b9cd1888699a38762f08dcf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 19:26:22 +0800 Subject: [PATCH 6/7] chore(deps): bump hono from 4.12.14 to 4.12.15 (#21819) Bumps [hono](https://github.com/honojs/hono) from 4.12.14 to 4.12.15. - [Release notes](https://github.com/honojs/hono/releases) - [Commits](https://github.com/honojs/hono/compare/v4.12.14...v4.12.15) --- updated-dependencies: - dependency-name: hono dependency-version: 4.12.15 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 455aff6a3d64..ec408a17e709 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "google-play-scraper": "10.1.2", "googleapis": "171.4.0", "header-generator": "2.1.82", - "hono": "4.12.14", + "hono": "4.12.15", "html-to-text": "9.0.5", "http-cookie-agent": "7.0.3", "https-proxy-agent": "9.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eb92353c7aa5..91346e15adb8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,10 +45,10 @@ importers: version: 6.12.3 '@hono/node-server': specifier: 2.0.0 - version: 2.0.0(hono@4.12.14) + version: 2.0.0(hono@4.12.15) '@hono/zod-openapi': specifier: 1.3.0 - version: 1.3.0(hono@4.12.14)(zod@4.3.6) + version: 1.3.0(hono@4.12.15)(zod@4.3.6) '@jocmp/mercury-parser': specifier: 3.0.7 version: 3.0.7 @@ -81,7 +81,7 @@ importers: version: 0.0.25 '@scalar/hono-api-reference': specifier: 0.10.10 - version: 0.10.10(hono@4.12.14) + version: 0.10.10(hono@4.12.15) '@sentry/node': specifier: 10.49.0 version: 10.49.0(@opentelemetry/exporter-trace-otlp-http@0.215.0(@opentelemetry/api@1.9.1)) @@ -131,8 +131,8 @@ importers: specifier: 2.1.82 version: 2.1.82 hono: - specifier: 4.12.14 - version: 4.12.14 + specifier: 4.12.15 + version: 4.12.15 html-to-text: specifier: 9.0.5 version: 9.0.5 @@ -4310,8 +4310,8 @@ packages: hmacsha1@1.0.0: resolution: {integrity: sha512-4FP6J0oI8jqb6gLLl9tSwVdosWJ/AKSGJ+HwYf6Ixe4MUcEkst4uWzpVQrNOCin0fzTRQbXV8ePheU8WiiDYBw==} - hono@4.12.14: - resolution: {integrity: sha512-am5zfg3yu6sqn5yjKBNqhnTX7Cv+m00ox+7jbaKkrLMRJ4rAdldd1xPd/JzbBWspqaQv6RSTrgFN95EsfhC+7w==} + hono@4.12.15: + resolution: {integrity: sha512-qM0jDhFEaCBb4TxoW7f53Qrpv9RBiayUHo0S52JudprkhvpjIrGoU1mnnr29Fvd1U335ZFPZQY1wlkqgfGXyLg==} engines: {node: '>=16.9.0'} hookable@6.1.1: @@ -7097,21 +7097,21 @@ snapshots: '@types/aws-lambda': 8.10.161 '@types/express': 5.0.6 - '@hono/node-server@2.0.0(hono@4.12.14)': + '@hono/node-server@2.0.0(hono@4.12.15)': dependencies: - hono: 4.12.14 + hono: 4.12.15 - '@hono/zod-openapi@1.3.0(hono@4.12.14)(zod@4.3.6)': + '@hono/zod-openapi@1.3.0(hono@4.12.15)(zod@4.3.6)': dependencies: '@asteasolutions/zod-to-openapi': 8.5.0(zod@4.3.6) - '@hono/zod-validator': 0.7.6(hono@4.12.14)(zod@4.3.6) - hono: 4.12.14 + '@hono/zod-validator': 0.7.6(hono@4.12.15)(zod@4.3.6) + hono: 4.12.15 openapi3-ts: 4.5.0 zod: 4.3.6 - '@hono/zod-validator@0.7.6(hono@4.12.14)(zod@4.3.6)': + '@hono/zod-validator@0.7.6(hono@4.12.15)(zod@4.3.6)': dependencies: - hono: 4.12.14 + hono: 4.12.15 zod: 4.3.6 '@humanfs/core@0.19.2': @@ -8230,10 +8230,10 @@ snapshots: '@scalar/helpers@0.5.2': {} - '@scalar/hono-api-reference@0.10.10(hono@4.12.14)': + '@scalar/hono-api-reference@0.10.10(hono@4.12.15)': dependencies: '@scalar/client-side-rendering': 0.1.3 - hono: 4.12.14 + hono: 4.12.15 '@scalar/types@0.9.2': dependencies: @@ -10128,7 +10128,7 @@ snapshots: hmacsha1@1.0.0: {} - hono@4.12.14: {} + hono@4.12.15: {} hookable@6.1.1: {} From 0ddea9ef8695d97a72aec558f04880e84dff4bfd Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 24 Apr 2026 19:39:30 +0800 Subject: [PATCH 7/7] fix(route): apple apps (#21824) --- lib/routes/apple/apps.ts | 14 ++++++-------- lib/routes/apple/utils.ts | 26 -------------------------- lib/routes/appstore/in-app-purchase.ts | 6 ++---- 3 files changed, 8 insertions(+), 38 deletions(-) delete mode 100644 lib/routes/apple/utils.ts diff --git a/lib/routes/apple/apps.ts b/lib/routes/apple/apps.ts index c9fd61023c3c..c782652a3653 100644 --- a/lib/routes/apple/apps.ts +++ b/lib/routes/apple/apps.ts @@ -3,8 +3,6 @@ import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { appstoreBearerToken } from './utils'; - const platformIds = { osx: 'macOS', ios: 'iOS', @@ -87,20 +85,20 @@ async function handler(ctx) { const rootUrl = 'https://apps.apple.com'; const currentUrl = new URL(`${country}/app/${id}`, rootUrl).href; - const bearer = await appstoreBearerToken(); - - const response = await ofetch(`https://amp-api-edge.apps.apple.com/v1/catalog/${country}/apps/${id.replace('id', '')}`, { + const response = await ofetch(`https://apps.apple.com/api/apps/v1/catalog/${country}/apps/${id.replace('id', '')}`, { headers: { - authorization: `Bearer ${bearer}`, + authorization: 'Bearer', origin: 'https://apps.apple.com', }, query: { platform: 'iphone', additionalPlatforms: 'appletv,ipad,iphone,mac,realityDevice,watch', - extend: 'accessibility,accessibilityDetails,ageRating,backgroundAssetsInfo,backgroundAssetsInfoWithOptional,customArtwork,customDeepLink,customIconArtwork,customPromotionalText,customScreenshotsByType,customVideoPreviewsByType,description,expectedReleaseDateDisplayFormat,fileSizeByDevice,gameDisplayName,iconArtwork,installSizeByDeviceInBytes,messagesScreenshots,miniGamesDeepLink,minimumOSVersion,privacy,privacyDetails,privacyPolicyUrl,remoteControllerRequirement,requirementsByDeviceFamily,supportURLForLanguage,supportedGameCenterFeatures,supportsFunCamera,supportsSharePlay,versionHistory,websiteUrl', + extend: 'accessibility,accessibilityDetails,ageRating,backgroundAssetsInfo,backgroundAssetsInfoWithOptional,customArtwork,customDeepLink,customIconArtwork,customPromotionalText,customScreenshotsByType,customVideoPreviewsByType,description,expectedReleaseDateDisplayFormat,fileSizeByDevice,gameDisplayName,iconArtwork,installSizeByDeviceInBytes,macRequiredCapabilities,medicalDeviceInfo,messagesScreenshots,miniGamesDeepLink,minimumOSVersion,privacy,privacyDetails,privacyPolicyUrl,remoteControllerRequirement,requirementsByDeviceFamily,supportURLForLanguage,supportedGameCenterFeatures,supportsFunCamera,supportsSharePlay,versionHistory,websiteUrl', + 'extend[apps]': 'distributionKind,isVerifiedForAppleSiliconMac', 'extend[app-events]': 'description,productArtwork,productVideo', - include: 'alternate-apps,app-bundles,customers-also-bought-apps,developer,developer-other-apps,merchandised-in-apps,related-editorial-items,reviews,top-in-apps', + include: 'alternate-apps,app-bundles,customers-also-bought-apps,developer,developer-other-apps,merchandised-in-apps,related-editorial-items,reviews', 'include[apps]': 'app-events', + views: 'top-in-app-purchasables', 'availableIn[app-events]': 'future', 'sparseLimit[apps:customers-also-bought-apps]': 40, 'sparseLimit[apps:developer-other-apps]': 40, diff --git a/lib/routes/apple/utils.ts b/lib/routes/apple/utils.ts deleted file mode 100644 index 04cbf4b86776..000000000000 --- a/lib/routes/apple/utils.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { load } from 'cheerio'; - -import { config } from '@/config'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; - -// App Store and Podcast use different bearer tokens -export const appstoreBearerToken = () => - cache.tryGet( - 'apple:podcast:bearer', - async () => { - const baseUrl = 'https://apps.apple.com'; - const response = await ofetch(`${baseUrl}/us/iphone/today`); - const $ = load(response); - - const moduleAddress = new URL($('head script[type="module"]').attr('src'), baseUrl).href; - const modulesResponse = await ofetch(moduleAddress, { - parseResponse: (txt) => txt, - }); - const bearerToken = modulesResponse.match(/="(eyJhbGci.*?)"/)[1]; - - return bearerToken as string; - }, - config.cache.contentExpire, - false - ); diff --git a/lib/routes/appstore/in-app-purchase.ts b/lib/routes/appstore/in-app-purchase.ts index 94688010f0c4..6e1ef782539f 100644 --- a/lib/routes/appstore/in-app-purchase.ts +++ b/lib/routes/appstore/in-app-purchase.ts @@ -1,6 +1,5 @@ import { load } from 'cheerio'; -import { appstoreBearerToken } from '@/routes/apple/utils'; import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; @@ -33,11 +32,10 @@ async function handler(ctx) { const res = await ofetch(link); const $ = load(res); const lang = $('html').attr('lang'); - const mediaToken = await appstoreBearerToken(); - const apiResponse = await ofetch(`https://amp-api-edge.apps.apple.com/v1/catalog/${country}/apps/${id.replace('id', '')}`, { + const apiResponse = await ofetch(`https://apps.apple.com/api/apps/v1/catalog/${country}/apps/${id.replace('id', '')}`, { headers: { - authorization: `Bearer ${mediaToken}`, + authorization: 'Bearer', origin: 'https://apps.apple.com', }, query: {