[Feature] 模组等的更新日志以及 HTMLRenderer 的完善#4828
Conversation
|
我把那些语言的删了,以后再加吧 |
cfa9377 to
36c6661
Compare
# 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
552a13d to
c9c7ea5
Compare
# Conflicts: # HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java
|
现在对 Markdown 里面的裸超链接还没有进行支持,是否应该支持? |
# Conflicts: # HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java
Outdated
Show resolved
Hide resolved
|
|
||
| Button changelogButton = new JFXButton(i18n("mods.changelog")); | ||
| changelogButton.getStyleClass().add("dialog-accept"); | ||
| loadChangelog(version, selfPage.repository, changelogButton); |
There was a problem hiding this comment.
为什么要在 HMCL 里渲染这个更新日志?我没有看出必要性。我认为点击按钮后在浏览器里查看就可以了,不需要在 HMCL 内解析渲染它。
There was a problem hiding this comment.
为什么要在 HMCL 里渲染这个更新日志?我没有看出必要性。我认为点击按钮后在浏览器里查看就可以了,不需要在 HMCL 内解析渲染它。
说实话,如果你一开始就是这么想的话,就应该早一点,在去年 11 月 PR 提交后的一段时间里就提出,而不是在 PR 滞留数月,甚至分配给 Copilot 审核的几周后,又给出这个结论。
这个 PR 一开始的目标就是「在 HMCL 内展示 (即渲染) 更新日志」。在今年的一月我还抽时间看了十几个模组、资源包等的实际渲染情况。你可以看中间的对话记录 (默认应该是折叠的)。
如果你之前能够早点提出这个意见,那或许这个 PR 就此结案,不会白白花时间完善之后又滞留数月、不知道命运如何;或者早期沟通后你改变主意,然后 PR 等到今年差不多也顺利合并了。
There was a problem hiding this comment.
为什么要在 HMCL 里渲染这个更新日志?我没有看出必要性。我认为点击按钮后在浏览器里查看就可以了,不需要在 HMCL 内解析渲染它。
为什么这么在意“必要性”?给用户更方便的体验不是很好吗
There was a problem hiding this comment.
为什么这么在意“必要性”?给用户更方便的体验不是很好吗
关键我也不觉得在 HMCL 里显示这个会更方便。我认为这个是低频操作,本身对用户体验的影响不大,而且浏览器窗口通常更大,看这些日志类内容本身就更舒服。
There was a problem hiding this comment.
关键我也不觉得在 HMCL 里显示这个会更方便。我认为这个是低频操作,本身对用户体验的影响不大,而且浏览器窗口通常更大,看这些日志类内容本身就更舒服。
浏览器里打开的话确实看着舒服,但是现在国内访问 Modrinth 和 CF 都会卡好半天才加载好,体验远不如 HMCL 几乎瞬间渲染完成。更何况看更新日志注重的是内容,能快速而清晰地看到更新内容是远比打开浏览器方便的。
至于“低频操作”,好像真的无所谓吧。能满足少数人(比如我自己)的需求而不会影响大部队的使用体验,为什么不是好事呢?
There was a problem hiding this comment.
2026-03-30.21.38.50.mov
2026-03-30.21.39.26.mov
对比:上面是打开modrinth官方页面查看更新日志的速度,下面是hmcl里加载并渲染更新日志的速度。
个人认为这足以证明这个功能是比打开浏览器看方便的。
更何况这里还是浏览器已经打开的状态。就以现在各大浏览器的臃肿程度来说,启动还得用加个一两秒时间。
# Conflicts: # HMCLCore/build.gradle.kts
# Conflicts: # HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java # HMCL/src/main/resources/assets/css/root.css
|
我不太理解这个 PR 不合并的点在哪。 而且,目前已经有一些启动器,可以展示更新日志,如 XMCL——它使用 Electron,所以对于它而言是「顺手的事」。 此外我同意 Calboot 说的,
何乐而不为呢? |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 917d7d9586
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/modrinth/ModrinthRemoteModRepository.java
Show resolved
Hide resolved
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java
Outdated
Show resolved
Hide resolved
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java
Outdated
Show resolved
Hide resolved
# Conflicts: # HMCL/src/main/resources/assets/about/deps.json
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive system for displaying mod changelogs and external URLs within the launcher. It adds Markdown-to-HTML conversion using the CommonMark library, enhances the HTMLRenderer to support tables, lists, and code blocks, and integrates these features into the mod download and update pages. Key improvements include a new changelog cache, confirmation dialogs for opening external links, and updated repository interfaces to fetch changelog data from CurseForge and Modrinth. Feedback highlights the need for proper equals/hashCode implementations in the Version class to ensure cache hits, fixing style inheritance in the HTML renderer, and improving the rendering of inline code and table content.
HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringUtils.java
Outdated
Show resolved
Hide resolved
| AutolinkExtension.create(), InsExtension.create(), StrikethroughExtension.create(), TablesExtension.create() | ||
| )).build(); | ||
|
|
||
| public static String convertToHtml(String md) { |
There was a problem hiding this comment.
有必要把 Markdown 转成 HTML 再渲染吗?直接写 Markdown 的渲染器更合适吧?
There was a problem hiding this comment.
两个标记语言写两套完全不同的渲染器感觉没啥好处吧
| } | ||
| } | ||
|
|
||
| public static HTMLRenderer openHyperlinkInBrowser() { |
There was a problem hiding this comment.
我从这个命名中看不出它会返回一个 HTMLRenderer 实例。
我认为不应该提供这样的方法,还是显式 new 更能体现出每次调用方法都返回了一个新的 HTMLRenderer 实例。
| openUriInBrowser(uri.toString()); | ||
| } | ||
|
|
||
| public static void openUriInBrowser(String uri) { |
There was a problem hiding this comment.
这些东西应该放在 Controllers 里,而不是 FXUtils 里。
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java
Outdated
Show resolved
Hide resolved
|
|
||
| if (downloadButton == null) { | ||
| this.setActions(saveAsButton, cancelButton); | ||
| this.setActions(versionPageBtn, changelogButton, saveAsButton, cancelButton); |
There was a problem hiding this comment.
考虑把这些链接样式的按钮拆分到单独一行上,不要和 downloadButton、saveAsButton 还有 cancelButton 在一行里抢地方了。
|
|
||
| JFXHyperlink changelogButton = new JFXHyperlink(i18n("mods.changelog")); | ||
| changelogButton.setDisable(true); | ||
| loadChangelog(version, selfPage.repository, changelogButton); |
There was a problem hiding this comment.
在点击按钮后再触发加载更合适?大部分时候用户不需要查看更新日志,我认为没有必要为此发起网络请求,给服务器造成没有必要的开销。
| applyStyle(textNode); | ||
| children.add(textNode); | ||
| if (code) { | ||
| var codeFlow = new TextFlow(textNode); |
There was a problem hiding this comment.
有的很长的不用textflow就没办法换行了,而需不需要换行并不是很容易判断的事
|
|
||
| String style = node.attr("style"); | ||
| if (StringUtils.isNotBlank(style)) { | ||
| styleBuilder.append(StringUtils.addSuffix( |
There was a problem hiding this comment.
不应该这么简单地处理 CSS 样式,我们可能需要实现更完整的 CSS 解析。
添加了下载模组、数据包等以及更新模组时显示更新日志的功能
Resolves #4685
具体变化:
HTMLRenderer的优化与完善,以及对 Markdown 的支持(引入了新依赖)TODO:
依赖 #5463