Skip to content

增加RSS链接内容预览&内容过滤预览 - #1088

Open
afraidjpg wants to merge 5 commits into
EstrellaXD:3.3-devfrom
afraidjpg:feature/rss-content-preview
Open

增加RSS链接内容预览&内容过滤预览#1088
afraidjpg wants to merge 5 commits into
EstrellaXD:3.3-devfrom
afraidjpg:feature/rss-content-preview

Conversation

@afraidjpg

Copy link
Copy Markdown

主要增加特性

针对番剧搜索结果的RSS链接,增加内容预览,并且应用过滤规则,以查看最终下载结果是否符合预期

功能&逻辑的改动/新增

webui

  1. 在搜索栏搜索番剧后,点击单一结果tag后出现的【添加订阅】窗口内的RSS源的复制按钮的右侧,增加一个预览icon
  2. 点击预览icon后打开新的模态框,其中包括
    • 当前应用的过滤规则 -- 包含全局的过滤规则+当前页设置的过滤规则
    • RSS内包含的内容列表
    • 每行标题开头包含一个图标,显示是否通过过滤,✅为通过,预计会被下载,❌为拦截,预计不会被下载

backend

  1. 增加 /rss/preview API 以及此API相关的方法,该API返回 RSS 链接内容,以及当前 backend 中的全局过滤规则
  2. 略微修改了 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

效果预览

改动前 490c0fe6ba87ff1b846dc6c29adc74fa
改动后 96fd8a791cdc0c3b4c3fe5fa29eaf3ad 869e1c118815f3298960b3ba63a364e9
过滤效果预览 3a42b4d686e38fb50c495904557dbb7c

#1058 [Feature Request]在添加订阅中,增加展示该RSS内容的选项/按钮

Copilot AI review requested due to automatic review settings July 19, 2026 15:42
@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

@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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

本 PR 为“番剧搜索 → 添加订阅”流程补齐 RSS 内容预览能力:前端新增预览入口与对话框展示 RSS 条目,并在 UI 中标记条目是否会被过滤;后端新增 /api/v1/rss/preview 返回 RSS 原始条目与当前全局过滤规则,同时在 RSSEngine 中引入更健壮的过滤规则编译逻辑(含无效正则降级)。

Changes:

  • WebUI:将订阅确认弹窗中的 RSS 展示抽成通用行组件,并新增 RSS 预览对话框(展示全局+本地过滤规则与逐条通过/拦截状态)。
  • WebUI:新增 RSS 预览 API 调用与类型定义,并补齐相关单测。
  • Backend:新增 /rss/preview API、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 thread backend/src/module/rss/engine.py Outdated
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>

@afraidjpg afraidjpg left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

对功能增加一个小改进,可以切换 展示/隐藏 被过滤的项目,方便查看

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants