aports/community/openrct2/0003-disable-version-check.patch
2025-01-14 14:26:12 +00:00

48 lines
1.7 KiB
Diff

Disable the version check as the package is managed through apk
diff --git a/src/openrct2/Version.cpp b/src/openrct2/Version.cpp
index 49874fd291..a541bff197 100644
--- a/src/openrct2/Version.cpp
+++ b/src/openrct2/Version.cpp
@@ -61,40 +61,5 @@ NewVersionInfo GetLatestVersion()
// with invalid data.
std::string tag = gVersionInfoTag;
NewVersionInfo verinfo{ tag, "", "", "" };
-#ifndef DISABLE_HTTP
- auto now = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count();
- auto then = Config::Get().general.LastVersionCheckTime;
- using namespace std::chrono_literals;
-
- if (then < now - std::chrono::seconds(24h).count())
- {
- Http::Request request;
- request.url = "https://api.github.com/repos/OpenRCT2/OpenRCT2/releases/latest";
- request.method = Http::Method::GET;
-
- Http::Response res;
- try
- {
- res = Do(request);
- if (res.status != Http::Status::Ok)
- throw std::runtime_error("bad http status");
- }
- catch (std::exception& e)
- {
- Console::Error::WriteLine("Failed to download '%s', cause %s", request.url.c_str(), e.what());
- return {};
- }
-
- json_t root = Json::FromString(res.body);
-
- verinfo.tag = Json::GetString(root["tag_name"]);
- verinfo.name = Json::GetString(root["name"]);
- verinfo.changelog = Json::GetString(root["body"]);
- verinfo.url = Json::GetString(root["html_url"]);
-
- Config::Get().general.LastVersionCheckTime = now;
- Config::Save();
- }
-#endif
return verinfo;
}