mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 19:12:17 +00:00
log: add logs surrounding logout to potentially catch any unwanted logouts or errors (#13713)
# Description Currently, there is some suspicious behavior going on with the logout flow, adding some logs to potentially catch any unwanted logouts or unintentional behaviors. [How to Download Pull Requests Artifacts for Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
This commit is contained in:
@@ -1900,6 +1900,7 @@ void GUI_App::init_networking_callbacks()
|
||||
}
|
||||
if (return_code == 5) {
|
||||
GUI::wxGetApp().CallAfter([this, provider = event.provider] {
|
||||
BOOST_LOG_TRIVIAL(info) << "logout: login expired";
|
||||
this->request_user_logout(provider);
|
||||
MessageDialog msg_dlg(nullptr, _L("Login information expired. Please login again."), "", wxAPPLY | wxOK);
|
||||
if (msg_dlg.ShowModal() == wxOK) {
|
||||
@@ -4526,7 +4527,8 @@ std::string GUI_App::handle_web_request(std::string cmd)
|
||||
}
|
||||
else if (command_str.compare("homepage_logout") == 0) {
|
||||
CallAfter([this] {
|
||||
wxGetApp().request_user_logout();
|
||||
BOOST_LOG_TRIVIAL(info) << "logout: homepage_logout";
|
||||
request_user_logout();
|
||||
});
|
||||
}
|
||||
else if (command_str.compare("get_orca_login_info") == 0) {
|
||||
@@ -4539,18 +4541,22 @@ std::string GUI_App::handle_web_request(std::string cmd)
|
||||
CallAfter([this] { request_login(true, BBL_CLOUD_PROVIDER); });
|
||||
}
|
||||
else if (command_str.compare("homepage_bambu_logout") == 0) {
|
||||
CallAfter([this] { request_user_logout(BBL_CLOUD_PROVIDER); });
|
||||
CallAfter([this] {
|
||||
BOOST_LOG_TRIVIAL(info) << "logout: homepage_bambu_logout";
|
||||
request_user_logout(BBL_CLOUD_PROVIDER);
|
||||
});
|
||||
}
|
||||
else if (command_str.compare("homepage_orca_login_or_register") == 0) {
|
||||
CallAfter([this] { request_login(true, ORCA_CLOUD_PROVIDER); });
|
||||
}
|
||||
else if (command_str.compare("homepage_orca_logout") == 0) {
|
||||
CallAfter([this] { request_user_logout(ORCA_CLOUD_PROVIDER); });
|
||||
CallAfter([this] {
|
||||
BOOST_LOG_TRIVIAL(info) << "logout: homepage_orca_logout";
|
||||
request_user_logout(ORCA_CLOUD_PROVIDER);
|
||||
});
|
||||
}
|
||||
else if (command_str.compare("homepage_modeldepot") == 0) {
|
||||
CallAfter([this] {
|
||||
wxGetApp().open_mall_page_dialog();
|
||||
});
|
||||
CallAfter([this] { open_mall_page_dialog(); });
|
||||
}
|
||||
else if (command_str.compare("homepage_newproject") == 0) {
|
||||
this->request_open_project("<new>");
|
||||
@@ -4826,6 +4832,7 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
|
||||
if (status == 401) {
|
||||
if (m_agent) {
|
||||
if (m_agent->is_user_login(provider)) {
|
||||
BOOST_LOG_TRIVIAL(warning) << "logout: http error 401.";
|
||||
this->request_user_logout(provider);
|
||||
|
||||
if (!m_show_http_errpr_msgdlg) {
|
||||
@@ -5599,6 +5606,7 @@ void GUI_App::show_check_privacy_dlg(wxCommandEvent& evt)
|
||||
privacy_dlg.Bind(EVT_PRIVACY_UPDATE_CANCEL, [this, provider](wxCommandEvent &e) {
|
||||
app_config->set_bool("privacy_update_checked", false);
|
||||
if (m_agent) {
|
||||
BOOST_LOG_TRIVIAL(info) << "logout: Privacy update dialog cancelled.";
|
||||
m_agent->user_logout(false, provider);
|
||||
post_logout_to_webview(provider);
|
||||
}
|
||||
@@ -6766,6 +6774,7 @@ void GUI_App::stop_sync_user_preset()
|
||||
void GUI_App::on_stealth_mode_enter()
|
||||
{
|
||||
stop_sync_user_preset();
|
||||
BOOST_LOG_TRIVIAL(info) << "logout: on_stealth_mode_enter";
|
||||
request_user_logout(ORCA_CLOUD_PROVIDER);
|
||||
request_user_logout(BBL_CLOUD_PROVIDER);
|
||||
if (mainframe && mainframe->m_webview) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/iostreams/detail/select.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <string.h>
|
||||
#include "I18N.hpp"
|
||||
#include "libslic3r/AppConfig.hpp"
|
||||
@@ -516,7 +517,9 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
|
||||
if (agent) {
|
||||
agent->set_country_code(country_code);
|
||||
if (wxGetApp().is_user_login()) {
|
||||
agent->user_logout();
|
||||
BOOST_LOG_TRIVIAL(info) << "logout: user_logout on user_guide_finish";
|
||||
// agent->user_logout();
|
||||
wxGetApp().request_user_logout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1465,6 +1465,7 @@ bool OrcaCloudServiceAgent::load_refresh_token(std::string& out_token)
|
||||
if (payload.rfind("v2:", 0) == 0) {
|
||||
auto delim = payload.find(':', 3);
|
||||
if (delim == std::string::npos) {
|
||||
BOOST_LOG_TRIVIAL(warning) << "payload missing delim ':'.";
|
||||
integrity_ok = false;
|
||||
} else {
|
||||
std::string stored_hmac = payload.substr(3, delim - 3);
|
||||
@@ -1783,7 +1784,8 @@ int OrcaCloudServiceAgent::http_get(const std::string& path, std::string* respon
|
||||
std::string url = api_base_url + path;
|
||||
BOOST_LOG_TRIVIAL(trace) << "OrcaCloudServiceAgent: GET " << url;
|
||||
|
||||
ensure_token_fresh("http_get_" + path);
|
||||
if (!ensure_token_fresh("http_get_" + path))
|
||||
BOOST_LOG_TRIVIAL(warning) << "ensure_token_fresh returned false";
|
||||
|
||||
struct HttpResult {
|
||||
bool success{false};
|
||||
@@ -1815,8 +1817,9 @@ int OrcaCloudServiceAgent::http_get(const std::string& path, std::string* respon
|
||||
})
|
||||
.on_error([&](std::string body, std::string error, unsigned resp_status) {
|
||||
result.success = false;
|
||||
result.status = resp_status;
|
||||
result.body = body;
|
||||
result.status = resp_status == 0 ? 404 : resp_status;
|
||||
result.body = body;
|
||||
BOOST_LOG_TRIVIAL(error) << "OrcaCloudServiceAgent: HTTP error - " << error;
|
||||
})
|
||||
.timeout_max(30)
|
||||
.perform_sync();
|
||||
@@ -1884,8 +1887,9 @@ int OrcaCloudServiceAgent::http_post(const std::string& path, const std::string&
|
||||
})
|
||||
.on_error([&](std::string resp_body, std::string error, unsigned resp_status) {
|
||||
result.success = false;
|
||||
result.status = resp_status;
|
||||
result.body = resp_body;
|
||||
result.status = resp_status == 0 ? 404 : resp_status;
|
||||
result.body = body;
|
||||
BOOST_LOG_TRIVIAL(error) << "OrcaCloudServiceAgent: HTTP error - " << error;
|
||||
})
|
||||
.timeout_max(30)
|
||||
.perform_sync();
|
||||
@@ -1953,8 +1957,9 @@ int OrcaCloudServiceAgent::http_put(const std::string& path, const std::string&
|
||||
})
|
||||
.on_error([&](std::string resp_body, std::string error, unsigned resp_status) {
|
||||
result.success = false;
|
||||
result.status = resp_status;
|
||||
result.body = resp_body;
|
||||
result.status = resp_status == 0 ? 404 : resp_status;
|
||||
result.body = body;
|
||||
BOOST_LOG_TRIVIAL(error) << "OrcaCloudServiceAgent: HTTP error - " << error;
|
||||
})
|
||||
.timeout_max(30)
|
||||
.perform_sync();
|
||||
@@ -2019,8 +2024,9 @@ int OrcaCloudServiceAgent::http_delete(const std::string& path, std::string* res
|
||||
})
|
||||
.on_error([&](std::string resp_body, std::string error, unsigned resp_status) {
|
||||
result.success = false;
|
||||
result.status = resp_status;
|
||||
result.body = resp_body;
|
||||
result.status = resp_status == 0 ? 404 : resp_status;
|
||||
result.body = resp_body;
|
||||
BOOST_LOG_TRIVIAL(error) << "OrcaCloudServiceAgent: HTTP error - " << error;
|
||||
})
|
||||
.timeout_max(30)
|
||||
.perform_sync();
|
||||
@@ -2101,7 +2107,7 @@ bool OrcaCloudServiceAgent::http_post_token(const std::string& body, std::string
|
||||
})
|
||||
.on_error([&](std::string body, std::string error, unsigned resp_status) {
|
||||
success = false;
|
||||
status = resp_status;
|
||||
status = resp_status == 0 ? 404 : resp_status;
|
||||
resp_body = body;
|
||||
BOOST_LOG_TRIVIAL(error) << "OrcaCloudServiceAgent: HTTP error - " << error;
|
||||
})
|
||||
@@ -2171,7 +2177,7 @@ bool OrcaCloudServiceAgent::http_post_auth(const std::string& path, const std::s
|
||||
})
|
||||
.on_error([&](std::string body, std::string error, unsigned resp_status) {
|
||||
success = false;
|
||||
status = resp_status;
|
||||
status = resp_status == 0 ? 404 : resp_status;
|
||||
resp_body = body;
|
||||
BOOST_LOG_TRIVIAL(error) << "OrcaCloudServiceAgent: HTTP (auth) error - " << error;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user