diff --git a/src/slic3r/GUI/BindDialog.cpp b/src/slic3r/GUI/BindDialog.cpp index 258645a68b..5e3333a003 100644 --- a/src/slic3r/GUI/BindDialog.cpp +++ b/src/slic3r/GUI/BindDialog.cpp @@ -520,8 +520,8 @@ wxString get_fail_reason(int code) m_sw_bind_failed_info->Show(true); m_st_txt_error_code->SetLabelText(wxString::Format("%d", m_result_code)); - m_st_txt_error_desc->SetLabelText(m_result_info); - m_st_txt_extra_info->SetLabelText(m_result_extra); + m_st_txt_error_desc->SetLabelText( wxGetApp().filter_string(m_result_info)); + m_st_txt_extra_info->SetLabelText( wxGetApp().filter_string(m_result_extra)); m_st_txt_error_code->Wrap(FromDIP(260)); m_st_txt_error_desc->Wrap(FromDIP(260)); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 0bcd3e867f..9e4bd5dbf1 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -5568,6 +5568,26 @@ void GUI_App::preset_deleted_from_cloud(std::string setting_id) need_delete_presets.erase(std::remove(need_delete_presets.begin(), need_delete_presets.end(), setting_id), need_delete_presets.end()); } +wxString GUI_App::filter_string(wxString str) +{ + std::string result = str.ToStdString(); + std::string input = str.ToStdString(); + + + std::regex domainRegex(R"(([a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(?:\.[a-zA-Z]{2,})?))"); + std::sregex_iterator it(input.begin(), input.end(), domainRegex); + std::sregex_iterator end; + + while (it != end) { + std::smatch match = *it; + std::string domain = match.str(); + result.replace(match.position(), domain.length(), "[***]"); + ++it; + } + + return result; +} + bool GUI_App::OnExceptionInMainLoop() { generic_exception_handle(); diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 47ae0021a0..120d691774 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -489,6 +489,7 @@ public: void delete_preset_from_cloud(std::string setting_id); void preset_deleted_from_cloud(std::string setting_id); + wxString filter_string(wxString str); wxString current_language_code() const { return m_wxLocale->GetCanonicalName(); } // Translate the language code to a code, for which Prusa Research maintains translations. Defaults to "en_US". wxString current_language_code_safe() const; diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 312b29b003..7f75779453 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1517,8 +1517,8 @@ void SelectMachineDialog::show_print_failed_info(bool show, int code, wxString d m_sw_print_failed_info->Show(true); m_st_txt_error_code->SetLabelText(wxString::Format("%d", m_print_error_code)); - m_st_txt_error_desc->SetLabelText(m_print_error_msg); - m_st_txt_extra_info->SetLabelText(m_print_error_extra); + m_st_txt_error_desc->SetLabelText( wxGetApp().filter_string(m_print_error_msg)); + m_st_txt_extra_info->SetLabelText( wxGetApp().filter_string(m_print_error_extra)); m_st_txt_error_code->Wrap(FromDIP(260)); m_st_txt_error_desc->Wrap(FromDIP(260)); diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp index a52ce2c3df..598e2670ff 100644 --- a/src/slic3r/GUI/SendToPrinter.cpp +++ b/src/slic3r/GUI/SendToPrinter.cpp @@ -539,8 +539,8 @@ void SendToPrinterDialog::show_print_failed_info(bool show, int code, wxString d m_sw_print_failed_info->Show(true); m_st_txt_error_code->SetLabelText(wxString::Format("%d", m_print_error_code)); - m_st_txt_error_desc->SetLabelText(m_print_error_msg); - m_st_txt_extra_info->SetLabelText(m_print_error_extra); + m_st_txt_error_desc->SetLabelText( wxGetApp().filter_string(m_print_error_msg)); + m_st_txt_extra_info->SetLabelText( wxGetApp().filter_string(m_print_error_extra)); m_st_txt_error_code->Wrap(FromDIP(260)); m_st_txt_error_desc->Wrap(FromDIP(260));