option to disable update checking

Add the command line flag `--disable_updater` to disable all checking for updates. Enabled for now, the gateway is still not yet implemented
This commit is contained in:
Moritz Zwerger 2024-01-09 07:45:24 +01:00
parent c6978abe10
commit 4fb8960fd1
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2024 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -111,6 +111,10 @@ object CommandLineArguments {
addArgument("--render-api")
.action(Arguments.store())
.help("Render API to use. Defaults to gl")
addArgument("--disable-updater")
.action(Arguments.store())
.help("Force disables all update checking")
}
fun parse(args: Array<String>) {
@ -155,6 +159,8 @@ object CommandLineArguments {
setWindowFactory(namespace.getString("window")?.lowercase() ?: "glfw")
setRenderApi(namespace.getString("render_api")?.lowercase() ?: "gl")
RunConfiguration.UPDATE_CHECKING = !namespace.getBoolean("disable_updater")
}
private fun setWindowFactory(name: String) {

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2024 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -34,6 +34,9 @@ object RunConfiguration {
var AUTO_CONNECT_TO: String? = null
var UPDATE_CHECKING = false // TODO: This should be enabled.
var HOME_DIRECTORY: Path = unsafeNull()
private set
var CONFIG_DIRECTORY: Path = unsafeNull()

View File

@ -20,6 +20,7 @@ import de.bixilon.kutil.string.StringUtil.formatPlaceholder
import de.bixilon.kutil.url.URLUtil.toURL
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager
import de.bixilon.minosoft.properties.MinosoftProperties
import de.bixilon.minosoft.terminal.RunConfiguration
import de.bixilon.minosoft.util.http.HTTP2.get
import de.bixilon.minosoft.util.http.HTTPResponse
import de.bixilon.minosoft.util.http.exceptions.HTTPException
@ -44,6 +45,7 @@ object MinosoftUpdater {
}
fun check(force: Boolean = false, callback: (MinosoftUpdate?) -> Unit) {
if (!RunConfiguration.UPDATE_CHECKING) return
if (!MinosoftProperties.canUpdate()) return
if (!force) {
this.update?.let { callback.invoke(update); return }