-
-
Notifications
You must be signed in to change notification settings - Fork 99
feat:add RSSHub RSSHubAccessKey #31
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
Conversation
审阅者指南通过扩展配置模式、通过抓取管理器传递密钥、在 URL 验证中将其作为查询参数附加,并用更新的测试和文档覆盖该功能,引入对 RSSHub AccessKey 的支持。 从配置传递 RSSHubAccessKey 到 RSS 请求的序列图sequenceDiagram
participant Config
participant ScrapeManager
participant ScrapeSourceRSS
participant RSSHub
Config->>ScrapeManager: Provide RSSHubAccessKey
ScrapeManager->>ScrapeSourceRSS: Set RSSHubAccessKey field
ScrapeSourceRSS->>ScrapeSourceRSS: Validate() appends key to URL
ScrapeSourceRSS->>RSSHub: Request with key as query parameter
更新后的 Scrape 和 ScrapeSourceRSS 实体的 ER 图erDiagram
Scrape {
string RSSHubEndpoint
string RSSHubAccessKey
}
ScrapeSource {
}
ScrapeSourceRSS {
string URL
string RSSHubEndpoint
string RSSHubRoutePath
string RSSHubAccessKey
}
Scrape ||--o{ ScrapeSource : contains
ScrapeSource ||--|{ ScrapeSourceRSS : has
更新后的 ScrapeSourceRSS 和 Scrape 配置的类图classDiagram
class Scrape {
Past: timeutil.Duration
Interval: timeutil.Duration
RSSHubEndpoint: string
RSSHubAccessKey: string
Sources: []ScrapeSource
}
class ScrapeSource {
RSS: ScrapeSourceRSS
}
class ScrapeSourceRSS {
URL: string
RSSHubEndpoint: string
RSSHubRoutePath: string
RSSHubAccessKey: string
}
Scrape --> ScrapeSource
ScrapeSource --> ScrapeSourceRSS
文件级别变更
提示和命令与 Sourcery 互动
自定义您的体验访问您的 仪表盘 以:
获取帮助Original review guide in EnglishReviewer's GuideIntroduce support for RSSHub AccessKey by extending configuration schema, passing the key through the scrape manager, appending it as a query parameter in URL validation, and covering the feature with updated tests and documentation. Sequence diagram for passing RSSHubAccessKey from config to RSS requestsequenceDiagram
participant Config
participant ScrapeManager
participant ScrapeSourceRSS
participant RSSHub
Config->>ScrapeManager: Provide RSSHubAccessKey
ScrapeManager->>ScrapeSourceRSS: Set RSSHubAccessKey field
ScrapeSourceRSS->>ScrapeSourceRSS: Validate() appends key to URL
ScrapeSourceRSS->>RSSHub: Request with key as query parameter
ER diagram for updated Scrape and ScrapeSourceRSS entitieserDiagram
Scrape {
string RSSHubEndpoint
string RSSHubAccessKey
}
ScrapeSource {
}
ScrapeSourceRSS {
string URL
string RSSHubEndpoint
string RSSHubRoutePath
string RSSHubAccessKey
}
Scrape ||--o{ ScrapeSource : contains
ScrapeSource ||--|{ ScrapeSourceRSS : has
Class diagram for updated ScrapeSourceRSS and Scrape configurationclassDiagram
class Scrape {
Past: timeutil.Duration
Interval: timeutil.Duration
RSSHubEndpoint: string
RSSHubAccessKey: string
Sources: []ScrapeSource
}
class ScrapeSource {
RSS: ScrapeSourceRSS
}
class ScrapeSourceRSS {
URL: string
RSSHubEndpoint: string
RSSHubRoutePath: string
RSSHubAccessKey: string
}
Scrape --> ScrapeSource
ScrapeSource --> ScrapeSourceRSS
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你好 - 我已经审阅了你的更改 - 以下是一些反馈:
- 考虑使用
net/url包将访问密钥作为查询参数附加,而不是在Validate()中使用原始字符串拼接,这样可以更可靠地处理现有参数和 URL 编码。 - 将 URL 构建逻辑(附加
?key=)从Validate()中移出,放入专门的构造函数或设置方法中,以使验证无副作用且确定性。 - 删除或取消注释
ScrapeSource中被注释掉的RSSHubAccessKey字段,以保持代码和配置定义的一致性和清晰性。
AI 代理提示
请处理此代码审查中的评论:
## 总体评论
- 考虑使用 `net/url` 包将访问密钥作为查询参数附加,而不是在 `Validate()` 中使用原始字符串拼接,这样可以更可靠地处理现有参数和 URL 编码。
- 将 URL 构建逻辑(附加 `?key=`)从 `Validate()` 中移出,放入专门的构造函数或设置方法中,以使验证无副作用且确定性。
- 删除或取消注释 `ScrapeSource` 中被注释掉的 `RSSHubAccessKey` 字段,以保持代码和配置定义的一致性和清晰性。帮助我更有用!请点击每个评论上的 👍 或 👎,我将利用这些反馈来改进您的评论。
Original comment in English
Hey there - I've reviewed your changes - here's some feedback:
- Consider using the net/url package to append the access key as a query parameter instead of raw string concatenation in Validate(), which will handle existing parameters and URL-encoding more reliably.
- Move the URL‐building logic (appending
?key=) out of Validate() into a dedicated constructor or setup method to keep validation side‐effect-free and deterministic. - Remove or uncomment the commented-out RSSHubAccessKey field in ScrapeSource so the code and config definitions stay consistent and clear.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider using the net/url package to append the access key as a query parameter instead of raw string concatenation in Validate(), which will handle existing parameters and URL-encoding more reliably.
- Move the URL‐building logic (appending `?key=`) out of Validate() into a dedicated constructor or setup method to keep validation side‐effect-free and deterministic.
- Remove or uncomment the commented-out RSSHubAccessKey field in ScrapeSource so the code and config definitions stay consistent and clear.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@glidea 修复了 |
@glidea fixed |
|
佬 lint 没过 |
Guy lint failed |
本次更新新增了对 RSSHub 访问密钥(AccessKey)的配置支持。该配置项的主要作用是:当 RSSHub 服务启用了基于访问密钥的访问控制机制时,用户可通过配置该密钥实现授权访问。此功能特别适用于 ZenFeed 与 RSSHub 服务部署在不同服务器上的场景,能够有效提升跨服务访问的安全性与便捷性。
This update introduces support for configuring the RSSHub AccessKey. The primary purpose of this configuration is to enable authorized access to RSSHub when it has access control enabled via an AccessKey. This feature is particularly useful in scenarios where ZenFeed and RSSHub are deployed on different servers, enhancing both security and convenience for cross-service access.
Sourcery 摘要
通过扩展配置模式、更新抓取器逻辑以将密钥附加到 URL,并添加相应的文档和测试,引入对 RSSHub 访问密钥的支持。
新功能:
改进:
文档:
测试:
Original summary in English
Summary by Sourcery
Introduce support for an RSSHub access key by extending the config schema, updating the scraper logic to append the key to URLs, and adding corresponding documentation and tests
New Features:
Enhancements:
Documentation:
Tests: