mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-04 00:36:14 +00:00
Application: Move some string literal URLs to functions
This commit is contained in:
parent
c372e63bd1
commit
e6109c98bd
@ -49,6 +49,10 @@ public:
|
|||||||
|
|
||||||
static inline TSettings Settings {};
|
static inline TSettings Settings {};
|
||||||
|
|
||||||
|
static std::string GetBackendUrlForAuth() { return "auth.beammp.com"; }
|
||||||
|
static std::string GetBackendHostname() { return "beammp.com"; }
|
||||||
|
static std::string GetBackendUrlForSocketIO() { return "https://backend.beammp.com"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline std::string mPPS;
|
static inline std::string mPPS;
|
||||||
static std::unique_ptr<TConsole> mConsole;
|
static std::unique_ptr<TConsole> mConsole;
|
||||||
|
@ -27,7 +27,7 @@ SocketIO::SocketIO() noexcept
|
|||||||
|
|
||||||
mClient.set_logs_quiet();
|
mClient.set_logs_quiet();
|
||||||
mClient.set_reconnect_delay(10000);
|
mClient.set_reconnect_delay(10000);
|
||||||
mClient.connect("https://backend.beammp.com");
|
mClient.connect(Application::GetBackendUrlForSocketIO());
|
||||||
}
|
}
|
||||||
|
|
||||||
SocketIO::~SocketIO() {
|
SocketIO::~SocketIO() {
|
||||||
|
@ -36,12 +36,12 @@ void THeartbeatThread::operator()() {
|
|||||||
|
|
||||||
Body += "&pps=" + Application::PPS();
|
Body += "&pps=" + Application::PPS();
|
||||||
|
|
||||||
T = Http::POST("beammp.com", "/heartbeatv2", {}, Body, false);
|
T = Http::POST(Application::GetBackendHostname(), "/heartbeatv2", {}, Body, false);
|
||||||
|
|
||||||
if (T.substr(0, 2) != "20") {
|
if (T.substr(0, 2) != "20") {
|
||||||
//Backend system refused server startup!
|
//Backend system refused server startup!
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
T = Http::POST("beammp.com", "/heartbeatv2", {}, Body, false);
|
T = Http::POST(Application::GetBackendHostname(), "/heartbeatv2", {}, Body, false);
|
||||||
// TODO backup2 + HTTP flag (no TSL)
|
// TODO backup2 + HTTP flag (no TSL)
|
||||||
if (T.substr(0, 2) != "20") {
|
if (T.substr(0, 2) != "20") {
|
||||||
warn("Backend system refused server! Server might not show in the public list");
|
warn("Backend system refused server! Server might not show in the public list");
|
||||||
|
@ -261,7 +261,7 @@ void TNetwork::Authentication(SOCKET TCPSock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Rc.empty()) {
|
if (!Rc.empty()) {
|
||||||
Rc = Http::POST("auth.beammp.com", "/pkToUser", {}, R"({"key":")" + Rc + "\"}", true);
|
Rc = Http::POST(Application::GetBackendUrlForAuth(), "/pkToUser", {}, R"({"key":")" + Rc + "\"}", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("Auth response: " + Rc);
|
debug("Auth response: " + Rc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user