Verified Commit 86c319ba authored by Luc Didry's avatar Luc Didry

Put shortener helper in Mojolicious::Plugin::FiatTux::Helpers

parent b57ed760
Pipeline #83101 passed with stages
in 3 minutes and 26 seconds
......@@ -6,7 +6,7 @@ requires 'Mojolicious::Plugin::Mail';
requires 'Mojolicious::Plugin::GzipStatic';
requires 'Mojolicious::Plugin::StaticCache';
requires 'Mojolicious::Plugin::CSPHeader';
requires 'Mojolicious::Plugin::FiatTux::Helpers', '== 0.06', url => 'https://framagit.org/fiat-tux/mojolicious/mojolicious-plugin-fiattux-helpers/-/archive/0.06/mojolicious-plugin-fiattux-helpers-0.06.tar.gz';
requires 'Mojolicious::Plugin::FiatTux::Helpers', '== 0.07', url => 'https://framagit.org/fiat-tux/mojolicious/mojolicious-plugin-fiattux-helpers/-/archive/0.07/mojolicious-plugin-fiattux-helpers-0.07.tar.gz';
requires 'Mojolicious::Plugin::FiatTux::GrantAccess', '== 0.05', url => 'https://framagit.org/fiat-tux/mojolicious/mojolicious-plugin-fiattux-grantaccess/-/archive/0.05/mojolicious-plugin-fiattux-grantaccess-0.05.tar.gz';
requires 'Mojolicious::Plugin::FiatTux::Themes', '== 0.02', url => 'https://framagit.org/fiat-tux/mojolicious/mojolicious-plugin-fiattux-themes/-/archive/0.02/mojolicious-plugin-fiattux-themes-0.02.tar.gz';
requires 'Filesys::DiskUsage';
......
......@@ -2,7 +2,6 @@
package Lufi::Plugin::Helpers;
use Mojo::Base 'Mojolicious::Plugin';
use Lufi::DB::File;
use Data::Entropy qw(entropy_source);
sub register {
my ($self, $app) = @_;
......@@ -61,7 +60,6 @@ sub register {
$app->helper(provisioning => \&_provisioning);
$app->helper(get_empty => \&_get_empty);
$app->helper(shortener => \&_shortener);
$app->helper(ip => \&_ip);
$app->helper(default_delay => \&_default_delay);
$app->helper(max_delay => \&_max_delay);
......@@ -128,18 +126,6 @@ sub _get_empty {
return $ldfile;
}
sub _shortener {
my $c = shift;
my $length = shift;
my @chars = ('a'..'z','A'..'Z','0'..'9', '-', '_');
my $result = '';
foreach (1..$length) {
$result .= $chars[entropy_source->get_int(scalar(@chars))];
}
return $result;
}
sub _ip {
my $c = shift;
my $proxy = $c->req->headers->header('X-Forwarded-For');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment