mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-31 07:12:01 +08:00
upload file to connect - missing api key to work
This commit is contained in:
parent
da977db4c4
commit
55525d2ebf
@ -5857,6 +5857,23 @@ void Plater::connect_gcode()
|
||||
|
||||
// TODO: get api key from dialog_msg and upload the file
|
||||
// api key is not currently in the message
|
||||
std::string api_key;
|
||||
|
||||
// This is private key for our printer "Loki" - DELETE!
|
||||
//api_key = "PAARWQ2Ibd69fdbf";
|
||||
if (api_key.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::string connect_address = p->user_account->get_connect_address();
|
||||
|
||||
PhysicalPrinter ph_printer("connect_temp_printer", wxGetApp().preset_bundle->physical_printers.default_config(), *preset);
|
||||
ph_printer.config.opt_string("printhost_apikey") = api_key;
|
||||
ph_printer.config.opt_string("print_host") = connect_address;
|
||||
ph_printer.config.set_key_value("host_type", new ConfigOptionEnum<PrintHostType>(htPrusaConnect));
|
||||
DynamicPrintConfig* physical_printer_config = &ph_printer.config;
|
||||
|
||||
send_gcode_inner(physical_printer_config);
|
||||
}
|
||||
|
||||
void Plater::send_gcode()
|
||||
@ -5893,6 +5910,11 @@ void Plater::send_gcode()
|
||||
physical_printer_config->opt_string("printhost_apikey") = std::string();
|
||||
}
|
||||
*/
|
||||
send_gcode_inner(physical_printer_config);
|
||||
}
|
||||
|
||||
void Plater::send_gcode_inner(DynamicPrintConfig* physical_printer_config)
|
||||
{
|
||||
PrintHostJob upload_job(physical_printer_config);
|
||||
if (upload_job.empty())
|
||||
return;
|
||||
@ -5968,6 +5990,7 @@ void Plater::send_gcode()
|
||||
|
||||
p->export_gcode(fs::path(), false, std::move(upload_job));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called when the Eject button is pressed.
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
std::string get_access_token();
|
||||
const ConnectPrinterStateMap& get_printer_state_map() const { return m_printer_map; }
|
||||
const std::map<std::string, std::string> get_user_data() const { return m_user_data; }
|
||||
std::string get_connect_address() const { return "https://connect.prusa3d.com"; }
|
||||
|
||||
// standalone utility methods
|
||||
std::string get_model_from_json(const std::string& message) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user