1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2025-07-05 00:58:52 +02:00
Files
explain.depesz.com/lib/Explain/Plugin/StaticExists.pm
Hubert depesz Lubaczewski acb1952b1b Add proof-of-work (in JS) for contact form
There was too much spam from this contact form, so let's make it harder
for spammers to use.
2019-05-21 09:29:21 +02:00

23 lines
435 B
Perl

package Explain::Plugin::StaticExists;
use Mojo::Base qw( Mojolicious::Plugin );
use File::Spec;
sub register {
my ( $self, $app ) = @_;
$app->helper(
'static_exists' => sub {
my ( $self, $file ) = @_;
for my $path ( @{ $self->app->static->paths } ) {
return 1 if -e File::Spec->catfile( $path, split('/', $file ) );
}
return;
}
);
}
1;