Guard cloud logout on tagged HTTP errors

This commit is contained in:
SoftFever
2026-05-22 01:15:54 +08:00
parent ffa294b29b
commit 7aeb26280d
2 changed files with 3 additions and 3 deletions

View File

@@ -4803,7 +4803,7 @@ void GUI_App::handle_http_error(unsigned int status, std::string body, const std
void GUI_App::on_http_error(wxCommandEvent &evt) void GUI_App::on_http_error(wxCommandEvent &evt)
{ {
int status = evt.GetInt(); int status = evt.GetInt();
std::string provider = ORCA_CLOUD_PROVIDER; std::string provider = "";
std::string body_str; std::string body_str;
// Extract provider and body from event data // Extract provider and body from event data
@@ -4845,7 +4845,7 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
// request login // request login
if (status == 401) { if (status == 401) {
if (m_agent) { if (m_agent) {
if (m_agent->is_user_login(provider)) { if (!provider.empty() && m_agent->is_user_login(provider)) {
if (std::chrono::steady_clock::now() - m_last_401_error_time > 30s) { if (std::chrono::steady_clock::now() - m_last_401_error_time > 30s) {
BOOST_LOG_TRIVIAL(warning) << "logout: http error 401."; BOOST_LOG_TRIVIAL(warning) << "logout: http error 401.";
this->request_user_logout(provider); this->request_user_logout(provider);

View File

@@ -494,7 +494,7 @@ public:
void request_open_project(std::string project_id); void request_open_project(std::string project_id);
void request_remove_project(std::string project_id); void request_remove_project(std::string project_id);
void handle_http_error(unsigned int status, std::string body, const std::string& provider = ORCA_CLOUD_PROVIDER); void handle_http_error(unsigned int status, std::string body, const std::string& provider = "");
void on_http_error(wxCommandEvent &evt); void on_http_error(wxCommandEvent &evt);
void on_update_machine_list(wxCommandEvent& evt); void on_update_machine_list(wxCommandEvent& evt);
void on_user_login(wxCommandEvent &evt); void on_user_login(wxCommandEvent &evt);