增加RSS链接内容预览&内容过滤预览 - #1088
Open
afraidjpg wants to merge 5 commits into
Open
Conversation
|
@afraidjpg is attempting to deploy a commit to the estrellaxd's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
本 PR 为“番剧搜索 → 添加订阅”流程补齐 RSS 内容预览能力:前端新增预览入口与对话框展示 RSS 条目,并在 UI 中标记条目是否会被过滤;后端新增 /api/v1/rss/preview 返回 RSS 原始条目与当前全局过滤规则,同时在 RSSEngine 中引入更健壮的过滤规则编译逻辑(含无效正则降级)。
Changes:
- WebUI:将订阅确认弹窗中的 RSS 展示抽成通用行组件,并新增 RSS 预览对话框(展示全局+本地过滤规则与逐条通过/拦截状态)。
- WebUI:新增 RSS 预览 API 调用与类型定义,并补齐相关单测。
- Backend:新增
/rss/previewAPI、RSS 预览响应模型,并重构过滤规则编译(新增_compile_filter_terms等辅助方法)及补齐单测。
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| webui/types/rss.ts | 新增 RSS 预览响应的 TS 类型定义 |
| webui/types/dts/components.d.ts | 注册新全局组件类型声明(预览对话框) |
| webui/src/i18n/zh-CN.json | 新增 RSS 预览相关中文文案 |
| webui/src/i18n/en.json | 新增 RSS 预览相关英文文案 |
| webui/src/components/search/ab-search-confirm.vue | 订阅确认弹窗改用通用 RSS 行组件,并接入预览入口 |
| webui/src/components/search/ab-search-confirm.test.ts | 新增订阅确认弹窗与 RSS 预览交互/过滤的组件测试 |
| webui/src/components/bangumi-rss-preview-dialog.vue | 新增 RSS 内容预览对话框组件(加载、过滤展示、状态标记) |
| webui/src/components/bangumi-rss-link-row.vue | 通用 RSS 行组件新增预览按钮与对话框挂载 |
| webui/src/api/rss.ts | 新增 apiRSS.preview() 调用 /api/v1/rss/preview |
| webui/src/api/tests/rss.test.ts | 新增 preview API 调用的单元测试 |
| backend/src/test/test_rss_engine_new.py | 新增 preview_rss 与“全局+本地过滤后下载”相关测试用例 |
| backend/src/test/test_api_rss.py | 新增 /rss/preview API 测试用例 |
| backend/src/module/rss/engine.py | 新增 preview_rss,并重构过滤规则编译/匹配辅助方法 |
| backend/src/module/models/rss.py | 新增 RSS 预览响应的 Pydantic 模型 |
| backend/src/module/models/init.py | 导出新增的 RSS 预览模型 |
| backend/src/module/api/rss.py | 新增 /rss/preview 路由并接入 RSSEngine.preview_rss |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
205
to
+212
| def _get_filter_pattern(self, filter_str: str) -> re.Pattern: | ||
| if filter_str not in self._filter_cache: | ||
| raw_pattern = filter_str.replace(",", "|") | ||
| try: | ||
| self._filter_cache[filter_str] = re.compile(raw_pattern, re.IGNORECASE) | ||
| except re.error: | ||
| # Filter contains invalid regex chars (e.g. unmatched '[') | ||
| # Fall back to escaping each term for literal matching | ||
| terms = filter_str.split(",") | ||
| escaped = "|".join(re.escape(t) for t in terms) | ||
| self._filter_cache[filter_str] = re.compile(escaped, re.IGNORECASE) | ||
| logger.warning( | ||
| f"Filter '{filter_str}' contains invalid regex, " | ||
| f"using literal matching" | ||
| ) | ||
| pattern = self._compile_filter_terms( | ||
| filter_str.split(","), ignore_case=True | ||
| ) | ||
| if pattern is None: | ||
| raise ValueError("filter_str must not be empty") | ||
| self._filter_cache[filter_str] = pattern |
Comment on lines
+231
to
+235
| def _get_downloadable_torrents( | ||
| self, torrents: list[Torrent], filter_str: str = "" | ||
| ) -> list[Torrent]: | ||
| return [ | ||
| torrent |
Comment on lines
+24
to
+33
| <ab-icon-button | ||
| size="sm" | ||
| class="action-btn copy-btn" | ||
| :class="{ copied: props.copied }" | ||
| :label="$t('common.copy')" | ||
| @click="emit('copy')" | ||
| > | ||
| <CheckOne v-if="props.copied" theme="outline" size="14" /> | ||
| <Copy v-else theme="outline" size="14" /> | ||
| </ab-icon-button> |
… preview icon visibility
afraidjpg
commented
Jul 19, 2026
afraidjpg
left a comment
Author
There was a problem hiding this comment.
对功能增加一个小改进,可以切换 展示/隐藏 被过滤的项目,方便查看
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
主要增加特性
针对番剧搜索结果的RSS链接,增加内容预览,并且应用过滤规则,以查看最终下载结果是否符合预期
功能&逻辑的改动/新增
webui
backend
/rss/previewAPI 以及此API相关的方法,该API返回 RSS 链接内容,以及当前backend中的全局过滤规则engine.py中的_get_filter_pattern的逻辑,增加_compile_filter_terms用于规则解析其他说明
ab-search-confirm.vue中将 RSS 部分替换为了bangumi-rss-link-row通用组件在
bangumi-rss-link-row中增加了预览icon,基于参数previewRuleFilter是否为真RSS内容预览为单独新增组件
bangumi-rss-preview-dialog效果预览
改动前
改动后
过滤效果预览
#1058 [Feature Request]在添加订阅中,增加展示该RSS内容的选项/按钮