added perl makefile
This commit is contained in:
parent
9af44501cc
commit
eb36df7104
3 changed files with 26 additions and 4 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
@ -4,3 +4,12 @@ obj/
|
||||||
.clangd
|
.clangd
|
||||||
.depend
|
.depend
|
||||||
http/f/*
|
http/f/*
|
||||||
|
blib/
|
||||||
|
pm_to_blib
|
||||||
|
Makefile
|
||||||
|
Makefile.old
|
||||||
|
MANIFEST*
|
||||||
|
!MANIFEST.SKIP
|
||||||
|
META.*/
|
||||||
|
MYMETA.*
|
||||||
|
pm_to_blib
|
||||||
|
|
13
http/Makefile.PL
Normal file
13
http/Makefile.PL
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
use ExtUtils::MakeMaker;
|
||||||
|
|
||||||
|
WriteMakefile(
|
||||||
|
NAME => 'sakisafe',
|
||||||
|
PREREQ_PM => {
|
||||||
|
"Mojolicious" => 0,
|
||||||
|
"List::MoreUtils" => 0,
|
||||||
|
"Term::ANSIColor" => 0,
|
||||||
|
"MIME::Types" => 0,
|
||||||
|
"Path::Tiny" => 0
|
||||||
|
},
|
||||||
|
EXE_FILES => ['sakisafe.pl']
|
||||||
|
);
|
|
@ -9,21 +9,20 @@ use Carp;
|
||||||
use Term::ANSIColor;
|
use Term::ANSIColor;
|
||||||
use English;
|
use English;
|
||||||
use MIME::Types;
|
use MIME::Types;
|
||||||
|
use Path::Tiny;
|
||||||
use warnings;
|
use warnings;
|
||||||
use experimental 'signatures';
|
use experimental 'signatures';
|
||||||
use feature 'say';
|
use feature 'say';
|
||||||
plugin 'RenderFile';
|
plugin 'RenderFile';
|
||||||
|
|
||||||
# OpenBSD promises.
|
# OpenBSD promises.
|
||||||
my $openbsd = 0;
|
pledge("stdio cpath rpath wpath inet flock fattr") if $^O eq "openbsd";
|
||||||
$openbsd = 1 if $^O eq "openbsd";
|
|
||||||
pledge("stdio cpath rpath wpath inet flock fattr") if $openbsd;
|
|
||||||
|
|
||||||
# 100 MBs
|
# 100 MBs
|
||||||
|
|
||||||
my $MAX_SIZE = 1024 * 1024 * 100;
|
my $MAX_SIZE = 1024 * 1024 * 100;
|
||||||
|
|
||||||
my @BANNED = qw(); # Add banned IP addresses here
|
my @BANNED = path('banned.txt')->slurp_utf8 || qw(); # Add banned IP addresses here
|
||||||
my $dirname;
|
my $dirname;
|
||||||
my $link;
|
my $link;
|
||||||
|
|
||||||
|
@ -46,6 +45,7 @@ sub handle_file {
|
||||||
status => 400
|
status => 400
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( List::MoreUtils::any { /$c->tx->remote_address/ } uniq @BANNED ) {
|
if ( List::MoreUtils::any { /$c->tx->remote_address/ } uniq @BANNED ) {
|
||||||
$c->render(
|
$c->render(
|
||||||
text =>
|
text =>
|
||||||
|
|
Loading…
Add table
Reference in a new issue