Implement under
for session cookie
This commit is contained in:
parent
61a112a392
commit
051ff9a912
22
www-swagg.pl
22
www-swagg.pl
|
@ -8,26 +8,23 @@ use Regexp::Common qw{net};
|
||||||
use Digest::SHA qw{sha1_hex};
|
use Digest::SHA qw{sha1_hex};
|
||||||
use Number::Format qw{format_number};
|
use Number::Format qw{format_number};
|
||||||
|
|
||||||
## Let's set some things up first ##
|
|
||||||
|
|
||||||
plugin 'Config';
|
plugin 'Config';
|
||||||
|
|
||||||
# CGI scripts
|
# CGI scripts
|
||||||
plugin CGI => ['/cgi-bin/guest' => './cgi-bin/guest_mm.cgi'];
|
plugin CGI => ['/cgi-bin/guest' => './cgi-bin/guest_mm.cgi'];
|
||||||
plugin CGI => ['/cgi-bin/whoami' => './cgi-bin/whoami.cgi' ];
|
plugin CGI => ['/cgi-bin/whoami' => './cgi-bin/whoami.cgi' ];
|
||||||
|
|
||||||
# Handle the GDPR non-compliance banner via session cookie
|
under sub {
|
||||||
helper swaggSession => sub {
|
|
||||||
my ($c) = @_;
|
my ($c) = @_;
|
||||||
|
|
||||||
if ($c->cookie('banner') eq 'seen') {
|
if ($c->cookie('banner') eq 'seen') {
|
||||||
$c->session->{banner} = 'seen' unless $c->session->{banner}
|
$c->session->{banner} = 'seen' unless $c->session->{banner}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
## Begin routes ##
|
# The main landing page; index.html
|
||||||
|
|
||||||
# The main landing page; pass in the output of the fortune command
|
|
||||||
get '/' => sub {
|
get '/' => sub {
|
||||||
my ($c) = @_;
|
my ($c) = @_;
|
||||||
my $count = format_number time; # Grab epoch and add commas
|
my $count = format_number time; # Grab epoch and add commas
|
||||||
|
@ -38,8 +35,6 @@ get '/' => sub {
|
||||||
fortune => $fortune
|
fortune => $fortune
|
||||||
);
|
);
|
||||||
|
|
||||||
$c->swaggSession();
|
|
||||||
|
|
||||||
$c->render();
|
$c->render();
|
||||||
} => 'index';
|
} => 'index';
|
||||||
|
|
||||||
|
@ -92,22 +87,17 @@ get '/ula6' => sub {
|
||||||
$ula6 = $uniqueid . ':/48';
|
$ula6 = $uniqueid . ':/48';
|
||||||
}
|
}
|
||||||
|
|
||||||
$c->swaggSession();
|
|
||||||
|
|
||||||
$c->render(ula6 => $ula6);
|
$c->render(ula6 => $ula6);
|
||||||
};
|
};
|
||||||
|
|
||||||
# Catch any other route
|
# Default route
|
||||||
get '/:route' => [route => [qw{die me news}]] => sub {
|
get '/:route' => [route => [qw{die me news}]] => sub {
|
||||||
my ($c) = @_;
|
my ($c) = @_;
|
||||||
my $route = $c->stash('route');
|
my $route = $c->stash('route');
|
||||||
|
|
||||||
$c->swaggSession();
|
|
||||||
|
|
||||||
$c->render(template => $route);
|
$c->render(template => $route);
|
||||||
};
|
};
|
||||||
|
|
||||||
## Send it ##
|
# Send it
|
||||||
|
|
||||||
app->secrets(app->config->{secrets}) || die $!;
|
app->secrets(app->config->{secrets}) || die $!;
|
||||||
app->start();
|
app->start();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user