diff --git a/app.cfg b/app.cfg index 9ea1faf..5a43341 100644 --- a/app.cfg +++ b/app.cfg @@ -55,6 +55,7 @@ protocol="perlbot" "192.168.32.1:perlbot-magnet:#perl"="irc.perl.org #perl" "192.168.32.1:perlbot-magnet:#perl-help"="irc.perl.org #perl-help" "192.168.32.1:perlbot-magnet:#win32"="irc.perl.org #win32" +"192.168.32.1:perlbot-magnet:#toolchain"="irc.perl.org #toolchain" "192.168.32.1:perlbot-oftc:#perl"="OFTC #perl" "192.168.32.1:perlbot-oftc:#perlbot"="OFTC #perlbot" "192.168.32.1:perlbot-efnet:#perl"="EFNet #perl" diff --git a/cpanfile b/cpanfile index 403ade7..16aafe3 100644 --- a/cpanfile +++ b/cpanfile @@ -9,5 +9,6 @@ requires 'DBD::SQLite'; requires 'Mojolicious::Lite'; requires 'Mojolicious::Plugin::TtRenderer'; requires 'Mojolicious::Plugin::BlogSpam'; +requires 'Mojolicious::Plugin::RemoteAddr'; requires 'App::EvalServerAdvanced::Protocol'; requires 'Future::Mojo'; diff --git a/lib/App.pm b/lib/App.pm index fbd1f85..ca9e1f4 100644 --- a/lib/App.pm +++ b/lib/App.pm @@ -22,6 +22,8 @@ sub startup { $self->config($cfg->{mojolicious}); + $self->plugin('RemoteAddr'); + $self->plugin('tt_renderer' => { template_options => { PRE_CHOMP => 1, diff --git a/lib/App/Controller/Apiv1.pm b/lib/App/Controller/Apiv1.pm index 978e16a..b560315 100644 --- a/lib/App/Controller/Apiv1.pm +++ b/lib/App/Controller/Apiv1.pm @@ -62,7 +62,7 @@ sub api_post_paste { my @args = map {($c->param($_))} qw/paste username description channel expire language/; - my $id = $c->paste->insert_pastebin(@args, $c->tx->remote_address); + my $id = $c->paste->insert_pastebin(@args, $c->remote_addr); my ($code, $who, $desc, $channel) = @args; # TODO select which one based on config @@ -73,8 +73,10 @@ sub api_post_paste { # } else { if ($channel) { # TODO config for allowing announcements my $words = $c->paste->banned_word_list_re; - unless ($code =~ $words || $who =~ $words || $desc =~ $words || $c->paste->is_banned_ip($c->tx->remote_address)) { - $c->perlbot->announce($channel, $who, substr($desc, 0, 40), $c->req->url->base()."/p/$id"); + my $url = $c->req->url->base()."/p/$id"; + $url =~ s|http:|https:|; + unless ($code =~ $words || $who =~ $words || $desc =~ $words || $c->paste->is_banned_ip($c->remote_addr)) { + $c->perlbot->announce($channel, $who, substr($desc, 0, 40), $url); } } # } diff --git a/lib/App/Controller/Apiv2.pm b/lib/App/Controller/Apiv2.pm index 68fd211..388f88f 100644 --- a/lib/App/Controller/Apiv2.pm +++ b/lib/App/Controller/Apiv2.pm @@ -93,8 +93,10 @@ sub api_post_paste { # } else { if ($channel) { # TODO config for allowing announcements my $words = $c->paste->banned_word_list_re; + my $url = $c->req->url->base()."/p/$id"; + $url =~ s|http:|https:|; unless ($code =~ $words || $who =~ $words || $desc =~ $words || $c->paste->is_banned_ip($c->tx->remote_address)) { - $c->perlbot->announce($channel, $who, substr($desc, 0, 40), $c->req->url->base()."/p/$id"); + $c->perlbot->announce($channel, $who, substr($desc, 0, 40), $url); } } # } diff --git a/lib/App/Controller/Paste.pm b/lib/App/Controller/Paste.pm index 1372a37..5b43a90 100644 --- a/lib/App/Controller/Paste.pm +++ b/lib/App/Controller/Paste.pm @@ -22,6 +22,7 @@ sub routes { $route->(get => '/edit' => 'to_root'); $route->(get => '/' => 'root'); + $route->(get => '/headers' => 'headers'); $route->(get => '/edit/:pasteid' => 'edit_paste'); $route->(get => '/raw/:pasteid' => 'raw_paste'); $route->(get => '/pastebin/:pasteid' => 'get_paste'); @@ -111,5 +112,11 @@ sub robots { Disallow: /}, format => 'txt'); }; +sub headers { + my ($c) = @_; + + use Data::Dumper; + $c->render(text => Dumper($c->req)); +} 1; diff --git a/lib/App/Model/Eval.pm b/lib/App/Model/Eval.pm index 4048080..30f9fa2 100644 --- a/lib/App/Model/Eval.pm +++ b/lib/App/Model/Eval.pm @@ -35,7 +35,7 @@ sub get_eval { print "Entering\n"; if (@$langs == 1 && $langs->[0] eq "evalall") { - $langs = [qw/perl perl5.28 perl5.26 perl5.26t perl5.24 perl5.22 perl5.20 perl5.18 perl5.16 perl5.14 perl5.12 perl5.10 perl5.8 perl5.6/]; + $langs = [qw/perl perl5.28 perl5.26 perl5.26t perl5.24 perl5.22 perl5.20 perl5.18 perl5.16 perl5.14 perl5.12 perl5.10 perl5.8 perl5.6 perl5.8.8 perl5.10.0/]; } use Data::Dumper; diff --git a/lib/App/Model/Languages.pm b/lib/App/Model/Languages.pm index c743624..ea24fa0 100644 --- a/lib/App/Model/Languages.pm +++ b/lib/App/Model/Languages.pm @@ -41,6 +41,8 @@ my @langs = ( {name => "perl2", mode => "perl", description => "Perl 2"}, {name => "perl1", mode => "perl", description => "Perl 1"}, {name => "cperl", mode => "perl", description => "CPerl 5.26"}, + {name => "perl5.8.8", mode => "perl", description => "Perl 5.8.8 (Known bugs)"}, + {name => "perl5.10.0", mode => "perl", description => "Perl 5.10.0 (Known bugs)"}, ); diff --git a/lib/App/Model/Perlbot.pm b/lib/App/Model/Perlbot.pm index 08f992f..141d99d 100644 --- a/lib/App/Model/Perlbot.pm +++ b/lib/App/Model/Perlbot.pm @@ -13,9 +13,11 @@ sub announce { my $self = shift; my ($channel, $who, $what, $link) = @_; + printf "Sending to %s:%s = %s\n", $self->config->{host}, $self->config->{port}, "$channel\x1E$link\x1E$who\x1E$what\n"; my $socket = IO::Socket::INET->new( PeerAddr => $self->config->{host}, PeerPort => $self->config->{port} ) or die "error: cannot connect to announce server: $! ".$self->config->{host} . ":" .$self->config->{port}; + print $socket "$channel\x1E$link\x1E$who\x1E$what\n"; close($socket); } diff --git a/templates/editor.html b/templates/editor.html index 001b3f3..bc52cc8 100755 --- a/templates/editor.html +++ b/templates/editor.html @@ -49,6 +49,10 @@ "magnet.perl.bot": "192.168.32.1:perlbot-magnet:", "o.perl.bot": "192.168.32.1:perlbot-oftc:", "oftc.perl.bot": "192.168.32.1:perlbot-oftc:", + "e.perl.bot": "192.168.32.1:perlbot-efnet", + "efnet.perl.bot": "192.168.32.1:perlbot-efnet", + "e.perlbot.pl": "192.168.32.1:perlbot-efnet", + "efnet.perlbot.pl": "192.168.32.1:perlbot-efnet", }; if (channel && servers[hostname]) { // only do this if we have a channel and a valid server