Don't store the octoprint host key to the amf/3mf files.

This commit is contained in:
bubnikv 2018-12-06 14:42:15 +01:00
parent c6ef194094
commit edc306db45
4 changed files with 14 additions and 3 deletions

View file

@ -565,7 +565,8 @@ static bool profile_print_params_same(const DynamicPrintConfig &cfg1, const Dyna
for (const char *key : { "compatible_prints", "compatible_prints_condition",
"compatible_printers", "compatible_printers_condition", "inherits",
"print_settings_id", "filament_settings_id", "sla_print_settings_id", "sla_material_settings_id", "printer_settings_id",
"printer_model", "printer_variant", "default_print_profile", "default_filament_profile", "default_sla_print_profile", "default_sla_material_profile" })
"printer_model", "printer_variant", "default_print_profile", "default_filament_profile", "default_sla_print_profile", "default_sla_material_profile",
"printhost_apikey", "printhost_cafile" })
diff.erase(std::remove(diff.begin(), diff.end(), key), diff.end());
// Preset with the same name as stored inside the config exists.
return diff.empty();

View file

@ -445,6 +445,14 @@ DynamicPrintConfig PresetBundle::full_config() const
this->full_sla_config();
}
DynamicPrintConfig PresetBundle::full_config_secure() const
{
DynamicPrintConfig config = this->full_config();
config.erase("printhost_apikey");
config.erase("printhost_cafile");
return config;
}
DynamicPrintConfig PresetBundle::full_fff_config() const
{
DynamicPrintConfig out;

View file

@ -65,6 +65,8 @@ public:
{ return prints.has_defaults_only() && filaments.has_defaults_only() && printers.has_defaults_only(); }
DynamicPrintConfig full_config() const;
// full_config() with the "printhost_apikey" and "printhost_cafile" removed.
DynamicPrintConfig full_config_secure() const;
// Load user configuration and store it into the user profiles.
// This method is called by the configuration wizard.

View file

@ -352,7 +352,7 @@ void fix_model_by_win10_sdk_gui(const ModelObject &model_object, const Print &pr
Model model;
DynamicPrintConfig config;
model.add_object(model_object);
if (! Slic3r::store_3mf(path_src.string().c_str(), &model, &config/*const_cast<Print*>(&print), false*/)) {
if (! Slic3r::store_3mf(path_src.string().c_str(), &model, &config)) {
boost::filesystem::remove(path_src);
throw std::runtime_error(L("Export of a temporary 3mf file failed"));
}
@ -365,7 +365,7 @@ void fix_model_by_win10_sdk_gui(const ModelObject &model_object, const Print &pr
boost::filesystem::remove(path_src);
// PresetBundle bundle;
on_progress(L("Loading the repaired model"), 80);
bool loaded = Slic3r::load_3mf(path_dst.string().c_str(), &config/*bundle*/, &result);
bool loaded = Slic3r::load_3mf(path_dst.string().c_str(), &config, &result);
result.objects[0]->name = boost::filesystem::path(model_object.name).filename().stem().string() + "_fixed";
boost::filesystem::remove(path_dst);
if (! loaded)