Skip to content

refactor(route/dockerhub): request using ofetch and typed model #19057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nuomi1
Copy link
Contributor

@nuomi1 nuomi1 commented May 8, 2025

Involved Issue / 该 PR 相关 Issue

Close #

Example for the Proposed Route(s) / 路由地址示例

/dockerhub/tag/library/mariadb
/dockerhub/build/diygod/rsshub/latest
/dockerhub/build/diygod/rsshub
/dockerhub/repositories/diygod

New RSS Route Checklist / 新 RSS 路由检查表

  • New Route / 新的路由
  • Anti-bot or rate limit / 反爬/频率限制
    • If yes, do your code reflect this sign? / 如果有, 是否有对应的措施?
  • Date and time / 日期和时间
    • Parsed / 可以解析
    • Correct time zone / 时区正确
  • New package added / 添加了新的包
  • Puppeteer

Note / 说明

  1. Should we change limits in /dockerhub/tag to limit?

Copy link
Contributor

github-actions bot commented May 8, 2025

Successfully generated as following:

http://localhost:1200/dockerhub/tag/library/mariadb - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>library/mariadb tags</title>
    <link>https://hub.docker.com/_/mariadb</link>
    <atom:link href="http://localhost:1200/dockerhub/tag/library/mariadb" rel="self" type="application/rss+xml"></atom:link>
    <description>MariaDB Server is a high performing open source relational database, forked from MySQL. - Powered by RSSHub</description>
    <generator>RSSHub</generator>
    <webMaster>contact@rsshub.app (RSSHub)</webMaster>
    <language>en</language>
    <lastBuildDate>Thu, 08 May 2025 15:28:55 GMT</lastBuildDate>
    <ttl>5</ttl>
    <item>
      <title>library/mariadb:lts-noble was updated</title>
      <description>library/mariadb:lts-noble was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/lts-noble/images/sha256-ec1794c8cd442f795b838f60379d7851acf8fef04cc39a8ecf74e7b1d6a3b6d7</link>
      <guid isPermaLink="false">library/mariadb:lts-noble@23268768f2b8a18d64e90ff52e02bce0</guid>
      <pubDate>Mon, 05 May 2025 21:35:54 GMT</pubDate>
      <author>library</author>
    </item>
    <item>
      <title>library/mariadb:lts was updated</title>
      <description>library/mariadb:lts was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/lts/images/sha256-ec1794c8cd442f795b838f60379d7851acf8fef04cc39a8ecf74e7b1d6a3b6d7</link>
      <guid isPermaLink="false">library/mariadb:lts@23268768f2b8a18d64e90ff52e02bce0</guid>
      <pubDate>Mon, 05 May 2025 21:35:53 GMT</pubDate>
      <author>library</author>
    </item>
    <item>
      <title>library/mariadb:11.4.5-noble was updated</title>
      <description>library/mariadb:11.4.5-noble was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/11.4.5-noble/images/sha256-ec1794c8cd442f795b838f60379d7851acf8fef04cc39a8ecf74e7b1d6a3b6d7</link>
      <guid isPermaLink="false">library/mariadb:11.4.5-noble@23268768f2b8a18d64e90ff52e02bce0</guid>
      <pubDate>Mon, 05 May 2025 21:35:38 GMT</pubDate>
      <author>library</author>
    </item>
    <item>
      <title>library/mariadb:11.4.5 was updated</title>
      <description>library/mariadb:11.4.5 was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/11.4.5/images/sha256-ec1794c8cd442f795b838f60379d7851acf8fef04cc39a8ecf74e7b1d6a3b6d7</link>
      <guid isPermaLink="false">library/mariadb:11.4.5@23268768f2b8a18d64e90ff52e02bce0</guid>
      <pubDate>Mon, 05 May 2025 21:35:37 GMT</pubDate>
      <author>library</author>
    </item>
    <item>
      <title>library/mariadb:11.4-noble was updated</title>
      <description>library/mariadb:11.4-noble was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/11.4-noble/images/sha256-ec1794c8cd442f795b838f60379d7851acf8fef04cc39a8ecf74e7b1d6a3b6d7</link>
      <guid isPermaLink="false">library/mariadb:11.4-noble@23268768f2b8a18d64e90ff52e02bce0</guid>
      <pubDate>Mon, 05 May 2025 21:35:34 GMT</pubDate>
      <author>library</author>
    </item>
    <item>
      <title>library/mariadb:11.4 was updated</title>
      <description>library/mariadb:11.4 was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/11.4/images/sha256-ec1794c8cd442f795b838f60379d7851acf8fef04cc39a8ecf74e7b1d6a3b6d7</link>
      <guid isPermaLink="false">library/mariadb:11.4@23268768f2b8a18d64e90ff52e02bce0</guid>
      <pubDate>Mon, 05 May 2025 21:35:32 GMT</pubDate>
      <author>library</author>
    </item>
    <item>
      <title>library/mariadb:noble was updated</title>
      <description>library/mariadb:noble was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/noble/images/sha256-6169f1cdbd27219c6789f517930d5f0483d7bb879ef6b3398eb053e8640758b5</link>
      <guid isPermaLink="false">library/mariadb:noble@def8ccf06ed4a26a35622b5b1896c55f</guid>
      <pubDate>Mon, 05 May 2025 18:37:01 GMT</pubDate>
      <author>library</author>
    </item>
    <item>
      <title>library/mariadb:latest was updated</title>
      <description>library/mariadb:latest was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/latest/images/sha256-6169f1cdbd27219c6789f517930d5f0483d7bb879ef6b3398eb053e8640758b5</link>
      <guid isPermaLink="false">library/mariadb:latest@def8ccf06ed4a26a35622b5b1896c55f</guid>
      <pubDate>Mon, 05 May 2025 18:36:55 GMT</pubDate>
      <author>library</author>
    </item>
    <item>
      <title>library/mariadb:11.8.1-rc was updated</title>
      <description>library/mariadb:11.8.1-rc was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/11.8.1-rc/images/sha256-40815a7b5ece4e80da8eeefd8b4219fa67b0382472b13769c3fd403baccabc6b</link>
      <guid isPermaLink="false">library/mariadb:11.8.1-rc@59911d5d7dd6f96fffb7a7a9246bdd15</guid>
      <pubDate>Mon, 05 May 2025 18:36:53 GMT</pubDate>
      <author>library</author>
    </item>
    <item>
      <title>library/mariadb:11.8.1-noble-rc was updated</title>
      <description>library/mariadb:11.8.1-noble-rc was updated, supporting the linux/amd64, unknown/unknown, linux/arm64/v8, unknown/unknown, linux/ppc64le, unknown/unknown, linux/s390x, unknown/unknown</description>
      <link>https://hub.docker.com/layers/library/mariadb/11.8.1-noble-rc/images/sha256-40815a7b5ece4e80da8eeefd8b4219fa67b0382472b13769c3fd403baccabc6b</link>
      <guid isPermaLink="false">library/mariadb:11.8.1-noble-rc@59911d5d7dd6f96fffb7a7a9246bdd15</guid>
      <pubDate>Mon, 05 May 2025 18:36:51 GMT</pubDate>
      <author>library</author>
    </item>
  </channel>
</rss>
http://localhost:1200/dockerhub/build/diygod/rsshub/latest - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>diygod/rsshub:latest build history</title>
    <link>https://hub.docker.com/r/diygod/rsshub</link>
    <atom:link href="http://localhost:1200/dockerhub/build/diygod/rsshub/latest" rel="self" type="application/rss+xml"></atom:link>
    <description>🍰 使用 RSS 连接全世界 - Powered by RSSHub</description>
    <generator>RSSHub</generator>
    <webMaster>contact@rsshub.app (RSSHub)</webMaster>
    <language>en</language>
    <lastBuildDate>Thu, 08 May 2025 15:28:56 GMT</lastBuildDate>
    <ttl>5</ttl>
    <item>
      <title>diygod/rsshub:latest was built. 238.82 MB</title>
      <description></description>
      <link>https://hub.docker.com/layers/diygod/rsshub/latest/images/sha256-2a725950056713952019890a74b986c34b0d7ff22c2d58f8f73f4def793fbc12</link>
      <guid isPermaLink="false">diygod/rsshub:latest@0fc17277d095207e79dc3b7824925d31</guid>
      <pubDate>Thu, 08 May 2025 14:28:16 GMT</pubDate>
      <author>diygod</author>
    </item>
  </channel>
</rss>
http://localhost:1200/dockerhub/build/diygod/rsshub - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>diygod/rsshub:latest build history</title>
    <link>https://hub.docker.com/r/diygod/rsshub</link>
    <atom:link href="http://localhost:1200/dockerhub/build/diygod/rsshub" rel="self" type="application/rss+xml"></atom:link>
    <description>🍰 使用 RSS 连接全世界 - Powered by RSSHub</description>
    <generator>RSSHub</generator>
    <webMaster>contact@rsshub.app (RSSHub)</webMaster>
    <language>en</language>
    <lastBuildDate>Thu, 08 May 2025 15:28:56 GMT</lastBuildDate>
    <ttl>5</ttl>
    <item>
      <title>diygod/rsshub:latest was built. 238.82 MB</title>
      <description></description>
      <link>https://hub.docker.com/layers/diygod/rsshub/latest/images/sha256-2a725950056713952019890a74b986c34b0d7ff22c2d58f8f73f4def793fbc12</link>
      <guid isPermaLink="false">diygod/rsshub:latest@0fc17277d095207e79dc3b7824925d31</guid>
      <pubDate>Thu, 08 May 2025 14:28:16 GMT</pubDate>
      <author>diygod</author>
    </item>
  </channel>
</rss>
http://localhost:1200/dockerhub/repositories/diygod - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>diygod repositories</title>
    <link>https://hub.docker.com/u/diygod</link>
    <atom:link href="http://localhost:1200/dockerhub/repositories/diygod" rel="self" type="application/rss+xml"></atom:link>
    <description>List of repositories for diygod - Powered by RSSHub</description>
    <generator>RSSHub</generator>
    <webMaster>contact@rsshub.app (RSSHub)</webMaster>
    <language>en</language>
    <lastBuildDate>Thu, 08 May 2025 15:28:56 GMT</lastBuildDate>
    <ttl>5</ttl>
    <item>
      <title>rsshub</title>
      <description>🍰 使用 RSS 连接全世界&lt;br&gt;status: active&lt;br&gt;stars: 228&lt;br&gt;pulls: 17189285</description>
      <link>https://hub.docker.com/r/diygod/rsshub</link>
      <guid isPermaLink="false">https://hub.docker.com/r/diygod/rsshub</guid>
      <pubDate>Thu, 08 May 2025 14:31:28 GMT</pubDate>
      <author>diygod</author>
    </item>
    <item>
      <title>fava</title>
      <description>&lt;br&gt;status: active&lt;br&gt;stars: 0&lt;br&gt;pulls: 48</description>
      <link>https://hub.docker.com/r/diygod/fava</link>
      <guid isPermaLink="false">https://hub.docker.com/r/diygod/fava</guid>
      <pubDate>Sat, 15 Feb 2025 12:31:21 GMT</pubDate>
      <author>diygod</author>
    </item>
    <item>
      <title>download-webhook</title>
      <description>🍰 Download files through webhook&lt;br&gt;status: active&lt;br&gt;stars: 0&lt;br&gt;pulls: 1039</description>
      <link>https://hub.docker.com/r/diygod/download-webhook</link>
      <guid isPermaLink="false">https://hub.docker.com/r/diygod/download-webhook</guid>
      <pubDate>Mon, 21 Jun 2021 04:23:12 GMT</pubDate>
      <author>diygod</author>
    </item>
    <item>
      <title>dplayer-nodejs</title>
      <description>Node.js backend for DPlayer(https://github.com/DIYgod/DPlayer)&lt;br&gt;status: active&lt;br&gt;stars: 1&lt;br&gt;pulls: 577</description>
      <link>https://hub.docker.com/r/diygod/dplayer-nodejs</link>
      <guid isPermaLink="false">https://hub.docker.com/r/diygod/dplayer-nodejs</guid>
      <pubDate>Tue, 04 Jul 2017 15:22:44 GMT</pubDate>
      <author>diygod</author>
    </item>
    <item>
      <title>weixinbot-for-hitokoto</title>
      <description>一言微信机器人,回复关键词“一言”&lt;br&gt;status: active&lt;br&gt;stars: 0&lt;br&gt;pulls: 133</description>
      <link>https://hub.docker.com/r/diygod/weixinbot-for-hitokoto</link>
      <guid isPermaLink="false">https://hub.docker.com/r/diygod/weixinbot-for-hitokoto</guid>
      <pubDate>Sun, 11 Sep 2016 05:44:42 GMT</pubDate>
      <author>diygod</author>
    </item>
  </channel>
</rss>

// only check for different images hashes (considering varients of all arches), since the tag name is already fixed
guid: hash(item.images),
guid: utils.getGuid(namespace, item),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the guid which causes all current subscribers having duplicated entry in their RSS reader.

link: repositoryLink,
author: owner,
pubDate: utils.getPubDate(repo),
guid: repositoryLink,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the guid which causes all current subscribers having duplicated entries in their RSS reader.

pubDate: parseDate(repo.last_updated),
guid: `${owner}/${repo.name}`,
}));
const { owner, limit } = ctx.req.param();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const limit = Number.parseInt(ctx.req.query('limit') || '10');

limit is a query parameter not a path parameter.

pubDate: parseDate(item.tag_last_pushed),
guid: `${namespace}:${item.name}@${hash(item.images || [])}`,
pubDate: utils.getPubDate(item),
guid: utils.getGuid(namespace, item),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the guid which causes all current subscribers having duplicated entries in their RSS reader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants