Feature/tweak stealth mode (#13963)

* Update the stealth mode description to reflect the current code changes in 2.4.

* disable HMS if bambu network plugin is not installed or in stealth mode

* fix build err

* add hide_login_side_panel to control whether to show login panel in home page
This commit is contained in:
SoftFever
2026-05-31 18:04:06 +08:00
committed by GitHub
parent 535911fcfe
commit 372f7823ac
9 changed files with 66 additions and 23 deletions

View File

@@ -4,6 +4,7 @@
#include "DeviceManager.hpp"
#include "DeviceCore/DevManager.h"
#include "DeviceCore/DevUtil.h"
#include "libslic3r/AppConfig.hpp"
#include <boost/log/trivial.hpp>
@@ -13,6 +14,14 @@ static const char* HMS_LOCAL_IMG_PATH = "hms/local_image";
// the local HMS info
static unordered_set<string> package_dev_id_types {"094", "239", "093", "22E"};
// HMS should be disabled when stealth mode is on or networking is not installed
static bool should_disable_hms()
{
Slic3r::AppConfig* config = Slic3r::GUI::wxGetApp().app_config;
if (!config) return true;
return config->get_stealth_mode() || !config->get_bool("installed_networking");
}
namespace Slic3r {
namespace GUI {
@@ -21,7 +30,7 @@ int get_hms_info_version(std::string& version)
AppConfig* config = wxGetApp().app_config;
if (!config)
return -1;
if (config->get_stealth_mode())
if (should_disable_hms())
return -1;
std::string hms_host = config->get_hms_host();
if(hms_host.empty()) {
@@ -61,7 +70,7 @@ int HMSQuery::download_hms_related(const std::string& hms_type, const std::strin
AppConfig* config = wxGetApp().app_config;
if (!config) return -1;
if (config->get_stealth_mode()) return -1;
if (should_disable_hms()) return -1;
std::string hms_host = wxGetApp().app_config->get_hms_host();
std::string lang;
@@ -546,7 +555,7 @@ wxString HMSQuery::query_print_image_action(const MachineObject* obj, int print_
::sprintf(buf, "%08X", print_error);
//The first three digits of SN number
const auto result = _query_error_image_action(get_dev_id_type(obj),std::string(buf), button_action);
if (wxGetApp().app_config->get_stealth_mode() && result.Contains("http")) {
if (should_disable_hms() && result.Contains("http")) {
return wxEmptyString;
}
return result;
@@ -637,7 +646,7 @@ std::string get_hms_wiki_url(std::string error_code)
{
AppConfig* config = wxGetApp().app_config;
if (!config) return "";
if (config->get_stealth_mode()) return "";
if (should_disable_hms()) return "";
std::string hms_host = wxGetApp().app_config->get_hms_host();
std::string lang_code = HMSQuery::hms_language_code();
@@ -663,7 +672,7 @@ std::string get_hms_wiki_url(std::string error_code)
std::string get_error_message(int error_code)
{
if (wxGetApp().app_config->get_stealth_mode()) return "";
if (should_disable_hms()) return "";
char buf[64];
std::string result_str = "";