Compare commits
No commits in common. "077b92be1d1daa1d4909f33619d26b1111c27c66" and "bfc23d4eb83dd9bf7d403fdcd9d5992f744d2a64" have entirely different histories.
077b92be1d
...
bfc23d4eb8
@ -1,15 +0,0 @@
|
||||
note:
|
||||
title: 注意
|
||||
class_name: notice--info
|
||||
tip:
|
||||
title: 提示
|
||||
class_name: notice--success
|
||||
important:
|
||||
title: 重要
|
||||
class_name: notice--primary
|
||||
warning:
|
||||
title: 警告
|
||||
class_name: notice--warning
|
||||
caution:
|
||||
title: 谨慎
|
||||
class_name: notice--danger
|
||||
@ -1,28 +1,25 @@
|
||||
---
|
||||
title: 服务端自动更新整合包制作教程
|
||||
excerpt: 创建可自动更新的服务器整合包
|
||||
date: 2021-08-22T23:18:02+08:00
|
||||
last_modified_at: 2025-12-06T09:37:00+08:00
|
||||
date: 2021-08-22 23:18:02 +0800
|
||||
author: huanghongxun
|
||||
---
|
||||
|
||||
HMCL 允许服务器管理员借助服务端自动更新整合包来实现自动分发整合包更新,这将大大方便有需要频繁更新游戏客户端 Mod、配置等信息的服务器管理员。
|
||||
|
||||
HMCL 需要服务器管理员额外提供一个 HTTP 服务器(只需要能提供静态文件服务,比如 Apache 和 Nginx 皆可)来提供检查整合包更新并允许 HMCL 下载更新文件。
|
||||
|
||||
## 第一步:导出整合包
|
||||
|
||||
在 HMCL 中右键做好的客户端版本,选择`导出整合包`:
|
||||
|
||||

|
||||

|
||||
|
||||
选择导出为`服务器自动更新整合包`:
|
||||
|
||||

|
||||

|
||||
|
||||
填写整合包信息,整合包下载链接前缀如何填写请看下文
|
||||
|
||||

|
||||

|
||||
|
||||
选择需要包含在整合包内的文件后将产生整合包压缩文件
|
||||
|
||||
@ -30,22 +27,21 @@ HMCL 需要服务器管理员额外提供一个 HTTP 服务器(只需要能提
|
||||
|
||||
接着创建一个全新的空文件夹,将启动器复制进去
|
||||
|
||||

|
||||

|
||||
|
||||
运行启动器,并导入刚才导出的整合包,导入完成后,这个文件夹(这里叫“新整合包”)可以打包发给玩家。
|
||||
|
||||
## 第三步:部署整合包更新服务器
|
||||
|
||||
## 第三步,部署整合包更新服务器
|
||||
你可以借助 Apache、Nginx 等支持静态文件的 HTTP 服务器软件提供文件。首先,决定好整合包下载链接前缀,比如我希望 HMCL 从远程服务器的 http://www.site.com/modpack 目录下存放整合包的更新信息,则在之前导出整合包的整合包下载前缀中填写 http://www.site.com/modpack。
|
||||
|
||||

|
||||

|
||||
|
||||
上图为导出的服务器自动更新整合包压缩文件的内容,你需要将这个整合包解压到 http://www.site.com/modpack 下。也就是说,从 http://www.site.com/modpack/server-manifest.json 这个链接下载下来的文件必须和上图中整合包压缩文件中的 server-manifest.json 文件一致,并且,http://www.site.com/modpack/overrides 是一个文件夹,里面存放了整合包文件,比如:
|
||||
|
||||

|
||||

|
||||
|
||||
整合包压缩文件 test.zip/overrides/mods/Advancement_Book-1.12-1.0.3.jar 文件必须可以从 http://www.site.com/modpack/overrides/mods/Advancement_Book-1.12-1.0.3.jar 该目录下载下来,且文件内容一致。那么至此更新服务器就部署完成了。
|
||||
|
||||
## 第四步:更新整合包
|
||||
## 第四步,更新整合包
|
||||
|
||||
如果你需要更新整合包,那么将新的整合包经过第一步导出新的整合包压缩文件,并解压到类似 http://www.site.com/modpack 文件夹下即可完成新整合包的部署。
|
||||
如果你需要更新整合包,那么将新的整合包经过第一步导出新的整合包压缩文件,并解压到类似 http://www.site.com/modpack 文件夹下即可完成新整合包的部署。
|
||||
@ -1,45 +0,0 @@
|
||||
require "nokogiri"
|
||||
|
||||
Jekyll::Hooks.register [:pages, :documents], :post_convert do |doc|
|
||||
next unless doc.output_ext == ".html"
|
||||
site = doc.site
|
||||
next unless site.data["plugins"]
|
||||
alert_type = site.data["plugins"]["auto_alert"]
|
||||
next unless alert_type
|
||||
|
||||
fragment = Nokogiri::HTML::DocumentFragment.parse(doc.content)
|
||||
# 遍历 HTML 中的所有 blockquote 标签
|
||||
fragment.css("blockquote").each do |item|
|
||||
# 找出第一个子节点,用于判断是否含有 [!type] 标记
|
||||
first_child = item.at_css("*:first-child")
|
||||
next unless first_child
|
||||
next unless first_child.name == "p"
|
||||
|
||||
text = first_child.text.downcase
|
||||
|
||||
# 遍历所有 alert 类型
|
||||
alert_type.each do |type, data|
|
||||
# 情况一:完整匹配 [!type] 形式 <p>[!NOTE]</p>
|
||||
if text == "[!#{type}]"
|
||||
# 将 alert 类型对应的 class 加入 blockquote
|
||||
item['class'] = [item['class'], data["class_name"]].compact.join(" ")
|
||||
|
||||
# 将 <p> 替换为 <div> 并插入标题
|
||||
first_child.name = "div"
|
||||
first_child.inner_html = "<strong>#{data["title"]}</strong>"
|
||||
break
|
||||
|
||||
# 情况二:段落以 [!type]\n 开头 <p>[!NOTE]\n\n other content</p>
|
||||
elsif text.start_with? "[!#{type}]\n"
|
||||
# 将 alert 类型对应的 class 加入 blockquote
|
||||
item['class'] = [item['class'], data["class_name"]].compact.join(" ")
|
||||
# 在原段落前插入标题 <div><strong>提示</strong></div><p>[!NOTE]\n\n other content</p>
|
||||
first_child.add_previous_sibling "<div><strong>#{data["title"]}</strong></div>"
|
||||
# 移除段落内容开头的 [!type]\n <div><strong>提示</strong></div><p>\n other content</p>
|
||||
first_child.content = first_child.content.sub(/\A#{Regexp.escape("[!#{type}]\n")}/i, "")
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
doc.content = fragment.to_html
|
||||
end
|
||||
BIN
assets/img/docs/serverpack/1-1.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
assets/img/docs/serverpack/1-2.png
Normal file
|
After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
BIN
assets/img/docs/serverpack/1.png
Normal file
|
After Width: | Height: | Size: 221 KiB |
|
Before Width: | Height: | Size: 152 KiB |
|
Before Width: | Height: | Size: 367 KiB |
|
Before Width: | Height: | Size: 71 KiB |
7
index.md
@ -13,8 +13,13 @@ author: wifi-left
|
||||
> You can also submit your suggestions here.
|
||||
<!----{{ '>' }}
|
||||
{: .notice--info }
|
||||
<!---->
|
||||
|
||||
<!--{% comment %}-->
|
||||
> [!NOTE]
|
||||
> <!--{% endcomment %}-->
|
||||
> <!----{{ '>' }} **注意** <br> {{ '<' }}!---->
|
||||
> 如果您遇到 BUG,请及时在 [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues) 发送反馈。\
|
||||
> 您也可以在这里提交您的建议。
|
||||
<!----{{ '>' }}
|
||||
{: .notice--info }
|
||||
<!---->
|
||||
|
||||