-
Notifications
You must be signed in to change notification settings - Fork 911
修复使用 Deb 安装时仍会提示更新的问题 & 支持手动禁用更新 & 支持在非官方版本显示更新已被禁用 #6174
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
Changes from all commits
ee9df60
c1d67dc
dcd86c2
533a332
dcdc4ea
75ced0a
a19d3fc
0fd2d98
a99e09c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |||||||||
| import javafx.beans.property.*; | ||||||||||
| import javafx.beans.value.ObservableBooleanValue; | ||||||||||
| import org.jackhuang.hmcl.Metadata; | ||||||||||
| import org.jackhuang.hmcl.util.StringUtils; | ||||||||||
| import org.jackhuang.hmcl.util.io.NetworkUtils; | ||||||||||
| import org.jackhuang.hmcl.util.versioning.VersionNumber; | ||||||||||
|
|
||||||||||
|
|
@@ -37,6 +38,10 @@ public final class UpdateChecker { | |||||||||
| private UpdateChecker() { | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public static final String PACKAGE_MANAGER_PROPERTY = System.getProperty("hmcl.update.packageManager", ""); | ||||||||||
| public static final String DISABLE_UPDATE_PROPERTY = System.getProperty("hmcl.update.disable", ""); | ||||||||||
|
Comment on lines
+41
to
+42
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 配合
Suggested change
|
||||||||||
| public static final boolean SHOULD_CHECK_UPDATE = shouldCheckUpdate(); | ||||||||||
|
|
||||||||||
| private static final ObjectProperty<RemoteVersion> latestVersion = new SimpleObjectProperty<>(); | ||||||||||
| private static final BooleanBinding outdated = Bindings.createBooleanBinding( | ||||||||||
| () -> { | ||||||||||
|
|
@@ -55,6 +60,12 @@ private UpdateChecker() { | |||||||||
| latestVersion); | ||||||||||
| private static final ReadOnlyBooleanWrapper checkingUpdate = new ReadOnlyBooleanWrapper(false); | ||||||||||
|
|
||||||||||
| private static boolean shouldCheckUpdate() { | ||||||||||
| if (DISABLE_UPDATE_PROPERTY.equalsIgnoreCase("true")) return false; | ||||||||||
| else if (StringUtils.isNotBlank(PACKAGE_MANAGER_PROPERTY)) return false; | ||||||||||
| else return IntegrityChecker.DISABLE_SELF_INTEGRITY_CHECK || IntegrityChecker.isSelfVerified(); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public static void init() { | ||||||||||
| requestCheckUpdate(UpdateChannel.getChannel(), settings().acceptPreviewUpdateProperty().get()); | ||||||||||
| } | ||||||||||
|
|
@@ -102,6 +113,8 @@ private static boolean isDevelopmentVersion(String version) { | |||||||||
| } | ||||||||||
|
|
||||||||||
| public static void requestCheckUpdate(UpdateChannel channel, boolean preview) { | ||||||||||
| if (!SHOULD_CHECK_UPDATE) return; | ||||||||||
|
|
||||||||||
| Platform.runLater(() -> { | ||||||||||
|
CiiLu marked this conversation as resolved.
|
||||||||||
| if (isCheckingUpdate()) | ||||||||||
| return; | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,10 @@ else | |
| _HMCL_VM_OPTIONS="-XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=15" | ||
| fi | ||
|
|
||
| if [ $# -gt 0 ]; then | ||
| _HMCL_VM_OPTIONS="$_HMCL_VM_OPTIONS $*" | ||
| fi | ||
|
Comment on lines
+63
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在 如果用户在启动时传入了任何应用程序参数(例如自定义工作目录、版本选择等),JVM 会尝试将其解析为 JVM 参数,从而导致 为了解决这个问题,建议不要通过命令行参数传递 |
||
|
|
||
| function show_warning_console() { | ||
| echo -e "\033[1;31m$1\033[0m" >&2 | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -278,7 +278,7 @@ private String getLauncherScript() { | |
| if [ -z "${HMCL_DEPENDENCIES_DIR:-}" ]; then | ||
| export HMCL_DEPENDENCIES_DIR="$HMCL_USER_HOME/dependencies" | ||
| fi | ||
| exec %s "$@" | ||
| exec %s "$@" -Dhmcl.update.packageManager=apt | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| """.formatted(getCurrentTypeName(), getTargetPath()); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.