Support for SimplyPrint cloud integration (#4525)

* Make httpserver more generic and reusable

* Add OAuthJob

* Fix issue caused by the fact that the backing widget of the `TextCtrl` is no longer `wxTextCtrl`

* Implement login and token refresh

* Implement file upload

* Try fix build error

* Support BBL printers

* Show error message if user hasn't done OAuth

* Fix typo

* Update error message

* Disable unsupported options when SimplyPrint is selected
This commit is contained in:
Noisyfox
2024-03-23 10:08:48 +08:00
committed by GitHub
parent f3b3e92782
commit e29bbac193
27 changed files with 1075 additions and 228 deletions

View File

@@ -874,7 +874,7 @@ static std::vector<std::string> s_Preset_printer_options {
"nozzle_type", "nozzle_hrc","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types", "retract_lift_enforce","support_chamber_temp_control","support_air_filtration","printer_structure",
"best_object_pos","head_wrap_detect_zone",
//SoftFever
"host_type", "print_host", "printhost_apikey",
"host_type", "print_host", "printhost_apikey", "bbl_use_printhost",
"print_host_webui",
"printhost_cafile","printhost_port","printhost_authorization_type",
"printhost_user", "printhost_password", "printhost_ssl_ignore_revoke", "thumbnails", "thumbnails_format",
@@ -2941,6 +2941,7 @@ static std::vector<std::string> s_PhysicalPrinter_opts {
"preset_name", // temporary option to compatibility with older Slicer
"preset_names",
"printer_technology",
"bbl_use_printhost",
"host_type",
"print_host",
"print_host_webui",

View File

@@ -344,6 +344,13 @@ VendorType PresetBundle::get_current_vendor_type()
return t;
}
bool PresetBundle::use_bbl_network()
{
const auto cfg = printers.get_edited_preset().config;
const bool use_bbl_network = is_bbl_vendor() && !cfg.opt_bool("bbl_use_printhost");
return use_bbl_network;
}
//BBS: load project embedded presets
PresetsConfigSubstitutions PresetBundle::load_project_embedded_presets(std::vector<Preset*> project_presets, ForwardCompatibilitySubstitutionRule substitution_rule)
{

View File

@@ -97,6 +97,7 @@ public:
VendorType get_current_vendor_type();
// Vendor related handy functions
bool is_bbl_vendor() { return get_current_vendor_type() == VendorType::Marlin_BBL; }
bool use_bbl_network();
//BBS: project embedded preset logic
PresetsConfigSubstitutions load_project_embedded_presets(std::vector<Preset*> project_presets, ForwardCompatibilitySubstitutionRule substitution_rule);

View File

@@ -104,7 +104,8 @@ static t_config_enum_values s_keys_map_PrintHostType {
{ "repetier", htRepetier },
{ "mks", htMKS },
{ "obico", htObico },
{ "flashforge", htFlashforge}
{ "flashforge", htFlashforge },
{ "simplyprint", htSimplyPrint },
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PrintHostType)
@@ -542,6 +543,13 @@ void PrintConfigDef::init_common_params()
def->mode = comDevelop;
def->set_default_value(new ConfigOptionStrings());
def = this->add("bbl_use_printhost", coBool);
def->label = L("Use 3rd-party print host");
def->tooltip = L("Allow controlling BambuLab's printer through 3rd party print hosts");
def->mode = comAdvanced;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("print_host", coString);
def->label = L("Hostname, IP or URL");
def->tooltip = L("Orca Slicer can upload G-code files to a printer host. This field should contain "
@@ -3068,6 +3076,7 @@ def = this->add("filament_loading_speed", coFloats);
def->enum_values.push_back("mks");
def->enum_values.push_back("obico");
def->enum_values.push_back("flashforge");
def->enum_values.push_back("simplyprint");
def->enum_labels.push_back("PrusaLink");
def->enum_labels.push_back("PrusaConnect");
def->enum_labels.push_back("Octo/Klipper");
@@ -3078,6 +3087,7 @@ def = this->add("filament_loading_speed", coFloats);
def->enum_labels.push_back("MKS");
def->enum_labels.push_back("Obico");
def->enum_labels.push_back("Flashforge");
def->enum_labels.push_back("SimplyPrint");
def->mode = comAdvanced;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionEnum<PrintHostType>(htOctoPrint));

View File

@@ -59,7 +59,7 @@ enum class FuzzySkinType {
};
enum PrintHostType {
htPrusaLink, htPrusaConnect, htOctoPrint, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS, htObico, htFlashforge
htPrusaLink, htPrusaConnect, htOctoPrint, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS, htObico, htFlashforge, htSimplyPrint
};
enum AuthorizationType {