mirror of
https://github.com/perlbot/perlbuut-pastebin
synced 2025-06-07 22:26:01 -04:00
More url fixes
This commit is contained in:
parent
899876daee
commit
f81600812c
2 changed files with 1 additions and 27 deletions
|
@ -74,7 +74,7 @@ sub api_post_paste {
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($c->param('redirect')) {
|
if ($c->param('redirect')) {
|
||||||
$c->redirect_to("/pastebin/$id");
|
$c->redirect_to("/p/$id");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ sub routes {
|
||||||
$route->(get => '/edit' => 'to_root');
|
$route->(get => '/edit' => 'to_root');
|
||||||
|
|
||||||
$route->(get => '/' => 'root');
|
$route->(get => '/' => 'root');
|
||||||
$route->(post => '/paste' => 'post_paste');
|
|
||||||
$route->(get => '/edit/:pasteid' => 'edit_paste');
|
$route->(get => '/edit/:pasteid' => 'edit_paste');
|
||||||
$route->(get => '/raw/:pasteid' => 'raw_paste');
|
$route->(get => '/raw/:pasteid' => 'raw_paste');
|
||||||
$route->(get => '/pastebin/:pasteid' => 'get_paste');
|
$route->(get => '/pastebin/:pasteid' => 'get_paste');
|
||||||
|
@ -42,31 +41,6 @@ sub root {
|
||||||
$c->render("page");
|
$c->render("page");
|
||||||
};
|
};
|
||||||
|
|
||||||
sub post_paste {
|
|
||||||
my $c = shift;
|
|
||||||
|
|
||||||
my @args = map {($c->param($_))} qw/paste name desc chan expire language/;
|
|
||||||
|
|
||||||
my $id = $c->paste->insert_pastebin(@args);
|
|
||||||
my ($code, $who, $desc, $channel) = @args;
|
|
||||||
|
|
||||||
# TODO select which one based on config
|
|
||||||
# TODO make this use the config, or http params for the url
|
|
||||||
|
|
||||||
# FIXME do this properly
|
|
||||||
# if (my $type = App::Spamfilter::is_spam($c, $who, $desc, $code)) {
|
|
||||||
# warn "I thought this was spam! $type";
|
|
||||||
if ($channel) { # TODO config for allowing announcements
|
|
||||||
my $words = qr/nigger|jew|spic|tranny|trannies|fuck|shit|piss|cunt|asshole/i;
|
|
||||||
unless ($code =~ $words || $who =~ $words || $desc =~ $words) {
|
|
||||||
$c->perlbot->announce($channel, $who, substr($desc, 0, 40), "https://perlbot.pl/pastebin/$id");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$c->redirect_to('/pastebin/'.$id);
|
|
||||||
#$c->render(text => "post accepted! $id");
|
|
||||||
};
|
|
||||||
|
|
||||||
sub edit_paste {
|
sub edit_paste {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue