mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-04 00:36:14 +00:00
UpdateCheck: Try all URLs
This commit is contained in:
parent
2a588954be
commit
fca5bbcec9
@ -99,6 +99,7 @@ void Application::CheckForUpdates() {
|
|||||||
Application::SetSubsystemStatus("UpdateCheck", Application::Status::Starting);
|
Application::SetSubsystemStatus("UpdateCheck", Application::Status::Starting);
|
||||||
// checks current version against latest version
|
// checks current version against latest version
|
||||||
std::regex VersionRegex { R"(\d+\.\d+\.\d+\n*)" };
|
std::regex VersionRegex { R"(\d+\.\d+\.\d+\n*)" };
|
||||||
|
for (const auto& url : GetBackendUrlsInOrder()) {
|
||||||
auto Response = Http::GET(GetBackendUrlsInOrder().at(0), 443, "/v/s");
|
auto Response = Http::GET(GetBackendUrlsInOrder().at(0), 443, "/v/s");
|
||||||
bool Matches = std::regex_match(Response, VersionRegex);
|
bool Matches = std::regex_match(Response, VersionRegex);
|
||||||
if (Matches) {
|
if (Matches) {
|
||||||
@ -111,14 +112,19 @@ void Application::CheckForUpdates() {
|
|||||||
beammp_info("Server up-to-date!");
|
beammp_info("Server up-to-date!");
|
||||||
}
|
}
|
||||||
Application::SetSubsystemStatus("UpdateCheck", Application::Status::Good);
|
Application::SetSubsystemStatus("UpdateCheck", Application::Status::Good);
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
beammp_warn("Unable to fetch version from backend.");
|
beammp_debug("Failed to fetch version from: " + url);
|
||||||
beammp_trace("got " + Response);
|
beammp_trace("got " + Response);
|
||||||
auto Lock = Sentry.CreateExclusiveContext();
|
auto Lock = Sentry.CreateExclusiveContext();
|
||||||
Sentry.SetContext("get-response", { { "response", Response } });
|
Sentry.SetContext("get-response", { { "response", Response } });
|
||||||
Sentry.LogError("failed to get server version", _file_basename, _line);
|
Sentry.LogError("failed to get server version", _file_basename, _line);
|
||||||
Application::SetSubsystemStatus("UpdateCheck", Application::Status::Bad);
|
Application::SetSubsystemStatus("UpdateCheck", Application::Status::Bad);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (Application::GetSubsystemStatuses().at("UpdateCheck") == Application::Status::Bad) {
|
||||||
|
beammp_warn("Unable to fetch version info from backend.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// thread name stuff
|
// thread name stuff
|
||||||
|
Loading…
x
Reference in New Issue
Block a user