You've already forked explain.depesz.com
mirror of
https://gitlab.com/depesz/explain.depesz.com.git
synced 2025-07-05 00:58:52 +02:00
There was too much spam from this contact form, so let's make it harder for spammers to use.
23 lines
435 B
Perl
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;
|