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:
@@ -109,7 +109,7 @@ var LangText = {
|
||||
orca1: "Edit Project Info",
|
||||
orca2: "No model information",
|
||||
orca3: "Stealth Mode",
|
||||
orca4: "This stops the transmission of data to Bambu's cloud services. Users who don't use BBL machines or use LAN mode only can safely turn on this function.",
|
||||
orca4: "This disables all cloud features, including Orca Cloud profile syncing. Users who prefer to work entirely offline can enable this option.",
|
||||
orca5: "Enable Stealth Mode.",
|
||||
orca6: "Bambu Cloud",
|
||||
orca7: "Orca Cloud Account",
|
||||
@@ -117,6 +117,7 @@ var LangText = {
|
||||
orca9: "Bambu Cloud Account",
|
||||
orca10: "Not connected",
|
||||
orca11: "Connected",
|
||||
orca12: "Note: When Stealth Mode is enabled, your user profiles will not be backed up to Orca Cloud.",
|
||||
},
|
||||
ca_ES: {
|
||||
t1: "Benvingut a Orca Slicer",
|
||||
@@ -343,7 +344,6 @@ var LangText = {
|
||||
orca1: "Editar información del proyecto",
|
||||
orca2: "No hay información sobre el modelo",
|
||||
orca3: "Modo sigiloso",
|
||||
orca4: "Esta función detiene la transmisión de datos a los servicios en la nube de Bambu. Los usuarios que no utilicen máquinas BBL o que solo usen el modo LAN pueden activar esta función con seguridad.",
|
||||
orca5: "Activar modo sigiloso.",
|
||||
orca6: "Bambu Cloud",
|
||||
orca7: "Orca Cloud Account",
|
||||
@@ -461,7 +461,6 @@ var LangText = {
|
||||
orca1: "Modifica informazioni progetto",
|
||||
orca2: "Nessuna informazione sul modello",
|
||||
orca3: "Modalità invisibile",
|
||||
orca4: "Con questa modalità, la trasmissione dei dati ai servizi cloud di Bambu sarà interrotta. Gli utenti che non utilizzano macchine BBL o che usano solo la modalità LAN possono attivare questa funzione in modo sicuro.",
|
||||
orca5: "Abilita la modalità invisibile.",
|
||||
orca6: "Bambu Cloud",
|
||||
orca7: "Orca Cloud Account",
|
||||
@@ -1169,7 +1168,6 @@ var LangText = {
|
||||
orca1: "Изменить информацию",
|
||||
orca2: "Информация отсутствует",
|
||||
orca3: "Режим конфиденциальности",
|
||||
orca4: "Это остановит передачу данных в облачные сервисы Bambu. Помешает только владельцам Bambu Lab, не использующим режим «Только LAN».",
|
||||
orca5: "Включить режим конфиденциальности",
|
||||
orca6: "Bambu Cloud",
|
||||
orca7: "Orca Cloud Account",
|
||||
@@ -1386,7 +1384,6 @@ var LangText = {
|
||||
orca1: "Proje Bilgilerini Düzenle",
|
||||
orca2: "Model bilgisi yok",
|
||||
orca3: "Gizli Mod",
|
||||
orca4: "Bu, Bambu'nun bulut hizmetlerine veri iletimini durdurur. BBL makinelerini kullanmayan veya yalnızca LAN modunu kullanan kullanıcılar bu işlevi güvenle açabilir.",
|
||||
orca5: "Gizli Modu etkinleştirin.",
|
||||
orca6: "Bambu Cloud",
|
||||
orca7: "Orca Cloud Account",
|
||||
@@ -1505,7 +1502,6 @@ var LangText = {
|
||||
orca1: "Edytuj informacje o projekcie",
|
||||
orca2: "Brak informacji o modelu",
|
||||
orca3: "Tryb «Niewidzialny»",
|
||||
orca4: "To wyłączy przesyłanie danych do usług chmurowych Bambu. Użytkownicy, którzy nie korzystają z maszyn BBL lub używają tylko trybu LAN, mogą bez obaw włączyć tę opcję.",
|
||||
orca5: "Włącz tryb «Niewidzialny»",
|
||||
orca6: "Bambu Cloud",
|
||||
orca7: "Orca Cloud Account",
|
||||
@@ -1624,7 +1620,6 @@ var LangText = {
|
||||
orca1: "Editar Info do Projeto",
|
||||
orca2: "Sem informação do modelo",
|
||||
orca3: "Modo Furtivo",
|
||||
orca4: "Isso interrompe a transmissão de dados para os serviços de nuvem da Bambu. Usuários que não usam máquinas BBL ou usam somente o modo LAN podem ativar essa função com segurança.",
|
||||
orca5: "Habilita Modo Furtivo.",
|
||||
orca6: "Bambu Cloud",
|
||||
orca7: "Orca Cloud Account",
|
||||
@@ -1742,7 +1737,6 @@ var LangText = {
|
||||
orca1: "Redaguoti projekto informaciją",
|
||||
orca2: "Nėra informacijos apie modelį",
|
||||
orca3: "Slaptas režimas",
|
||||
orca4: "Tai sustabdo duomenų perdavimą į Bambu debesijos paslaugas. Vartotojai, kurie nenaudoja BBL mašinų arba naudoja tik LAN režimą, gali drąsiai įjungti šią funkciją.",
|
||||
orca5: "Įjungti slaptą režimą.",
|
||||
orca6: "Bambu Cloud",
|
||||
orca7: "Orca Cloud Account",
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
<div id="Content">
|
||||
|
||||
<div id="FeatureText">
|
||||
<div><a tid="orca4" class="trans TextS1">This stops the transmission of data to Bambu's cloud services. Users who don't use BBL machines or use LAN mode only can safely turn on this function.</a></div>
|
||||
<div><a tid="orca4" class="trans TextS1">This disables all cloud features, including Orca Cloud profile syncing. Users who prefer to work entirely offline can enable this option.</a></div>
|
||||
<br/>
|
||||
<div><a tid="orca12" class="trans TextS2">Note: When Stealth Mode is enabled, your user profiles will not be backed up to Orca Cloud.</a></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -93,6 +93,11 @@ bool AppConfig::get_stealth_mode()
|
||||
return get_bool("stealth_mode");
|
||||
}
|
||||
|
||||
bool AppConfig::get_hide_login_side_panel()
|
||||
{
|
||||
return get_bool("hide_login_side_panel");
|
||||
}
|
||||
|
||||
void AppConfig::reset()
|
||||
{
|
||||
m_storage.clear();
|
||||
@@ -347,6 +352,9 @@ void AppConfig::set_defaults()
|
||||
if (get("stealth_mode").empty()) {
|
||||
set_bool("stealth_mode", false);
|
||||
}
|
||||
if (get("hide_login_side_panel").empty()) {
|
||||
set_bool("hide_login_side_panel", false);
|
||||
}
|
||||
if (get("allow_abnormal_storage").empty()) {
|
||||
set_bool("allow_abnormal_storage", false);
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ public:
|
||||
std::string get_language_code();
|
||||
std::string get_hms_host();
|
||||
bool get_stealth_mode();
|
||||
bool get_hide_login_side_panel();
|
||||
|
||||
// Clear and reset to defaults.
|
||||
void reset();
|
||||
|
||||
@@ -4509,21 +4509,46 @@ std::string GUI_App::handle_web_request(std::string cmd)
|
||||
boost::optional<std::string> command = root.get_optional<std::string>("command");
|
||||
if (command.has_value()) {
|
||||
std::string command_str = command.value();
|
||||
static const std::unordered_set<std::string> stealth_blocked_commands = {
|
||||
static const std::unordered_set<std::string> stealth_blocked_info_commands = {
|
||||
"get_login_info",
|
||||
"get_orca_login_info",
|
||||
"get_bambu_login_info",
|
||||
};
|
||||
static const std::unordered_set<std::string> stealth_blocked_login_commands = {
|
||||
"homepage_login_or_register",
|
||||
"homepage_orca_login_or_register",
|
||||
"homepage_bambu_login_or_register",
|
||||
};
|
||||
if (app_config->get_stealth_mode() && stealth_blocked_commands.count(command_str)) {
|
||||
if (app_config->get_stealth_mode() && stealth_blocked_info_commands.count(command_str)) {
|
||||
CallAfter([this] {
|
||||
if (mainframe && mainframe->m_webview)
|
||||
mainframe->m_webview->SendCloudProvidersInfo();
|
||||
});
|
||||
return "";
|
||||
}
|
||||
if (app_config->get_stealth_mode() && stealth_blocked_login_commands.count(command_str)) {
|
||||
CallAfter([this, command_str] {
|
||||
MessageDialog dlg(mainframe,
|
||||
_L("You are currently in Stealth Mode. To log into the Cloud, you need to disable Stealth Mode first."),
|
||||
_L("Stealth Mode"),
|
||||
wxOK | wxCANCEL | wxCENTRE);
|
||||
dlg.SetButtonLabel(wxID_OK, _L("Quit Stealth Mode"));
|
||||
if (dlg.ShowModal() == wxID_OK) {
|
||||
app_config->set_bool("stealth_mode", false);
|
||||
app_config->save();
|
||||
if (mainframe && mainframe->m_webview)
|
||||
mainframe->m_webview->SendCloudProvidersInfo();
|
||||
// Continue with login
|
||||
if (command_str == "homepage_login_or_register")
|
||||
this->request_login(true);
|
||||
else if (command_str == "homepage_orca_login_or_register")
|
||||
this->request_login(true, ORCA_CLOUD_PROVIDER);
|
||||
else if (command_str == "homepage_bambu_login_or_register")
|
||||
this->request_login(true, BBL_CLOUD_PROVIDER);
|
||||
}
|
||||
});
|
||||
return "";
|
||||
}
|
||||
if (command_str.compare("request_project_download") == 0) {
|
||||
if (root.get_child_optional("data") != boost::none) {
|
||||
pt::ptree data_node = root.get_child("data");
|
||||
|
||||
@@ -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 = "";
|
||||
|
||||
@@ -968,6 +968,11 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxString too
|
||||
if (m_sync_user_preset_checkbox) m_sync_user_preset_checkbox->Enable(!enabled);
|
||||
if (m_bambu_cloud_checkbox) m_bambu_cloud_checkbox->Enable(!enabled);
|
||||
}
|
||||
else if (param == "hide_login_side_panel") {
|
||||
if (wxGetApp().mainframe && wxGetApp().mainframe->m_webview) {
|
||||
wxGetApp().mainframe->m_webview->SendCloudProvidersInfo();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
if (param == "associate_3mf") {
|
||||
@@ -1605,9 +1610,12 @@ void PreferencesDialog::create_items()
|
||||
auto item_region = create_item_region_combobox(_L("Login region"), "");
|
||||
g_sizer->Add(item_region);
|
||||
|
||||
auto item_stealth_mode = create_item_checkbox(_L("Stealth mode"), _L("This disables all cloud services e.g. Orca Cloud and Bambu Cloud. This stops the transmission of data to Bambu's cloud services too. Users who don't use BBL machines or use LAN mode only can safely turn on this function."), "stealth_mode");
|
||||
auto item_stealth_mode = create_item_checkbox(_L("Stealth mode"), _L("This disables all cloud features, including Orca Cloud profile syncing. Users who prefer to work entirely offline can enable this option.\nNote: When Stealth Mode is enabled, your user profiles will not be backed up to Orca Cloud."), "stealth_mode");
|
||||
g_sizer->Add(item_stealth_mode);
|
||||
|
||||
auto item_hide_login_side_panel = create_item_checkbox(_L("Hide login side panel"), _L("Hide the login side panel on the home page."), "hide_login_side_panel");
|
||||
g_sizer->Add(item_hide_login_side_panel);
|
||||
|
||||
auto item_network_test = create_item_button(_L("Network test"), _L("Test") + " " + dots, "", _L("Open Network Test"), []() {
|
||||
NetworkTestDialog dlg(wxGetApp().mainframe);
|
||||
dlg.ShowModal();
|
||||
|
||||
@@ -177,11 +177,7 @@ ZUserLogin::ZUserLogin(std::shared_ptr<ICloudServiceAgent> cloud_agent)
|
||||
wxSize pSize = FromDIP(wxSize(650, 840));
|
||||
SetSize(pSize);
|
||||
|
||||
int screenheight = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y, NULL);
|
||||
int screenwidth = wxSystemSettings::GetMetric(wxSYS_SCREEN_X, NULL);
|
||||
int MaxY = (screenheight - pSize.y) > 0 ? (screenheight - pSize.y) / 2 : 0;
|
||||
wxPoint tmpPT((screenwidth - pSize.x) / 2, MaxY);
|
||||
Move(tmpPT);
|
||||
CentreOnParent();
|
||||
}
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ void WebViewPanel::SendCloudProvidersInfo()
|
||||
json data;
|
||||
json provider_array = json::array();
|
||||
|
||||
if (!app_config->get_stealth_mode()) {
|
||||
if (!app_config->get_hide_login_side_panel()) {
|
||||
auto providers = app_config->get_cloud_providers();
|
||||
for (const auto& p : providers) {
|
||||
provider_array.push_back(p);
|
||||
|
||||
Reference in New Issue
Block a user