1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut-pastebin synced 2025-06-07 14:17:26 -04:00

Lots of stuff, forget all of it

This commit is contained in:
Ryan Voots 2019-05-08 17:54:34 -04:00
parent d6262a5f60
commit d2a41698d8
10 changed files with 28 additions and 5 deletions

View file

@ -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"

View file

@ -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';

View file

@ -22,6 +22,8 @@ sub startup {
$self->config($cfg->{mojolicious});
$self->plugin('RemoteAddr');
$self->plugin('tt_renderer' => {
template_options => {
PRE_CHOMP => 1,

View file

@ -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);
}
}
# }

View file

@ -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);
}
}
# }

View file

@ -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;

View file

@ -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;

View file

@ -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)"},
);

View file

@ -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);
}

View file

@ -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