-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
v7.3.2 #904
Conversation
修复 hash 气泡被覆盖的问题
Bumps org.apache.james:apache-mime4j-storage from 0.8.11 to 0.8.12. --- updated-dependencies: - dependency-name: org.apache.james:apache-mime4j-storage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps org.apache.james:apache-mime4j-dom from 0.8.11 to 0.8.12. --- updated-dependencies: - dependency-name: org.apache.james:apache-mime4j-dom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps org.apache.james:apache-mime4j-core from 0.8.11 to 0.8.12. --- updated-dependencies: - dependency-name: org.apache.james:apache-mime4j-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps [org.bspfsystems:yamlconfiguration](https://github.com/bspfsystems/YamlConfiguration) from 3.0.1 to 3.0.2. - [Release notes](https://github.com/bspfsystems/YamlConfiguration/releases) - [Commits](bspfsystems/YamlConfiguration@v3.0.1...v3.0.2) --- updated-dependencies: - dependency-name: org.bspfsystems:yamlconfiguration dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
…s-apache-mime4j-storage-0.8.12 Bump org.apache.james:apache-mime4j-storage from 0.8.11 to 0.8.12
…-yamlconfiguration-3.0.2 Bump org.bspfsystems:yamlconfiguration from 3.0.1 to 3.0.2
…s-apache-mime4j-core-0.8.12 Bump org.apache.james:apache-mime4j-core from 0.8.11 to 0.8.12
…s-apache-mime4j-dom-0.8.12 Bump org.apache.james:apache-mime4j-dom from 0.8.11 to 0.8.12
""" 变更概述工作流程这个拉取请求主要包含对 GitHub Actions 工作流程文件、项目依赖、数据库处理和前端组件的多个更新。主要变更包括更新 Docker 构建操作版本、项目版本和依赖版本,以及对数据库实体和 JSON 序列化处理的修改。 变更
可能相关的拉取请求
建议的审阅者
备注这次变更涉及多个系统层面的小更新,包括工作流程、依赖管理、数据库处理和前端错误处理。主要目的似乎是升级依赖版本、改进错误处理和优化数据持久化机制。 Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/main/java/com/ghostchu/peerbanhelper/util/json/TranslationComponentTypeAdapter.java (1)
34-34
: 建议将注释翻译为英文为了保持代码的一致性和国际化,建议将注释翻译为英文。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
.github/workflows/jvm-ci.yml
(2 hunks).github/workflows/jvm-release.yml
(2 hunks).gitignore
(1 hunks)pom.xml
(5 hunks)src/main/java/com/ghostchu/peerbanhelper/database/DatabaseHelper.java
(1 hunks)src/main/java/com/ghostchu/peerbanhelper/database/table/AlertEntity.java
(2 hunks)src/main/java/com/ghostchu/peerbanhelper/downloader/impl/qbittorrent/AbstractQbittorrent.java
(0 hunks)src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHPeerController.java
(2 hunks)src/main/java/com/ghostchu/peerbanhelper/util/json/JsonUtil.java
(2 hunks)src/main/java/com/ghostchu/peerbanhelper/util/json/TranslationComponentTypeAdapter.java
(1 hunks)webui/src/stores/endpoint.ts
(1 hunks)webui/src/views/banlist/components/banListItem.vue
(1 hunks)
💤 Files with no reviewable changes (1)
- src/main/java/com/ghostchu/peerbanhelper/downloader/impl/qbittorrent/AbstractQbittorrent.java
✅ Files skipped from review due to trivial changes (3)
- .gitignore
- .github/workflows/jvm-ci.yml
- .github/workflows/jvm-release.yml
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Build_SPK / pkgcreate
- GitHub Check: Build_Installers / install4jc
- GitHub Check: Build_Docker
🔇 Additional comments (9)
pom.xml (3)
9-9
: 版本号更新符合预期!版本号从 7.3.1 升级到 7.3.2 的更新符合语义化版本规范,与此 PR 修复错误的目标相符。
261-261
: 建议验证 yamlconfiguration 依赖更新的兼容性yamlconfiguration 依赖从 3.0.1 升级到 3.0.2,这是一个次要版本更新。
请运行以下脚本验证新版本的变更内容和兼容性:
401-401
: Apache MIME4J 组件更新合理apache-mime4j-dom、apache-mime4j-core 和 apache-mime4j-storage 从 0.8.11 升级到 0.8.12 是补丁版本更新,风险较低。
运行以下脚本检查更新内容:
Also applies to: 412-412, 423-423
src/main/java/com/ghostchu/peerbanhelper/util/json/JsonUtil.java (1)
3-3
: 成功注册 TranslationComponent 的 TypeAdapter此更改正确地在
GsonBuilder
中注册了TranslationComponent
的TypeAdapter
,有助于序列化和反序列化操作。Also applies to: 17-17
src/main/java/com/ghostchu/peerbanhelper/database/DatabaseHelper.java (1)
78-82
: 数据库升级逻辑看起来没有问题这个升级逻辑遵循了已建立的模式,通过删除和重建 AlertEntity 表来确保数据结构的一致性。
建议运行以下脚本来验证是否有其他地方引用了 AlertEntity 表的旧结构:
✅ Verification successful
数据库升级操作验证完成,确认安全
经过详细检查,AlertEntity 表的删除和重建操作是安全的:
- 所有相关代码都使用标准字段访问
- 没有发现复杂的表关系或外键依赖
- DAO 层的操作都是基础的 CRUD,不涉及特殊查询
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 搜索可能引用 AlertEntity 表结构的代码 rg -l "AlertEntity" | grep -v "DatabaseHelper.java"Length of output: 344
Script:
#!/bin/bash # Check AlertEntity class structure and its usage echo "=== AlertEntity.java ===" cat src/main/java/com/ghostchu/peerbanhelper/database/table/AlertEntity.java echo -e "\n=== AlertDao.java ===" cat src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/AlertDao.java echo -e "\n=== Usage in AlertManager ===" rg -A 5 "AlertEntity" src/main/java/com/ghostchu/peerbanhelper/alert/AlertManager.java echo -e "\n=== Usage in Controller ===" rg -A 5 "AlertEntity" src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHAlertController.javaLength of output: 5996
webui/src/stores/endpoint.ts (1)
213-214
: 登录错误处理得到了改进添加了对 HTTP 401 状态码的处理,使未授权访问的错误处理更加完整和一致。
webui/src/views/banlist/components/banListItem.vue (1)
139-139
: UI 改进:优化了工具提示的位置通过添加 position="bottom" 属性,使工具提示的显示位置更加合理和一致。
src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHPeerController.java (2)
156-156
: 改进了 IP 地址的标准化处理使用 toNormalizedString() 来确保 IP 地址格式的一致性,这对于 IPv6 地址的处理尤其重要。
171-171
: 保持了一致的 IP 地址标准化处理在 handleAccessHistory 方法中同样使用了 toNormalizedString(),保持了代码的一致性。
src/main/java/com/ghostchu/peerbanhelper/util/json/TranslationComponentTypeAdapter.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ghostchu/peerbanhelper/database/table/AlertEntity.java
Show resolved
Hide resolved
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/com/ghostchu/peerbanhelper/util/json/TranslationComponentTypeAdapter.java (1)
17-35
: 建议增加空值检查和异常处理当前实现逻辑清晰,但建议做以下改进:
- 在方法开始时增加对
value
的空值检查- 在
param.toString()
之前增加对param
的空值检查- 考虑捕获并处理可能的异常,确保序列化过程更加稳健
建议的代码修改:
public void write(JsonWriter out, TranslationComponent value) throws IOException { + if (value == null) { + out.nullValue(); + return; + } out.beginObject(); out.name("key").value(value.getKey()); out.name("params"); out.beginArray(); for (Object param : value.getParams()) { + if (param == null) { + out.nullValue(); + continue; + } if (param instanceof TranslationComponent) { TranslationComponentTypeAdapter.INSTANCE.write(out, (TranslationComponent) param); } else { out.value(param.toString()); } } out.endArray(); out.endObject(); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/ghostchu/peerbanhelper/util/json/TranslationComponentTypeAdapter.java
(1 hunks)
🔇 Additional comments (1)
src/main/java/com/ghostchu/peerbanhelper/util/json/TranslationComponentTypeAdapter.java (1)
4-13
: 类型适配器的改进实现!将
JsonSerializer
改为TypeAdapter
是一个很好的改进,现在可以同时处理序列化和反序列化操作。导入的类也都是必要且合适的。
src/main/java/com/ghostchu/peerbanhelper/util/json/TranslationComponentTypeAdapter.java
Show resolved
Hide resolved
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/HistoryDao.java (2)
52-54
: 建议提取分页参数为常量当前实现正确且清晰,建议将分页相关的计算提取为可重用的工具方法,以提高代码的可维护性。
+ private static final String ORDER_BY_COUNT_DESC = "count DESC"; + public Page<PeerBanCount> getBannedIps(Pageable pageable, String filter) throws Exception { var builder = queryBuilder() .selectRaw("ip, COUNT(*) AS count") .groupBy("ip") - .orderByRaw("count DESC"); + .orderByRaw(ORDER_BY_COUNT_DESC);
55-56
: 建议增加结果集的空值处理当前的实现在处理查询结果时可能需要增加额外的防御性编程。建议添加对空值的处理,以提高代码的健壮性。
List<PeerBanCount> mapped; try (GenericRawResults<String[]> banLogs = queryRaw(queryBuilder.prepareStatementString(), args)) { var results = banLogs.getResults(); - mapped = results.stream().map(arr -> new PeerBanCount(arr[0], Long.parseLong(arr[1]))).toList(); + mapped = results.stream() + .filter(arr -> arr != null && arr.length >= 2 && arr[0] != null) + .map(arr -> new PeerBanCount(arr[0], Long.parseLong(arr[1]))) + .toList(); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/com/ghostchu/peerbanhelper/PeerBanHelperServer.java
(1 hunks)src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/HistoryDao.java
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/main/java/com/ghostchu/peerbanhelper/PeerBanHelperServer.java
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Build_PKG / pkg (14.1)
- GitHub Check: Build_Installers / install4jc
- GitHub Check: Build_PKG / pkg (13.4)
- GitHub Check: Build_SPK / pkgcreate
- GitHub Check: Build_DEB / dpkg
- GitHub Check: Build_Docker
- GitHub Check: Analyze (java-kotlin)
- GitHub Check: Build_Docker_Standalone
🔇 Additional comments (2)
src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/HistoryDao.java (2)
47-50
: 改进了参数化查询的处理!通过将过滤条件作为参数传递而不是直接拼接到SQL中,提高了代码的安全性,同时也解决了IPv6地址中特殊字符的处理问题。
47-56
: 整体实现符合预期且安全性得到提升代码变更很好地解决了IPv6地址搜索的问题,同时通过使用参数化查询提高了安全性。建议考虑添加单元测试以验证IPv6地址的各种场景。
建议执行以下测试脚本来验证IPv6相关的改动:
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.
记得修改install4j的版本号
v7.3.2 是 v7.3.0 的一个补丁,有关 v7.3.0 的主要更新内容,请参见 v7.3.0 更新日志。
发布日期的近 3 天内的其它次要更新:
错误修复
Docker
DockerHub:
ghostchu/peerbanhelper:v7.3.2
阿里云国内镜像加速:
registry.cn-hangzhou.aliyuncs.com/ghostchu/peerbanhelper:v7.3.2