From a81259d19a434752614e5a430fdebf86f07c1cfc Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Tue, 2 Aug 2022 21:34:17 +0200 Subject: Run Minetest update checker on startup (#7629) This feature is enabled by default for non-Android release builds. Package maintainers may use -DENABLE_UPDATE_CHECKER=0 to disable it. Co-authored-by: rubenwardy Co-authored-by: sfan5 --- src/cmake_config.h.in | 2 ++ src/config.h | 1 + src/defaultsettings.cpp | 6 ++++++ src/gui/guiFormSpecMenu.cpp | 2 +- src/script/lua_api/l_util.cpp | 2 ++ 5 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cmake_config.h.in b/src/cmake_config.h.in index b1298165e..17b70e268 100644 --- a/src/cmake_config.h.in +++ b/src/cmake_config.h.in @@ -15,6 +15,8 @@ #define BUILD_TYPE "@CMAKE_BUILD_TYPE@" #define ICON_DIR "@ICONDIR@" #cmakedefine01 RUN_IN_PLACE +#cmakedefine01 DEVELOPMENT_BUILD +#cmakedefine01 ENABLE_UPDATE_CHECKER #cmakedefine01 USE_GETTEXT #cmakedefine01 USE_CURL #cmakedefine01 USE_SOUND diff --git a/src/config.h b/src/config.h index 50e118428..a4c6c9f10 100644 --- a/src/config.h +++ b/src/config.h @@ -16,6 +16,7 @@ #define PROJECT_NAME "minetest" #define PROJECT_NAME_C "Minetest" #define STATIC_SHAREDIR "" + #define ENABLE_UPDATE_CHECKER 0 #define VERSION_STRING STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_PATCH) STR(VERSION_EXTRA) #endif #ifdef NDEBUG diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 222000712..c5d92e680 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -335,6 +335,12 @@ void set_default_settings() settings->setDefault("contentdb_flag_blacklist", "nonfree, desktop_default"); #endif + settings->setDefault("update_information_url", "https://www.minetest.net/release_info.json"); +#if ENABLE_UPDATE_CHECKER + settings->setDefault("update_last_checked", ""); +#else + settings->setDefault("update_last_checked", "disabled"); +#endif // Server settings->setDefault("disable_escape_sequences", "false"); diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 5d4ca6747..1f9914e72 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -1686,7 +1686,7 @@ void GUIFormSpecMenu::parseField(parserData* data, const std::string &element, void GUIFormSpecMenu::parseHyperText(parserData *data, const std::string &element) { - MY_CHECKCLIENT("list"); + MY_CHECKCLIENT("hypertext"); std::vector parts; if (!precheckElement("hypertext", element, 4, 4, parts)) diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index 47a68ad75..f602aed99 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -480,6 +480,8 @@ int ModApiUtil::l_get_version(lua_State *L) lua_setfield(L, table, "hash"); } + lua_pushboolean(L, DEVELOPMENT_BUILD); + lua_setfield(L, table, "is_dev"); return 1; } -- cgit v1.2.3