log: add logs surrounding logout to potentially catch any unwanted logouts or errors

This commit is contained in:
Ian Chua
2026-05-18 15:18:31 +08:00
parent 1447602d43
commit 232fc30db1
3 changed files with 20 additions and 7 deletions

View File

@@ -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) {

View File

@@ -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();
}
}
}

View File

@@ -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);