mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-22 12:45:17 +00:00
Guard cloud logout on tagged HTTP errors
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user