mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 04:19:27 +01:00
replace ix.io with 0x0.st (#57)
* replace ix.io with 0x0.st * use form-data instead of urlencoded for 0x0.st
This commit is contained in:
parent
f426594d80
commit
39abe32613
@ -23,7 +23,7 @@ sub initialize {
|
||||
my ($self, %conf) = @_;
|
||||
|
||||
$self->{paste_sites} = [
|
||||
sub { $self->paste_ixio(@_) },
|
||||
sub { $self->paste_0x0st(@_) },
|
||||
];
|
||||
|
||||
$self->{current_site} = 0;
|
||||
@ -54,13 +54,15 @@ sub paste {
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub paste_ixio {
|
||||
sub paste_0x0st {
|
||||
my ($self, $text) = @_;
|
||||
my $ua = LWP::UserAgent::Paranoid->new(request_timeout => 10);
|
||||
$ua->agent("Mozilla/5.0");
|
||||
push @{$ua->requests_redirectable}, 'POST';
|
||||
my %post = ('f:1' => $text);
|
||||
my $response = $ua->post("http://ix.io", \%post);
|
||||
my $response = $ua->post(
|
||||
"https://0x0.st",
|
||||
[ file => [ undef, "file", Content => $text ] ],
|
||||
Content_Type => 'form-data'
|
||||
);
|
||||
alarm 1; # LWP::UserAgent::Paranoid kills alarm
|
||||
return "error pasting: " . $response->status_line if not $response->is_success;
|
||||
my $result = $response->content;
|
||||
|
Loading…
Reference in New Issue
Block a user