Skip to content

将原本在astro文件里的bangumi展示配置项放到config文件里面 - #511

Merged
CuteLeaf merged 3 commits into
CuteLeaf:masterfrom
Sonder9999:feat/bangumi-categories-config
Jul 22, 2026
Merged

CuteLeaf merged 3 commits into
CuteLeaf:masterfrom
Sonder9999:feat/bangumi-categories-config

Conversation

@Sonder9999

@Sonder9999 Sonder9999 commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Type of change

  • New feature (a non-breaking change that adds functionality)

Checklist

  • I have read the CONTRIBUTING document.
  • I have checked to ensure that this Pull Request is not for personal changes.
  • I have performed a self-review of my own code.
  • My changes generate no new warnings.

Changes

修改了

  • src/config/siteConfig.ts 添加example(已注释掉,如果需要禁用某一类别请取消注释)
  • src/pages/bangumi.astro 从配置文件读取
  • src/types/siteConfig.ts 添加是否显示类型为bool
// 控制各分类的启用状态(true/false),未指定的分类默认启用
// categories: {
// 	game: false, // 禁用游戏分类显示
// },

效果等同于直接改原本的src/pages/bangumi.astro文件,将categories.game:true->false

How To Test

如上取消注释掉src/config/siteConfig.ts里的categories即可

Screenshots (if applicable)

image

Additional Notes

其实就是把配置项放到了config里面,方便修改(bangumi里太多galgame不方便展示就想到取消展示game界面,不过config里面一直找不到)

Summary by Sourcery

通过共享站点配置,使 Bangumi 分类的可见性可配置。

新功能:

  • 允许通过 siteConfig 启用或禁用单个 Bangumi 分类,而不是在 bangumi 页面中将其硬编码。

改进:

  • 扩展 Bangumi 站点配置类型,添加可选的分类可见性标记,以支持新的可配置功能。
  • 明确导航栏子链接的注释,使其更好地反映实际用途。
Original summary in English

Summary by Sourcery

Make Bangumi category visibility configurable via the shared site configuration.

New Features:

  • Allow enabling or disabling individual Bangumi categories through siteConfig instead of hardcoding them in the bangumi page.

Enhancements:

  • Extend the Bangumi site configuration type with optional category visibility flags to support the new configurability.
  • Clarify nav bar child link comments to better reflect their purpose.

@netlify

netlify Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for demo-firefly ready!

Name Link
🔨 Latest commit 0977011
🔍 Latest deploy log https://app.netlify.com/projects/demo-firefly/deploys/6a5f69a73000d800087e3222
😎 Deploy Preview https://deploy-preview-511--demo-firefly.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sourcery-ai

sourcery-ai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

本次 PR 将 Bangumi 分类启用/禁用配置从 bangumi.astro 页面移到共享的站点配置中,为其添加了类型支持,并让 bangumi.astro 从该配置中读取设置,同时对导航栏的一条注释进行了轻微修正。

File-Level Changes

Change Details Files
Bangumi 页面现在从共享站点配置中读取分类启用/禁用标志,而不是使用硬编码的布尔值。
  • 用从 siteConfig.bangumi.categories 中查找值替换了硬编码的分类布尔值,使用空值合并运算符以保持现有默认值
  • 在配置缺失时保持默认值不变,以避免行为回归
  • 添加了一条行内注释,说明分类启用状态现在是从配置文件中读取的
src/pages/bangumi.astro
扩展了站点配置的类型定义和默认值,以支持 Bangumi 的可选分类启用/禁用标志。
  • 在 SiteConfig 的 Bangumi 部分添加了一个可选的 categories 对象,其中包含 book、anime、music、game 和 real 的布尔标志
  • 说明未显式配置的分类默认启用
  • 在具体的 siteConfig 中提供了一段被注释掉的示例 categories 配置块,展示如何禁用特定分类
src/types/siteConfig.ts
src/config/siteConfig.ts
调整导航栏配置中的注释,使其正确描述现有的链接预设。
  • 更新动态导航栏配置中的注释,以反映子项是 Friends 和 Guestbook,而不是之前的标签
  • 保持实际导航栏配置数据不变,以避免功能影响
src/config/navBarConfig.ts

Tips and commands

Interacting with Sourcery

  • 触发一次新评审: 在 pull request 中评论 @sourcery-ai review。
  • 继续讨论: 直接回复 Sourcery 的评审评论。
  • 从评审评论生成 GitHub Issue: 通过回复某条评审评论让 Sourcery 从该评论创建一个 Issue。也可以回复评审评论并写上 @sourcery-ai issue 来从该评论创建 Issue。
  • 生成 pull request 标题: 在 pull request 标题中任意位置写入 @sourcery-ai 即可随时生成标题。也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 内容中任意位置写入 @sourcery-ai summary,即可在指定位置生成 PR 摘要。也可以在 pull request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成评审者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成评审者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 忽略所有 Sourcery 评审: 在 pull request 中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 评审。如果你想从一次新的评审重新开始,这尤其有用——别忘了再评论 @sourcery-ai review 来触发新的评审!

Customizing Your Experience

访问你的 dashboard 以:

  • 启用或禁用评审功能,例如 Sourcery 自动生成的 pull request 摘要、评审者指南等。
  • 更改评审语言。
  • 添加、删除或编辑自定义评审说明。
  • 调整其他评审设置。

Getting Help

Original review guide in English

Reviewer's Guide

This PR moves Bangumi category enable/disable configuration out of the bangumi.astro page into the shared site config, adds typing support for it, and wires bangumi.astro to read from this config while also making a minor nav bar comment correction.

File-Level Changes

Change Details Files
Bangumi page now reads category enable/disable flags from the shared site configuration instead of hard-coded booleans.
  • Replaced hard-coded category booleans with lookups from siteConfig.bangumi.categories using nullish coalescing operators to preserve existing defaults
  • Left default values unchanged when configuration is absent to avoid behavioral regressions
  • Added an inline comment clarifying that category enablement is now read from the configuration file
src/pages/bangumi.astro
Extended site configuration typings and defaults to support optional category enable/disable flags for Bangumi.
  • Added an optional categories object to the Bangumi section of SiteConfig with boolean flags for book, anime, music, game, and real
  • Documented that unspecified categories default to enabled
  • Provided a commented-out example categories block in the concrete siteConfig showing how to disable specific categories
src/types/siteConfig.ts
src/config/siteConfig.ts
Adjusted nav bar configuration comments to correctly describe existing link presets.
  • Updated comments in the dynamic nav bar config to reflect that children entries are Friends and Guestbook rather than the previous labels
  • Left the actual nav configuration data unchanged to avoid functional impact
src/config/navBarConfig.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot 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.

Hey - 我发现了 1 个问题,并给出了一些整体反馈:

  • BangumiConfig.bangumi.categories 上的注释说明未设置的分类默认启用,但在 bangumi.astro 中,real 的默认值是 false;建议统一默认值,或者调整注释以避免产生混淆。
  • navBarConfig.ts 中对评论标签的修改与将 Bangumi 显示设置迁移到配置中无关;建议将这些更改拆分到单独的 PR 中,以保持本次修改范围聚焦。
供 AI 代理使用的提示词
Please address the comments from this code review:

## Overall Comments
- The comment on `BangumiConfig.bangumi.categories` says unset categories default to enabled, but `real` is defaulted to `false` in `bangumi.astro`; consider aligning the default value or adjusting the comment to avoid confusion.
- The changes to comment labels in `navBarConfig.ts` are unrelated to moving Bangumi display settings into config; consider splitting those into a separate PR to keep the scope focused.

## Individual Comments

### Comment 1
<location path="src/types/siteConfig.ts" line_range="154-160" />
<code_context>
 		apiUrl?: string; // Bangumi API 地址
 		subjectBaseUrl?: string; // 条目详情页地址
 		categoryOrder?: ("anime" | "game" | "book" | "music" | "real")[]; // 条目类型排序顺序
+		// 各分类的显示启用状态,未设置时默认启用
+		categories?: {
+			book?: boolean;
+			anime?: boolean;
+			music?: boolean;
+			game?: boolean;
+			real?: boolean;
+		};
 	};
</code_context>
<issue_to_address>
**issue (bug_risk):** The doc comment says categories default to enabled, but `real` is actually defaulted to disabled in `bangumiConfig`.

In `bangumi.astro`, `real` resolves to `siteConfig.bangumi?.categories?.real ?? false`, so when `real` is not set it is disabled, contradicting the comment’s "未设置时默认启用". Please either update the comment to mention the special-case default for `real`, or change the default in `bangumiConfig` to `true` to match the documented behavior.
</issue_to_address>

Sourcery 对开源项目免费——如果你觉得我们的代码评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • The comment on BangumiConfig.bangumi.categories says unset categories default to enabled, but real is defaulted to false in bangumi.astro; consider aligning the default value or adjusting the comment to avoid confusion.
  • The changes to comment labels in navBarConfig.ts are unrelated to moving Bangumi display settings into config; consider splitting those into a separate PR to keep the scope focused.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The comment on `BangumiConfig.bangumi.categories` says unset categories default to enabled, but `real` is defaulted to `false` in `bangumi.astro`; consider aligning the default value or adjusting the comment to avoid confusion.
- The changes to comment labels in `navBarConfig.ts` are unrelated to moving Bangumi display settings into config; consider splitting those into a separate PR to keep the scope focused.

## Individual Comments

### Comment 1
<location path="src/types/siteConfig.ts" line_range="154-160" />
<code_context>
 		apiUrl?: string; // Bangumi API 地址
 		subjectBaseUrl?: string; // 条目详情页地址
 		categoryOrder?: ("anime" | "game" | "book" | "music" | "real")[]; // 条目类型排序顺序
+		// 各分类的显示启用状态,未设置时默认启用
+		categories?: {
+			book?: boolean;
+			anime?: boolean;
+			music?: boolean;
+			game?: boolean;
+			real?: boolean;
+		};
 	};
</code_context>
<issue_to_address>
**issue (bug_risk):** The doc comment says categories default to enabled, but `real` is actually defaulted to disabled in `bangumiConfig`.

In `bangumi.astro`, `real` resolves to `siteConfig.bangumi?.categories?.real ?? false`, so when `real` is not set it is disabled, contradicting the comment’s "未设置时默认启用". Please either update the comment to mention the special-case default for `real`, or change the default in `bangumiConfig` to `true` to match the documented behavior.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/types/siteConfig.ts
Comment on lines +154 to +160
// 各分类的显示启用状态,未设置时默认启用
categories?: {
book?: boolean;
anime?: boolean;
music?: boolean;
game?: boolean;
real?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): 文档注释说明分类在未设置时默认启用,但在 bangumiConfig 中,real 实际上是默认禁用的。

在 bangumi.astro 中,real 的取值为 siteConfig.bangumi?.categories?.real ?? false,因此当 real 未设置时会被视为禁用,这与注释中“未设置时默认启用”的描述相矛盾。请更新注释以说明 real 的特殊默认值,或者将 bangumiConfig 中的默认值改为 true,以与文档说明保持一致。

Original comment in English

issue (bug_risk): The doc comment says categories default to enabled, but real is actually defaulted to disabled in bangumiConfig.

In bangumi.astro, real resolves to siteConfig.bangumi?.categories?.real ?? false, so when real is not set it is disabled, contradicting the comment’s "未设置时默认启用". Please either update the comment to mention the special-case default for real, or change the default in bangumiConfig to true to match the documented behavior.

@Sonder9999

Copy link
Copy Markdown
Contributor Author

fix: 修复navBar配置项中文注释错误 这个已经在#509 merge了,忽略即可

@CuteLeaf
CuteLeaf merged commit b74ce19 into CuteLeaf:master Jul 22, 2026
10 checks passed
Jinging27 pushed a commit to Jinging27/Firefly that referenced this pull request Aug 10, 2026
* fix: 修复navBar配置项中文注释错误

* feat: 将原本在astro里面的bangumi条目开关转移到config,方便配置
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