Merge pull request #96 from 20dka/feature-supressBackend

Ignore backend response if server is Private
This commit is contained in:
Lion
2022-03-17 09:57:16 +01:00
committed by GitHub
+4 -2
View File
@@ -62,8 +62,10 @@ void THeartbeatThread::operator()() {
beammp_trace(T); beammp_trace(T);
Doc.Parse(T.data(), T.size()); Doc.Parse(T.data(), T.size());
if (Doc.HasParseError() || !Doc.IsObject()) { if (Doc.HasParseError() || !Doc.IsObject()) {
if (!Application::Settings.Private) {
beammp_error("Backend response failed to parse as valid json"); beammp_error("Backend response failed to parse as valid json");
beammp_debug("Response was: `" + T + "`"); beammp_debug("Response was: `" + T + "`");
}
Sentry.SetContext("JSON Response", { { "reponse", T } }); Sentry.SetContext("JSON Response", { { "reponse", T } });
SentryReportError(Url + Target, ResponseCode); SentryReportError(Url + Target, ResponseCode);
} else if (ResponseCode != 200) { } else if (ResponseCode != 200) {
@@ -107,7 +109,7 @@ void THeartbeatThread::operator()() {
} }
} }
if (Ok && !isAuth) { if (Ok && !isAuth && !Application::Settings.Private) {
if (Status == "2000") { if (Status == "2000") {
beammp_info(("Authenticated! " + Message)); beammp_info(("Authenticated! " + Message));
isAuth = true; isAuth = true;
@@ -121,7 +123,7 @@ void THeartbeatThread::operator()() {
beammp_error("Backend REFUSED the auth key. Reason: " + Message); beammp_error("Backend REFUSED the auth key. Reason: " + Message);
} }
} }
if (isAuth) { if (isAuth || Application::Settings.Private) {
Application::SetSubsystemStatus("Heartbeat", Application::Status::Good); Application::SetSubsystemStatus("Heartbeat", Application::Status::Good);
} }
} }