mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-04 00:36:14 +00:00
Fix url
This commit is contained in:
parent
59b1b45625
commit
003a8269aa
@ -11,6 +11,7 @@
|
|||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include "Http.h"
|
#include "Http.h"
|
||||||
|
#include "CustomAssert.h"
|
||||||
|
|
||||||
std::unique_ptr<TConsole> Application::mConsole = std::make_unique<TConsole>();
|
std::unique_ptr<TConsole> Application::mConsole = std::make_unique<TConsole>();
|
||||||
|
|
||||||
@ -54,14 +55,17 @@ bool Application::IsOutdated(const std::array<int, 3>& Current, const std::array
|
|||||||
|
|
||||||
void Application::CheckForUpdates() {
|
void Application::CheckForUpdates() {
|
||||||
// checks current version against latest version
|
// checks current version against latest version
|
||||||
std::regex VersionRegex { R"(\d\.\d\.\d)" };
|
std::regex VersionRegex { R"(\d+\.\d+\.\d+\n*)" };
|
||||||
auto Response = Http::GET("kortlepel.com", 443, "/v/s.html");
|
auto Response = Http::GET(GetBackendHostname(), 443, "/v/s");
|
||||||
bool Matches = std::regex_match(Response, VersionRegex);
|
bool Matches = std::regex_match(Response, VersionRegex);
|
||||||
if (Matches) {
|
if (Matches) {
|
||||||
auto MyVersion = VersionStrToInts(ServerVersion());
|
auto MyVersion = VersionStrToInts(ServerVersion());
|
||||||
auto RemoteVersion = VersionStrToInts(Response);
|
auto RemoteVersion = VersionStrToInts(Response);
|
||||||
if (IsOutdated(MyVersion, RemoteVersion)) {
|
if (IsOutdated(MyVersion, RemoteVersion)) {
|
||||||
warn("NEW VERSION OUT! There's a new version (v" + Response + ") of the BeamMP-Server available! For info on how to update your server, visit https://wiki.beammp.com/en/home/server-maintenance#updating-the-server.");
|
std::string RealVersionString = std::to_string(RemoteVersion[0]) + ".";
|
||||||
|
RealVersionString += std::to_string(RemoteVersion[1]) + ".";
|
||||||
|
RealVersionString += std::to_string(RemoteVersion[2]);
|
||||||
|
warn( "NEW VERSION OUT! There's a new version (v" + RealVersionString + ") of the BeamMP-Server available! For info on how to update your server, visit https://wiki.beammp.com/en/home/server-maintenance#updating-the-server.");
|
||||||
} else {
|
} else {
|
||||||
info("Server up-to-date!");
|
info("Server up-to-date!");
|
||||||
}
|
}
|
||||||
@ -70,7 +74,7 @@ void Application::CheckForUpdates() {
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
debug("got " + Response);
|
debug("got " + Response);
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,8 @@ std::string Http::GET(const std::string& host, int port, const std::string& targ
|
|||||||
if (status) {
|
if (status) {
|
||||||
*status = res.base().result_int();
|
*status = res.base().result_int();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ec)
|
// ignore ec
|
||||||
throw beast::system_error { ec };
|
|
||||||
|
|
||||||
// If we get here then the connection is closed gracefully
|
// If we get here then the connection is closed gracefully
|
||||||
return std::string(res.body());
|
return std::string(res.body());
|
||||||
|
@ -66,9 +66,10 @@ int main(int argc, char** argv) try {
|
|||||||
Assert(!Application::IsOutdated(std::array<int, 3> { 2, 0, 0 }, std::array<int, 3> { 1, 0, 1 }));
|
Assert(!Application::IsOutdated(std::array<int, 3> { 2, 0, 0 }, std::array<int, 3> { 1, 0, 1 }));
|
||||||
|
|
||||||
TServer Server(argc, argv);
|
TServer Server(argc, argv);
|
||||||
TConfig Config;
|
|
||||||
|
|
||||||
Application::CheckForUpdates();
|
Application::CheckForUpdates();
|
||||||
|
|
||||||
|
TConfig Config;
|
||||||
|
|
||||||
if (Config.Failed()) {
|
if (Config.Failed()) {
|
||||||
info("Closing in 10 seconds");
|
info("Closing in 10 seconds");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user