Upgrade Perl version; remove redundant fat commas; clean up reflection page
This commit is contained in:
parent
b4c7d9896b
commit
49635e2b10
|
@ -1,4 +1,4 @@
|
||||||
FROM perl:5.32.1
|
FROM perl:5.34.0
|
||||||
|
|
||||||
# Move it
|
# Move it
|
||||||
WORKDIR /opt
|
WORKDIR /opt
|
||||||
|
@ -18,7 +18,6 @@ RUN apt-get -y upgrade
|
||||||
RUN apt-get -y install fortune-mod ruby
|
RUN apt-get -y install fortune-mod ruby
|
||||||
RUN cpanm --installdeps .
|
RUN cpanm --installdeps .
|
||||||
RUN gem install cgi
|
RUN gem install cgi
|
||||||
RUN gem install ipaddress
|
|
||||||
|
|
||||||
# Finish setting up the environment
|
# Finish setting up the environment
|
||||||
ENV MOJO_REVERSE_PROXY=1
|
ENV MOJO_REVERSE_PROXY=1
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
# Oct 2020
|
# Oct 2020
|
||||||
|
|
||||||
require 'cgi'
|
require 'cgi'
|
||||||
require 'ipaddress'
|
|
||||||
|
|
||||||
# Create CGI object
|
# Create CGI object
|
||||||
cgi = CGI.new('html4')
|
cgi = CGI.new('html4')
|
||||||
|
@ -38,7 +37,7 @@ cgi_env = {
|
||||||
'address' => remote_addr,
|
'address' => remote_addr,
|
||||||
'port' => remote_port,
|
'port' => remote_port,
|
||||||
'method' => request_method,
|
'method' => request_method,
|
||||||
'webmaster' => server_admin,
|
'webmaster' => 'swaggboi@slackware.uk',
|
||||||
'protocol' => server_protocol,
|
'protocol' => server_protocol,
|
||||||
'server' => server_software
|
'server' => server_software
|
||||||
}
|
}
|
||||||
|
@ -54,7 +53,7 @@ easter_egg = {
|
||||||
}
|
}
|
||||||
# Easter egg for IPv6
|
# Easter egg for IPv6
|
||||||
footer =
|
footer =
|
||||||
if IPAddress.valid_ipv6?(cgi_env['address'])
|
if cgi_env['address'] =~ /[a-fA-F:]/
|
||||||
cgi.img(easter_egg) + cgi.br + "\n" + cgi.br + "\n" + footer
|
cgi.img(easter_egg) + cgi.br + "\n" + cgi.br + "\n" + footer
|
||||||
else
|
else
|
||||||
'<iframe width="560"
|
'<iframe width="560"
|
||||||
|
|
12
public/index.html
Normal file
12
public/index.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Redirecting to Homepage</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/css/swagg.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Redirecting to Homepage</h1>
|
||||||
|
<p>Click <a href="/home">here</a> if not redirected automagically.</p>
|
||||||
|
<script>window.location.replace("/home");</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -37,7 +37,7 @@ under sub {
|
||||||
};
|
};
|
||||||
|
|
||||||
# The main landing page; index.html
|
# The main landing page; index.html
|
||||||
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
|
||||||
my $fortune = `/usr/games/fortune` || `fortune` || "huh??\n";
|
my $fortune = `/usr/games/fortune` || `fortune` || "huh??\n";
|
||||||
|
@ -48,7 +48,7 @@ get '/' => sub {
|
||||||
);
|
);
|
||||||
|
|
||||||
$c->render();
|
$c->render();
|
||||||
} => 'index';
|
}, 'index';
|
||||||
|
|
||||||
# Process mac address to ula6 ala the ol' ula6.cgi script:
|
# Process mac address to ula6 ala the ol' ula6.cgi script:
|
||||||
# - Current time of day in 64-bit NTP format
|
# - Current time of day in 64-bit NTP format
|
||||||
|
@ -56,7 +56,7 @@ get '/' => sub {
|
||||||
# - Cat first with second
|
# - Cat first with second
|
||||||
# - Compute SHA-1 of third and use least significant 40 bits
|
# - Compute SHA-1 of third and use least significant 40 bits
|
||||||
# TODO: This ancient code could certainly be cleaned up
|
# TODO: This ancient code could certainly be cleaned up
|
||||||
get '/ula6' => sub {
|
get '/ula6', sub {
|
||||||
my ($c) = @_;
|
my ($c) = @_;
|
||||||
my ($mac, $ula6);
|
my ($mac, $ula6);
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ get '/ula6' => sub {
|
||||||
};
|
};
|
||||||
|
|
||||||
# Default route
|
# Default route
|
||||||
get '/:route' => [route => [qw{die me news portal}]] => sub {
|
get '/:route', [route => [qw{die me news portal}]], sub {
|
||||||
my ($c) = @_;
|
my ($c) = @_;
|
||||||
|
|
||||||
$c->render(template => $c->stash('route'));
|
$c->render(template => $c->stash('route'));
|
||||||
|
|
Loading…
Reference in a new issue