Skip to content

feat(routes): 移除失效路由 & 更新禁用词#239

Merged
consistent-k merged 1 commit intomainfrom
dev
Jul 10, 2025
Merged

feat(routes): 移除失效路由 & 更新禁用词#239
consistent-k merged 1 commit intomainfrom
dev

Conversation

@consistent-k
Copy link
Copy Markdown
Owner

@consistent-k consistent-k commented Jul 10, 2025

Summary by CodeRabbit

  • 新功能

    • 新增敏感词常量数组,优化敏感词配置方式。
  • 重构

    • 多个视频相关的接口(如分类、详情、首页、搜索、播放等)被移除,涉及“独播影视”、“华为吧资源”、“荐片”、“快车资源”、“MP4电影网”、“天天影视”等多个资源源。
    • 各资源源的命名空间配置被移除或调整。
    • 精简和调整部分配置项内容。
  • 样式

    • 部分命名和描述字段由繁体字调整为简体字。

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 10, 2025

Walkthrough

本次变更大幅清理了各视频聚合源(如独播影视、荐片、天天影视、快车资源、华为吧、MP4电影网等)相关的所有路由、请求、命名空间和工具模块,仅保留了部分核心配置与常量。配置文件优化为从外部常量导入敏感词数组。部分命名空间字符串做了简体化。

Changes

文件/路径分组 变更摘要
src/config/index.ts 默认敏感词数组由硬编码改为从常量模块导入。
src/constant/word.ts 新增导出敏感词常量数组 BANNED_KEYWORDS
src/routes/dubo/
src/routes/hw8/

src/routes/jianpian/
src/routes/kczy/

src/routes/mp4movie/
src/routes/tiantian/
删除所有相关路由、请求工具、命名空间、类型声明等,涉及分类、详情、首页、搜索、播放等功能。
src/routes/lzzy/namespace.ts 命名空间 namedescription 字段由繁体改为简体。

Sequence Diagram(s)

sequenceDiagram
    participant config as 配置模块
    participant word as 敏感词常量模块
    Note over config,word: 初始化流程
    config->>word: 导入 BANNED_KEYWORDS
    config-->>config: bannedKeywords 赋值为 BANNED_KEYWORDS(如无环境变量)
Loading

Poem

兔子挥手说再见,
路由纷纷化云烟。
敏感词常量来守护,
配置清爽又新鲜。
简繁一改更统一,
代码世界焕新天!

(=^● ⋏ ●^=)

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/constant/word.ts (1)

1-1: 建议将关键字数组声明为只读以防止被意外篡改

当前导出的数组仍可在运行时被修改。出于配置安全性与类型推导友好性,建议使用 as constObject.freeze 让其只读化。

-export const BANNED_KEYWORDS = ['福利', '伦理', '成人', '三级', '激情', '情色', '里番', '无码', '未分类', '两性', '热舞', '女频'];
+export const BANNED_KEYWORDS = [
+  '福利',
+  '伦理',
+  '成人',
+  '三级',
+  '激情',
+  '情色',
+  '里番',
+  '无码',
+  '未分类',
+  '两性',
+  '热舞',
+  '女频',
+] as const;

这样可避免外部模块对关键列表进行 push/splice 等操作。

src/config/index.ts (1)

6-13: looger 拼写错误可能导致日志配置被忽略

属性名应为 logger 才符合常见约定,也便于 IDE/类型检查捕获。建议修正拼写并同步影响到的调用方。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8826da4 and 61d528b.

📒 Files selected for processing (49)
  • src/config/index.ts (2 hunks)
  • src/constant/word.ts (1 hunks)
  • src/routes/dubo/category.ts (0 hunks)
  • src/routes/dubo/detail.ts (0 hunks)
  • src/routes/dubo/home.ts (0 hunks)
  • src/routes/dubo/homeVod.ts (0 hunks)
  • src/routes/dubo/namespace.ts (0 hunks)
  • src/routes/dubo/play.ts (0 hunks)
  • src/routes/dubo/request.ts (0 hunks)
  • src/routes/dubo/search.ts (0 hunks)
  • src/routes/hw8/category.ts (0 hunks)
  • src/routes/hw8/detail.ts (0 hunks)
  • src/routes/hw8/home.ts (0 hunks)
  • src/routes/hw8/homeVod.ts (0 hunks)
  • src/routes/hw8/namespace.ts (0 hunks)
  • src/routes/hw8/play.ts (0 hunks)
  • src/routes/hw8/search.ts (0 hunks)
  • src/routes/jianpian/category.ts (0 hunks)
  • src/routes/jianpian/detail.ts (0 hunks)
  • src/routes/jianpian/home.ts (0 hunks)
  • src/routes/jianpian/homeVod.ts (0 hunks)
  • src/routes/jianpian/namespace.ts (0 hunks)
  • src/routes/jianpian/play.ts (0 hunks)
  • src/routes/jianpian/request.ts (0 hunks)
  • src/routes/jianpian/search.ts (0 hunks)
  • src/routes/kczy/category.ts (0 hunks)
  • src/routes/kczy/detail.ts (0 hunks)
  • src/routes/kczy/home.ts (0 hunks)
  • src/routes/kczy/homeVod.ts (0 hunks)
  • src/routes/kczy/namespace.ts (0 hunks)
  • src/routes/kczy/play.ts (0 hunks)
  • src/routes/kczy/search.ts (0 hunks)
  • src/routes/lzzy/namespace.ts (1 hunks)
  • src/routes/mp4movie/category.ts (0 hunks)
  • src/routes/mp4movie/detail.ts (0 hunks)
  • src/routes/mp4movie/home.ts (0 hunks)
  • src/routes/mp4movie/homeVod.ts (0 hunks)
  • src/routes/mp4movie/namespace.ts (0 hunks)
  • src/routes/mp4movie/play.ts (0 hunks)
  • src/routes/mp4movie/request.ts (0 hunks)
  • src/routes/mp4movie/search.ts (0 hunks)
  • src/routes/tiantian/category.ts (0 hunks)
  • src/routes/tiantian/detail.ts (0 hunks)
  • src/routes/tiantian/home.ts (0 hunks)
  • src/routes/tiantian/homeVod.ts (0 hunks)
  • src/routes/tiantian/namespace.ts (0 hunks)
  • src/routes/tiantian/play.ts (0 hunks)
  • src/routes/tiantian/request.ts (0 hunks)
  • src/routes/tiantian/search.ts (0 hunks)
💤 Files with no reviewable changes (46)
  • src/routes/kczy/play.ts
  • src/routes/hw8/homeVod.ts
  • src/routes/hw8/category.ts
  • src/routes/kczy/home.ts
  • src/routes/jianpian/play.ts
  • src/routes/kczy/search.ts
  • src/routes/hw8/home.ts
  • src/routes/mp4movie/namespace.ts
  • src/routes/tiantian/request.ts
  • src/routes/jianpian/namespace.ts
  • src/routes/dubo/namespace.ts
  • src/routes/kczy/namespace.ts
  • src/routes/tiantian/namespace.ts
  • src/routes/kczy/homeVod.ts
  • src/routes/hw8/search.ts
  • src/routes/hw8/detail.ts
  • src/routes/kczy/category.ts
  • src/routes/kczy/detail.ts
  • src/routes/mp4movie/request.ts
  • src/routes/hw8/namespace.ts
  • src/routes/jianpian/detail.ts
  • src/routes/mp4movie/homeVod.ts
  • src/routes/dubo/homeVod.ts
  • src/routes/hw8/play.ts
  • src/routes/mp4movie/home.ts
  • src/routes/jianpian/request.ts
  • src/routes/mp4movie/play.ts
  • src/routes/dubo/play.ts
  • src/routes/jianpian/search.ts
  • src/routes/tiantian/detail.ts
  • src/routes/tiantian/play.ts
  • src/routes/dubo/request.ts
  • src/routes/mp4movie/search.ts
  • src/routes/jianpian/category.ts
  • src/routes/jianpian/home.ts
  • src/routes/dubo/category.ts
  • src/routes/dubo/home.ts
  • src/routes/tiantian/home.ts
  • src/routes/tiantian/homeVod.ts
  • src/routes/dubo/search.ts
  • src/routes/tiantian/search.ts
  • src/routes/mp4movie/category.ts
  • src/routes/tiantian/category.ts
  • src/routes/mp4movie/detail.ts
  • src/routes/jianpian/homeVod.ts
  • src/routes/dubo/detail.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/config/index.ts (1)
src/constant/word.ts (1)
  • BANNED_KEYWORDS (1-1)
🔇 Additional comments (1)
src/routes/lzzy/namespace.ts (1)

4-7: 简体化命名无功能性风险,变更可接受

},
// 禁用关键词
bannedKeywords: process.env.BANNED_KEYWORDS?.split(',').filter((keyword) => keyword.trim()) || ['福利', '伦理', '成人', '三级', '激情', '情色', '里番', '无码']
bannedKeywords: process.env.BANNED_KEYWORDS?.split(',').filter((keyword) => keyword.trim()) || BANNED_KEYWORDS
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

空字符串会令禁用词列表退化为空数组

process.env.BANNED_KEYWORDS 若存在但内容为空 (''),split 结果为 ['']filter 后得到 [],从而覆盖默认值导致过滤逻辑失效。

-    bannedKeywords: process.env.BANNED_KEYWORDS?.split(',').filter((keyword) => keyword.trim()) || BANNED_KEYWORDS
+    bannedKeywords: (() => {
+        const envList = process.env.BANNED_KEYWORDS
+            ?.split(',')
+            .map((kw) => kw.trim())
+            .filter(Boolean);
+        return envList && envList.length ? envList : BANNED_KEYWORDS;
+    })()

这样既保留了运行时配置能力,又能在未设置或空值时安全回退。

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
bannedKeywords: process.env.BANNED_KEYWORDS?.split(',').filter((keyword) => keyword.trim()) || BANNED_KEYWORDS
bannedKeywords: (() => {
const envList = process.env.BANNED_KEYWORDS
?.split(',')
.map((kw) => kw.trim())
.filter(Boolean);
return envList && envList.length ? envList : BANNED_KEYWORDS;
})()
🤖 Prompt for AI Agents
In src/config/index.ts at line 24, the current code splits
process.env.BANNED_KEYWORDS and filters empty strings, but if BANNED_KEYWORDS is
an empty string, it results in an empty array overriding the default. To fix
this, check if process.env.BANNED_KEYWORDS is a non-empty string before
splitting and filtering; if it is empty or undefined, fallback to the default
BANNED_KEYWORDS array to ensure the filter logic remains effective.

@consistent-k consistent-k merged commit d195778 into main Jul 10, 2025
1 check passed
@consistent-k consistent-k deleted the dev branch July 10, 2025 15:25
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.

1 participant