Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/slic3r/Utils/OctoPrint.cpp')
-rw-r--r--src/slic3r/Utils/OctoPrint.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/slic3r/Utils/OctoPrint.cpp b/src/slic3r/Utils/OctoPrint.cpp
index ee87f822f..82d8a6bb6 100644
--- a/src/slic3r/Utils/OctoPrint.cpp
+++ b/src/slic3r/Utils/OctoPrint.cpp
@@ -170,6 +170,13 @@ std::string OctoPrint::make_url(const std::string &path) const
}
}
+SL1Host::SL1Host(DynamicPrintConfig *config) :
+ OctoPrint(config),
+ authorization_type(dynamic_cast<const ConfigOptionEnum<AuthorizationType>*>(config->option("printhost_authorization_type"))->value),
+ username(config->opt_string("printhost_user")),
+ password(config->opt_string("printhost_password"))
+{
+}
// SL1Host
const char* SL1Host::get_name() const { return "SL1Host"; }
@@ -191,4 +198,20 @@ bool SL1Host::validate_version_text(const boost::optional<std::string> &version_
return version_text ? boost::starts_with(*version_text, "Prusa SLA") : false;
}
+void SL1Host::set_auth(Http &http) const
+{
+ switch (authorization_type) {
+ case atKeyPassword:
+ http.header("X-Api-Key", get_apikey());
+ break;
+ case atUserPassword:
+ http.auth_digest(username, password);
+ break;
+ }
+
+ if (! get_cafile().empty()) {
+ http.ca_file(get_cafile());
+ }
+}
+
}