diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index bd91dc7bb..8ee78e874 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -1353,6 +1353,18 @@ void ConfigBase::save_to_json(const std::string &file, const std::string &name, //record all the key-values for (const std::string &opt_key : this->keys()) { + if (from.compare("project") == 0) { + if (opt_key.compare("print_host") == 0 + || opt_key.compare("print_host_webui") == 0 + || opt_key.compare("printhost_apikey") == 0 + || opt_key.compare("printhost_cafile") == 0 + || opt_key.compare("printhost_user") == 0 + || opt_key.compare("printhost_password") == 0 + || opt_key.compare("printhost_port") == 0 + ) { + continue; + } + } const ConfigOption* opt = this->option(opt_key); if ( opt->is_scalar() ) { if (opt->type() == coString) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index a20465535..f44eeb63d 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3767,13 +3767,20 @@ void GCode::append_full_config(const Print &print, std::string &str) { const DynamicPrintConfig &cfg = print.full_print_config(); // Sorted list of config keys, which shall not be stored into the G-code. Initializer list. - static constexpr auto banned_keys = { + static const std::set banned_keys({ "compatible_printers"sv, - "compatible_prints"sv - }; + "compatible_prints"sv, + "print_host"sv, + "print_host_webui"sv, + "printhost_apikey"sv, + "printhost_cafile"sv, + "printhost_user"sv, + "printhost_password"sv, + "printhost_port"sv + }); assert(std::is_sorted(banned_keys.begin(), banned_keys.end())); auto is_banned = [](const std::string &key) { - return std::binary_search(banned_keys.begin(), banned_keys.end(), key); + return banned_keys.find(key) != banned_keys.end(); }; for (const std::string &key : cfg.keys()) if (! is_banned(key) && ! cfg.option(key)->is_nil()) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index c03741d29..41bdaa057 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1867,6 +1867,10 @@ std::pair PresetCollection::load_external_preset( cfg.erase("print_host_webui"); cfg.erase("printhost_apikey"); cfg.erase("printhost_cafile"); + cfg.erase("printhost_user"); + cfg.erase("printhost_password"); + cfg.erase("printhost_port"); + const auto &keys = cfg.keys(); cfg.apply_only(combined_config, keys, true); std::string &inherits = Preset::inherits(cfg); diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 88b917ced..d62dadcd7 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -1868,6 +1868,9 @@ DynamicPrintConfig PresetBundle::full_config_secure() const config.erase("print_host_webui"); config.erase("printhost_apikey"); config.erase("printhost_cafile"); + config.erase("printhost_user"); + config.erase("printhost_password"); + config.erase("printhost_port"); return config; }