Skip to content

[Feature] 模组等的更新日志以及 HTMLRenderer 的完善#4828

Open
Calboot wants to merge 101 commits intoHMCL-dev:mainfrom
Calboot:mod-changelog
Open

[Feature] 模组等的更新日志以及 HTMLRenderer 的完善#4828
Calboot wants to merge 101 commits intoHMCL-dev:mainfrom
Calboot:mod-changelog

Conversation

@Calboot
Copy link
Contributor

@Calboot Calboot commented Nov 19, 2025

添加了下载模组、数据包等以及更新模组时显示更新日志的功能
Resolves #4685

具体变化:

  • 以下载模组为例,在原来仅用作展示模组依赖项的页面中同时展示该版本更新日志并可跳转到版本发布界面
  • 检查模组更新之后的表格中在最右侧添加“更新日志”列,点击单元格即可打开更新日志并可跳转到版本发布界面
  • 添加打开链接页面的“复制”按钮
  • HTMLRenderer 的优化与完善,以及对 Markdown 的支持(引入了新依赖)

TODO:

  • 添加下载时的更新日志
  • 添加更新模组时的更新日志
  • 给上述功能添加多语言支持
  • HTML
  • Markdown
  • Cache

依赖 #5463

@Calboot Calboot marked this pull request as ready for review November 21, 2025 10:06
@Calboot Calboot marked this pull request as draft November 21, 2025 10:31
可能不准确不地道,需要熟悉这些语言的人验证
@Calboot Calboot marked this pull request as ready for review November 21, 2025 10:44
@Calboot
Copy link
Contributor Author

Calboot commented Nov 21, 2025

需要能读懂日语、俄语、乌克兰语、西班牙语的人来审核一下语言文件

我把那些语言的删了,以后再加吧

@Calboot Calboot changed the title 添加模组、资源包、光影包、世界、整合包的更新日志 feat: 模组、资源包、光影包、世界、整合包的更新日志 Nov 22, 2025
@Calboot Calboot changed the title feat: 模组、资源包、光影包、世界、整合包的更新日志 [Feature]: 模组、资源包、光影包、世界、整合包的更新日志 Nov 25, 2025
@Calboot Calboot changed the title [Feature]: 模组、资源包、光影包、世界、整合包的更新日志 [Feature] 模组、资源包、光影包、世界、整合包的更新日志 Nov 25, 2025
# Conflicts:
#	HMCL/src/main/resources/assets/lang/I18N.properties
#	HMCL/src/main/resources/assets/lang/I18N_es.properties
#	HMCL/src/main/resources/assets/lang/I18N_ja.properties
#	HMCL/src/main/resources/assets/lang/I18N_lzh.properties
#	HMCL/src/main/resources/assets/lang/I18N_ru.properties
#	HMCL/src/main/resources/assets/lang/I18N_uk.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
@Calboot Calboot marked this pull request as draft December 13, 2025 06:43
@Calboot Calboot marked this pull request as ready for review December 13, 2025 07:03
@Calboot
Copy link
Contributor Author

Calboot commented Dec 13, 2025

现在对 Markdown 里面的裸超链接还没有进行支持,是否应该支持?

@Calboot
Copy link
Contributor Author

Calboot commented Jan 28, 2026

#4828 (comment) solved

Copy link
Contributor

@3gf8jv4dv 3gf8jv4dv left a comment

Choose a reason for hiding this comment

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

:shipit:

# Conflicts:
#	HMCL/src/main/resources/assets/css/root.css
# Conflicts:
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java
# Conflicts:
#	HMCL/src/main/resources/assets/css/root.css
# Conflicts:
#	HMCL/src/main/resources/assets/css/root.css
#	HMCL/src/main/resources/assets/lang/I18N_lzh.properties
# Conflicts:
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 为模组/数据包等下载与更新流程新增“更新日志”展示能力,并完善 HTMLRenderer 以支持更丰富的 HTML/Markdown 渲染,同时补充“打开链接”对话框的复制按钮与多语言文案(关联 #4685,依赖 #5463)。

Changes:

  • 引入 CommonMark(含扩展)以支持将 Markdown 更新日志转换为 HTML,并在 UI 中渲染展示。
  • 扩展 RemoteModRepository:新增 changelog 拉取与版本发布页 URL 生成能力;Modrinth/CurseForge 实现落地,并在下载/更新页面接入。
  • 完善 HTMLRenderer/FXUtils:支持更多元素(如表格、代码样式等),并统一“打开链接”到浏览器的交互(含复制按钮)与样式资源。

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
gradle/libs.versions.toml 增加 commonmark 相关版本与依赖坐标
HMCLCore/build.gradle.kts HMCLCore 引入 commonmark 及扩展依赖
HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringUtils.java 新增 Markdown→HTML 转换、HTML 检测、空白处理与空白规范化
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/RemoteModRepository.java 新增 API/Base URL、changelog 获取、版本页 URL 接口
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/RemoteMod.java RemoteMod.Version 增加 versionId 字段以支撑版本页/日志拉取
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/modrinth/ModrinthRemoteModRepository.java 实现 changelog 获取与版本页 URL 生成;补全 versionId
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseForgeRemoteModRepository.java 实现 changelog 获取与版本页 URL 生成;补充分类常量
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseAddon.java 构造 RemoteMod.Version 时补全 versionId
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/LocalModFile.java ModUpdate 增加 repository 引用供 UI 拉取日志/链接
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java 下载版本详情对话框新增“更新日志/版本页”入口与缓存
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java 更新检查表格新增“更新日志”列与弹窗展示
HMCL/src/main/java/org/jackhuang/hmcl/ui/HTMLRenderer.java 渲染器增强(代码、表格、图片异步等)并提供默认打开链接行为
HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java 新增 changelog 渲染辅助与“打开链接”对话框(含复制)
HMCL/src/main/java/org/jackhuang/hmcl/ui/WebPage.java 改用 HTMLRenderer.openHyperlinkInBrowser() 统一链接行为
HMCL/src/main/resources/assets/css/root.css 新增 changelog 与代码块样式
HMCL/src/main/resources/assets/about/deps.json 增加 CommonMark 依赖信息展示
HMCL/src/main/resources/assets/lang/I18N*.properties 增加 button.copymods.changelog 等文案(部分语言)
HMCL/src/main/java/org/jackhuang/hmcl/game/LocalizedRemoteModRepository.java 转发新增的 repository 接口方法

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import static org.jackhuang.hmcl.util.i18n.I18n.i18n;

public class DownloadPage extends Control implements DecoratorPage {
private static final WeakHashMap<RemoteMod.Version, String> changelogCache = new WeakHashMap<>();
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

changelogCache is a plain WeakHashMap accessed from background tasks and the JavaFX thread. WeakHashMap is not thread-safe; concurrent access can corrupt the map or throw at runtime. Wrap it with Collections.synchronizedMap(...) or use another thread-safe caching approach.

Suggested change
private static final WeakHashMap<RemoteMod.Version, String> changelogCache = new WeakHashMap<>();
private static final Map<RemoteMod.Version, String> changelogCache =
Collections.synchronizedMap(new WeakHashMap<>());

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Glavo CC
这个有必要吗

Comment on lines +590 to +594
public static String convertToHtml(String md) {
if (md == null) return null;
if (isHtml(md)) return md;
return HTML_RENDERER.render(MD_PARSER.parse(md));
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

convertToHtml/nullIfBlank introduce new parsing/normalization behavior, but there are no corresponding unit tests added here. Since StringUtils already has test coverage in the codebase, please add tests for: (1) blank inputs, (2) HTML passthrough vs Markdown conversion, and (3) expected extension rendering (tables/strikethrough/underline).

Copilot uses AI. Check for mistakes.
Copy link
Contributor 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.

[Feature] 更新模组时获取更新日志

3 participants

Comments