Clean up some errors
This commit is contained in:
parent
5f41255197
commit
f84c4964be
|
@ -19,7 +19,6 @@ WORKDIR /opt
|
|||
COPY cgi-bin/ ./cgi-bin/
|
||||
COPY public/ ./public/
|
||||
COPY templates/ ./templates/
|
||||
COPY .counts .
|
||||
COPY .mmCreds.xml .
|
||||
COPY .msg.bans .
|
||||
COPY .name.bans .
|
||||
|
|
|
@ -139,14 +139,14 @@ sub params_in {
|
|||
# Parse the banned names list
|
||||
chomp(my @nameBan = <$nameBans>);
|
||||
for (@nameBan) {
|
||||
last if $ban == 1;
|
||||
last if $ban;
|
||||
$ban = 1 if $name =~ /$_/;
|
||||
}
|
||||
|
||||
# Parse the banned phrases list
|
||||
chomp(my @thoughtCrime = <$thoughtCrimes>);
|
||||
for (@thoughtCrime) {
|
||||
last if $ban == 1;
|
||||
last if $ban;
|
||||
$ban = 1 if $message =~ /$_/;
|
||||
}
|
||||
|
||||
|
|
34
www-swagg.pl
34
www-swagg.pl
|
@ -6,30 +6,22 @@
|
|||
use Mojolicious::Lite;
|
||||
use Regexp::Common qw{net};
|
||||
use Digest::SHA qw{sha1_hex};
|
||||
use Fcntl qw{:flock :seek};
|
||||
use Number::Format qw{format_number};
|
||||
|
||||
# guest.cgi script
|
||||
plugin CGI => ['/cgi-bin/guest' => './cgi-bin/guest_mm.cgi'];
|
||||
|
||||
# whoami.cgi script
|
||||
plugin CGI => ['/cgi-bin/whoami' => './cgi-bin/whoami.cgi'];
|
||||
|
||||
# The main landing page; pass in the output of the fortune command
|
||||
get '/' => sub {
|
||||
my ($c) = @_;
|
||||
my $fortune = `/usr/games/fortune` || `fortune` || "huh??\n";
|
||||
my ($count, %serverSide);
|
||||
|
||||
# Visitor counter ala the ol' count.cgi script
|
||||
# TODO: clean up and variable-ize filehandles
|
||||
open(IN,"+<.counts"); # Open it
|
||||
flock(IN,LOCK_EX); # Lock the file (exclusive lock)
|
||||
seek(IN,0,SEEK_SET); # Rewind it to the beginning
|
||||
$count = <IN>; # Read only the first line
|
||||
$count = ++$count; # Increment counter
|
||||
truncate(IN,0); # This erases the file to length=0
|
||||
seek(IN,0,SEEK_SET); # Rewind it to the beginning
|
||||
print IN "$count\n"; # Write out the new count
|
||||
close(IN); # Close the file.
|
||||
$count = format_number($count); # Add commas
|
||||
my $count = format_number time; # Grab epoch and add commas
|
||||
|
||||
# Gather all our server-side stuff
|
||||
%serverSide = (
|
||||
my %serverSide = (
|
||||
count => $count,
|
||||
fortune => $fortune
|
||||
);
|
||||
|
@ -40,9 +32,6 @@ get '/' => sub {
|
|||
# Deprecation of IE page
|
||||
get '/die';
|
||||
|
||||
# guest.cgi script
|
||||
plugin CGI => ['/cgi-bin/guest' => './cgi-bin/guest_mm.cgi'];
|
||||
|
||||
get '/me';
|
||||
|
||||
get '/news';
|
||||
|
@ -55,10 +44,10 @@ get '/news';
|
|||
# TODO: This ancient code could certainly be cleaned up
|
||||
get '/ula6' => sub {
|
||||
my ($c) = @_;
|
||||
my $mac = lc $c->param('macaddr'); # Lower-case plz
|
||||
my $ula6;
|
||||
my ($mac, $ula6);
|
||||
|
||||
# Check the MAC
|
||||
$mac = ($c->param('macaddr')) ? lc $c->param('macaddr') : '';
|
||||
if ($mac =~ /$RE{net}{MAC}/) {
|
||||
# Local vars for this bit
|
||||
my (
|
||||
|
@ -99,8 +88,5 @@ get '/ula6' => sub {
|
|||
$c->render(ula6 => $ula6);
|
||||
};
|
||||
|
||||
# whoami.cgi script
|
||||
plugin CGI => ['/cgi-bin/whoami' => './cgi-bin/whoami.cgi'];
|
||||
|
||||
# Send it
|
||||
app->start();
|
||||
|
|
Loading…
Reference in a new issue