Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ if ($gui) {
Wx::GLCanvas 0
OpenGL 0
LWP::UserAgent 0
Bundle::LWP 0
Net::Bonjour 0
Net::SSL 0
);
if ($^O eq 'MSWin32') {
$recommends{"Win32::TieRegistry"} = 0;
Expand Down
23 changes: 21 additions & 2 deletions lib/Slic3r/GUI/Plater.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ use Wx::Event qw(EVT_BUTTON EVT_COMMAND EVT_KEY_DOWN EVT_MOUSE_EVENTS EVT_PAINT
use base qw(Wx::Panel Class::Accessor);
use Slic3r::GUI::ColorScheme;

use Net::SSL;
$ENV{HTTPS_VERSION} = 3;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

__PACKAGE__->mk_accessors(qw(presets));

use constant TB_ADD => &Wx::NewId;
Expand Down Expand Up @@ -2345,13 +2349,21 @@ sub prepare_send {
"Checking whether file already exists…", 100, $self, 0);
$progress->Pulse;

my $host;
if ($self->{config}->print_host !~ /^http/) {
$host = "http://" . $self->{config}->print_host;
}
else {
$host = $self->{config}->print_host;
}

my $ua = LWP::UserAgent->new;
$ua->timeout(5);
my $res;
if ($self->{config}->print_host) {
if($self->{config}->host_type eq 'octoprint'){
$res = $ua->get(
"http://" . $self->{config}->print_host . "/api/files/local",
$host . "/api/files/local",
'X-Api-Key' => $self->{config}->octoprint_apikey,
);
}else {
Expand Down Expand Up @@ -2395,9 +2407,16 @@ sub send_gcode {
my $filename = basename($self->{print}->output_filepath($main::opt{output} // ''));
my $res;
if($self->{config}->print_host){
my $host;
if ($self->{config}->print_host !~ /^http/) {
$host = "http://" . $self->{config}->print_host;
}
else {
$host = $self->{config}->print_host;
}
if($self->{config}->host_type eq 'octoprint'){
$res = $ua->post(
"http://" . $self->{config}->print_host . "/api/files/local",
$host . "/api/files/local",
Content_Type => 'form-data',
'X-Api-Key' => $self->{config}->octoprint_apikey,
Content => [
Expand Down
13 changes: 11 additions & 2 deletions lib/Slic3r/GUI/PresetEditor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ use Wx qw(:bookctrl :dialog :keycode :icon :id :misc :panel :sizer :treectrl :wi
:button wxTheApp);
use Wx::Event qw(EVT_BUTTON EVT_CHOICE EVT_KEY_DOWN EVT_TREE_SEL_CHANGED EVT_CHECKBOX);
use base qw(Wx::Panel Class::Accessor);
use Net::SSL;
$ENV{HTTPS_VERSION} = 3;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

__PACKAGE__->mk_accessors(qw(current_preset config));

Expand Down Expand Up @@ -1387,9 +1390,15 @@ sub build {
$host_line->append_button("Test", "wrench.png", sub {
my $ua = LWP::UserAgent->new;
$ua->timeout(10);

my $host;
if ($self->{config}->print_host !~ /^http/) {
$host = "http://" . $self->{config}->print_host;
}
else {
$host = $self->{config}->print_host;
}
my $res = $ua->get(
"http://" . $self->config->print_host . "/api/version",
$host . "/api/version",
'X-Api-Key' => $self->config->octoprint_apikey,
);
if ($res->is_success) {
Expand Down
2 changes: 2 additions & 0 deletions package/win/package_win32.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ pp `
-a "${STRAWBERRY_PATH}\c\bin\${glut};${glut}" `
-M AutoLoader `
-M B `
-M Bundle::LWP `
-M Carp `
-M Class::Accessor `
-M Config `
Expand Down Expand Up @@ -161,6 +162,7 @@ pp `
-M LWP::Protocol `
-M LWP::Protocol::http `
-M LWP::UserAgent `
-M Net::SSL `
-M List::Util `
-M Math::Trig `
-M Method::Generate::Accessor `
Expand Down