diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 39f2891f..614e2208 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,7 +25,7 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4405, + BUILD_REVISION => 4406, BUILD_DATE => "2021-09-17", }; diff --git a/modules/compiler_vm/languages/_default.pm b/modules/compiler_vm/languages/_default.pm index 407402b0..c57330d1 100755 --- a/modules/compiler_vm/languages/_default.pm +++ b/modules/compiler_vm/languages/_default.pm @@ -232,7 +232,7 @@ sub show_output { $pretty_code .= "$output\n"; $pretty_code .= $output_closing_comment; - my $uri = $self->paste_ixio($pretty_code); + my $uri = $self->paste_0x0($pretty_code); print "$uri\n"; exit 0; } @@ -289,6 +289,33 @@ sub paste_ixio { return $result; } +sub paste_0x0 { + my $self = shift; + my $text = join ' ', @_; + + $text =~ s/(.{120})\s/$1\n/g; + + my $ua = LWP::UserAgent->new(); + $ua->agent("Mozilla/5.0"); + push @{ $ua->requests_redirectable }, 'POST'; + $ua->timeout(10); + + my $response = $ua->post( + "https://0x0.st", + [ file => [ undef, "filename", Content => $text, 'Content-Type' => 'text/plain' ] ], + Content_Type => 'form-data' + ); + + if(not $response->is_success) { + return "error pasting: " . $response->status_line; + } + + my $result = $response->decoded_content; + $result =~ s/^\s+//; + $result =~ s/\s+$//; + return $result; +} + sub execute { my ($self) = @_;