mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-29 23:39:24 +01:00
modules/compiler_vm: replace ix.io with 0x0.st for pastes
This commit is contained in:
parent
eae16b14b8
commit
347e4ac69f
@ -25,7 +25,7 @@ use PBot::Imports;
|
|||||||
# These are set by the /misc/update_version script
|
# These are set by the /misc/update_version script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 4405,
|
BUILD_REVISION => 4406,
|
||||||
BUILD_DATE => "2021-09-17",
|
BUILD_DATE => "2021-09-17",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ sub show_output {
|
|||||||
$pretty_code .= "$output\n";
|
$pretty_code .= "$output\n";
|
||||||
$pretty_code .= $output_closing_comment;
|
$pretty_code .= $output_closing_comment;
|
||||||
|
|
||||||
my $uri = $self->paste_ixio($pretty_code);
|
my $uri = $self->paste_0x0($pretty_code);
|
||||||
print "$uri\n";
|
print "$uri\n";
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
@ -289,6 +289,33 @@ sub paste_ixio {
|
|||||||
return $result;
|
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 {
|
sub execute {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user