From f218e54eac6b52652203625a783429b5cdd8a140 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Tue, 27 Jun 2023 00:33:18 +0200 Subject: [PATCH] Add crash settings to web UI --- domain-server/resources/describe-settings.json | 15 +++++++++++++++ domain-server/src/DomainServer.cpp | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index d4a4924ff5..1087b6ae31 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -73,6 +73,21 @@ } ] }, + { + "label": "Networking / Crash Reporting", + "name": "crash_reporting", + "restart": false, + "settings": [ + { + "name": "enable_crash_reporter", + "label": "Enable Crash Reporter", + "help": "Enable the automatic submission of crash reports to Overte e.V. This will help us find bugs and improve the code. Crash data will only be shared with developers trusted by Overte e.V., and will only be used to aid in development.", + "default": false, + "type": "checkbox", + "advanced": true + } + ] + }, { "name": "webrtc", "label": "Networking / WebRTC", diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 4164133058..89c2bd0bb0 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -61,6 +61,8 @@ #include #include +#include + using namespace std::chrono; @@ -199,6 +201,8 @@ DomainServer::DomainServer(int argc, char* argv[]) : _httpManager(QHostAddress::AnyIPv4, DOMAIN_SERVER_HTTP_PORT, QString("%1/resources/web/").arg(QCoreApplication::applicationDirPath()), this) { + static const QString CRASH_REPORTER = "crash_reporting.enable_crash_reporter"; + if (_parentPID != -1) { watchParentProcess(_parentPID); } @@ -239,12 +243,16 @@ DomainServer::DomainServer(int argc, char* argv[]) : _settingsManager.setupConfigMap(userConfigFilename); // setup a shutdown event listener to handle SIGTERM or WM_CLOSE for us + #ifdef _WIN32 installNativeEventFilter(&ShutdownEventListener::getInstance()); #else ShutdownEventListener::getInstance(); #endif + auto &ch = CrashHandler::getInstance(); + ch.setEnabled(_settingsManager.valueOrDefaultValueForKeyPath(CRASH_REPORTER).toBool()); + qRegisterMetaType("DomainServerWebSessionData"); qRegisterMetaTypeStreamOperators("DomainServerWebSessionData");