line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Command::nopaste::Service::shadowcat; |
2
|
1
|
|
|
1
|
|
635
|
use Mojo::Base 'Mojolicious::Command::nopaste::Service'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has description => "Post to paste.scsys.co.uk\n"; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has irc_handled => 1; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub paste { |
9
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
10
|
0
|
|
|
|
|
|
my $ua = $self->ua; |
11
|
0
|
|
|
|
|
|
$ua->max_redirects(0); |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
0
|
|
|
|
my $tx = $ua->post( 'http://paste.scsys.co.uk/paste' => form => { |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
14
|
|
|
|
|
|
|
channel => $self->channel || '', |
15
|
|
|
|
|
|
|
nick => $self->name || '', |
16
|
|
|
|
|
|
|
paste => $self->text, |
17
|
|
|
|
|
|
|
summary => $self->desc || '', |
18
|
|
|
|
|
|
|
}); |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
unless ($tx->res->is_status_class(200)) { |
21
|
0
|
|
|
|
|
|
say $tx->res->message; |
22
|
0
|
|
|
|
|
|
say $tx->res->body; |
23
|
0
|
|
|
|
|
|
exit 1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $redir = $tx->res->dom->at('meta[http-equiv="refresh"]')->{content}; |
29
|
0
|
0
|
|
|
|
|
my $url = $1 if $redir =~ /url=(.*)/; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
die "Could not find redirect url\n" unless $url; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
require Mojo::URL; |
34
|
0
|
|
|
|
|
|
$url = Mojo::URL->new($url); |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
$url->query( hl => 'on' ) if $self->language eq 'perl'; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $url; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|