Skip to content

fix(telegram): preserve access auth params in media links#21503

Open
Cod1doc wants to merge 2 commits intoDIYgod:masterfrom
Cod1doc:codex/fix-telegram-media-access-key
Open

fix(telegram): preserve access auth params in media links#21503
Cod1doc wants to merge 2 commits intoDIYgod:masterfrom
Cod1doc:codex/fix-telegram-media-access-key

Conversation

@Cod1doc
Copy link
Copy Markdown

@Cod1doc Cod1doc commented Mar 25, 2026

Involved Issue / 该 PR 相关 Issue

Close #21473

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

/telegram/channel/awesomeRSSHub

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

  • New Route / 新的路由
  • Follows Script Standard / 跟随 路由规范
  • 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 / 说明

Fix /telegram/channel/:username media URLs when ACCESS_KEY is enabled.

When both HOTLINK_TEMPLATE and ACCESS_KEY are enabled, generated /telegram/media/... URLs did not preserve the request key or code query params. As a result, rewritten media links lost authentication and images could not be loaded correctly.

This PR:

  • preserves key and code when generating /telegram/media/... URLs
  • appends thumb with URLSearchParams so existing auth params are preserved
  • adds regression tests for authenticated media URLs and thumbnail URLs

Test / 测试

npm run vitest -- lib/routes/telegram/tglib/channel.test.ts

@github-actions github-actions bot added the route label Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Auto Review

No clear rule violations found in the current diff.

@github-actions
Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/telegram/channel/awesomeRSSHub - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>RSSHub News - Telegram Channel</title>
    <link>https://t.me/s/awesomeRSSHub</link>
    <atom:link href="http://localhost:1200/telegram/channel/awesomeRSSHub" rel="self" type="application/rss+xml"></atom:link>
    <description>🍰 Everything is RSSibleThis channel will include:- #RSSHubCore updates- #RSSHub route updates- #RSSHubRadar plugin updates- rsshub.app service related information #rsshubapp- RSSHub latest news and trendsThe channel is powered by RSSHub. - Powered by RSSHub</description>
    <generator>RSSHub</generator>
    <webMaster>contact@rsshub.app (RSSHub)</webMaster>
    <itunes:author>RSSHub News</itunes:author>
    <itunes:explicit>false</itunes:explicit>
    <language>en</language>
    <image>
      <url>https://cdn5.telesco.pe/file/f4cg43nq4z5XrEcR5a6r6_A6GZUhKZ13HSe0xtNb5mTy8UReQy8RKAh7y7QYuVTQaXi3iTF8LsFKUwj8TBbweLMzv51Z-8FSNprKhKoAwDF62BTmyX_oa75_y43Tdhm7mdDQlEy0OzBU9sBft8qksPTe6LPi9Lygz3BRoeacBLa7-zQJL8LnM5I3KF2OPc3gZ0c_J2ZMnFeLcHC6sbRBoMAs7oqrTj1pt1MKBcLI3q4amd7HYa7it_f39KLNk6jvVEu3Luj09OYrSi_16ijhpV15aYmXqz_BftqMKxnBK-ibA26hXw-GrVkifks0o0rxPvImGSDVmX9wrAr8NcWyLA.jpg</url>
      <title>RSSHub News - Telegram Channel</title>
      <link>https://t.me/s/awesomeRSSHub</link>
      <height>31</height>
      <width>88</width>
    </image>
    <lastBuildDate>Wed, 25 Mar 2026 10:59:52 GMT</lastBuildDate>
    <ttl>5</ttl>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/apple&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;Apple - Newsroom (中国大陆)&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7814</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7814</guid>
      <pubDate>Fri, 20 Mar 2026 15:07:08 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/perplexity&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;Perplexity - Blog&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7813</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7813</guid>
      <pubDate>Fri, 20 Mar 2026 15:06:55 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/inceptionlabs&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;Inception Labs - Blog&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7811</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7811</guid>
      <pubDate>Mon, 16 Mar 2026 16:33:14 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/cognition&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;cognition - Blog&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7810</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7810</guid>
      <pubDate>Sun, 15 Mar 2026 14:36:42 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/claude&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;Claude - Blog&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7809</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7809</guid>
      <pubDate>Wed, 11 Mar 2026 09:10:10 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/claude&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;Claude - Code Changelog&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7808</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7808</guid>
      <pubDate>Wed, 11 Mar 2026 06:11:49 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/comic-walker&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;カドコミ(Kadocomi) - カドコミ(Kadocomi)漫画详情&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7807</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7807</guid>
      <pubDate>Tue, 10 Mar 2026 17:33:05 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/sdu&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;山东大学 - 研究生招生信息网&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7806</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7806</guid>
      <pubDate>Tue, 10 Mar 2026 17:33:05 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/qq&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;腾讯网 - 用户主页列表&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7799</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7799</guid>
      <pubDate>Sun, 08 Mar 2026 08:31:04 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/meritalk&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;MeriTalk - Latest Articles&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7798</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7798</guid>
      <pubDate>Thu, 05 Mar 2026 05:19:37 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/aschmelyun&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;Andrew Schmelyun - Blog&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7797</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7797</guid>
      <pubDate>Tue, 03 Mar 2026 21:39:06 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/gamersky&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;GamerSky - 用户动态&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7796</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7796</guid>
      <pubDate>Tue, 03 Mar 2026 21:39:06 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/gcores&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;机核网 - 用户播客&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7795</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7795</guid>
      <pubDate>Tue, 03 Mar 2026 21:39:06 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/gcores&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;机核网 - 用户动态&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7794</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7794</guid>
      <pubDate>Tue, 03 Mar 2026 21:39:06 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/8kcos&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;8KCosplay - 分类&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7793</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7793</guid>
      <pubDate>Mon, 02 Mar 2026 23:28:50 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/iwara&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;iwara - Ranking&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7792</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7792</guid>
      <pubDate>Sun, 01 Mar 2026 11:29:45 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/4chan&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;4chan - Board&#39;s catalog&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7791</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7791</guid>
      <pubDate>Sat, 28 Feb 2026 17:50:40 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/douban&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;豆瓣 - 即将播出的剧集&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7790</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7790</guid>
      <pubDate>Wed, 25 Feb 2026 14:31:05 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/bestblogs&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;bestblogs.dev - 精选推送&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7789</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7789</guid>
      <pubDate>Wed, 25 Feb 2026 09:21:05 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
    <item>
      <title>RSSHub has new routes</title>
      <description>&lt;p&gt;&lt;b&gt;RSSHub has new routes&lt;/b&gt;&lt;br&gt;&lt;a href=&quot;https://docs.rsshub.app/routes/lephoceen&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; onclick=&quot;return confirm(&#39;Open this link?\n\n&#39;+this.href);&quot;&gt;&lt;b&gt;&lt;u&gt;Le Phocéen - Fil Info Le Phocéen (Chrono)&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>https://t.me/awesomeRSSHub/7788</link>
      <guid isPermaLink="false">https://t.me/awesomeRSSHub/7788</guid>
      <pubDate>Mon, 23 Feb 2026 13:27:08 GMT</pubDate>
      <author>RSS to Telegram Bot</author>
    </item>
  </channel>
</rss>

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.

当配置了图片反代HOTLINK_TEMPLATE并配置ACCESS_KEY的时候,Telegram频道媒体链接无法被正确拼接

1 participant