ENH: skip more print_host related info
JIRA: STUDIO-6247 Change-Id: I32e4c24f377e90c79370f33282e1a4b84477d57e Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
a2ee8425ce
commit
9787cdb5a3
|
@ -1353,6 +1353,18 @@ void ConfigBase::save_to_json(const std::string &file, const std::string &name,
|
||||||
//record all the key-values
|
//record all the key-values
|
||||||
for (const std::string &opt_key : this->keys())
|
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);
|
const ConfigOption* opt = this->option(opt_key);
|
||||||
if ( opt->is_scalar() ) {
|
if ( opt->is_scalar() ) {
|
||||||
if (opt->type() == coString)
|
if (opt->type() == coString)
|
||||||
|
|
|
@ -3767,13 +3767,20 @@ void GCode::append_full_config(const Print &print, std::string &str)
|
||||||
{
|
{
|
||||||
const DynamicPrintConfig &cfg = print.full_print_config();
|
const DynamicPrintConfig &cfg = print.full_print_config();
|
||||||
// Sorted list of config keys, which shall not be stored into the G-code. Initializer list.
|
// 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<std::string_view> banned_keys({
|
||||||
"compatible_printers"sv,
|
"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()));
|
assert(std::is_sorted(banned_keys.begin(), banned_keys.end()));
|
||||||
auto is_banned = [](const std::string &key) {
|
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())
|
for (const std::string &key : cfg.keys())
|
||||||
if (! is_banned(key) && ! cfg.option(key)->is_nil())
|
if (! is_banned(key) && ! cfg.option(key)->is_nil())
|
||||||
|
|
|
@ -1867,6 +1867,10 @@ std::pair<Preset*, bool> PresetCollection::load_external_preset(
|
||||||
cfg.erase("print_host_webui");
|
cfg.erase("print_host_webui");
|
||||||
cfg.erase("printhost_apikey");
|
cfg.erase("printhost_apikey");
|
||||||
cfg.erase("printhost_cafile");
|
cfg.erase("printhost_cafile");
|
||||||
|
cfg.erase("printhost_user");
|
||||||
|
cfg.erase("printhost_password");
|
||||||
|
cfg.erase("printhost_port");
|
||||||
|
|
||||||
const auto &keys = cfg.keys();
|
const auto &keys = cfg.keys();
|
||||||
cfg.apply_only(combined_config, keys, true);
|
cfg.apply_only(combined_config, keys, true);
|
||||||
std::string &inherits = Preset::inherits(cfg);
|
std::string &inherits = Preset::inherits(cfg);
|
||||||
|
|
|
@ -1868,6 +1868,9 @@ DynamicPrintConfig PresetBundle::full_config_secure() const
|
||||||
config.erase("print_host_webui");
|
config.erase("print_host_webui");
|
||||||
config.erase("printhost_apikey");
|
config.erase("printhost_apikey");
|
||||||
config.erase("printhost_cafile");
|
config.erase("printhost_cafile");
|
||||||
|
config.erase("printhost_user");
|
||||||
|
config.erase("printhost_password");
|
||||||
|
config.erase("printhost_port");
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue