diff --git a/src/confighttp.cpp b/src/confighttp.cpp index 8b9dbb86..88eeae19 100644 --- a/src/confighttp.cpp +++ b/src/confighttp.cpp @@ -627,24 +627,27 @@ namespace confighttp { print_req(request); - // We do want to return here - std::thread quit_thread([]{ - sleep(1000); - #ifdef _WIN32 - // If we're running in a service, return a special status to - // tell it to terminate too, otherwise it will just respawn us. - if (GetConsoleWindow() == NULL) { - lifetime::exit_sunshine(ERROR_SHUTDOWN_IN_PROGRESS, true); - return; - } - #endif + BOOST_LOG(warning) << "Requested quit from config page!"sv; + #ifdef _WIN32 + // If we're running in a service, return a special status to + // tell it to terminate too, otherwise it will just respawn us. + if (GetConsoleWindow() == NULL) { + lifetime::exit_sunshine(ERROR_SHUTDOWN_IN_PROGRESS, true); + } else + #endif + { lifetime::exit_sunshine(0, true); + } + + // We do want to return here + // If user get a return, then the exit has failed. + // This might not be thread safe but we're exiting anyways + std::thread write_resp([response]{ + sleep(5000); + response->write(); }); - - quit_thread.detach(); - - response->write(); + write_resp.detach(); } void diff --git a/src_assets/common/assets/web/configs/tabs/General.vue b/src_assets/common/assets/web/configs/tabs/General.vue index 42feebe5..428c689e 100644 --- a/src_assets/common/assets/web/configs/tabs/General.vue +++ b/src_assets/common/assets/web/configs/tabs/General.vue @@ -129,21 +129,18 @@ function removeCmd(index) { - +
- +
{{ $t('config.hide_tray_controls_desc') }}
-
- - -
{{ $t('config.notify_pre_releases_desc') }}
+
+ + +
{{ $t('config.notify_pre_releases_desc') }}
diff --git a/src_assets/common/assets/web/troubleshooting.html b/src_assets/common/assets/web/troubleshooting.html index acc17d0c..14cec51f 100644 --- a/src_assets/common/assets/web/troubleshooting.html +++ b/src_assets/common/assets/web/troubleshooting.html @@ -260,34 +260,17 @@ quit() { if (window.confirm("Do you really want to quit Apollo? You'll not be able to start Apollo again if you have no other methods to operate your computer.")) { this.serverQuitting = true; - const timeoutID = setTimeout(() => { - this.serverQuitting = false; - }, 5000); fetch("/api/quit", { method: "POST", }) .then(() => { - clearTimeout(timeoutID); - return new Promise((resolve, reject) => { - setTimeout(() => { - fetch("/", { - signal: AbortSignal.timeout(1000) - }).then(() => { - reject(); - }).catch(() => { - resolve(); - }) - }, 1000); - }); - }) - .then(() => { - this.serverQuitting = false; - this.serverQuit = true; - }) - .catch(() => { this.serverQuitting = false; this.serverQuit = false; alert("Exit failed!"); + }) + .catch(() => { + this.serverQuitting = false; + this.serverQuit = true; }); } }