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 cgi-bin/ ./cgi-bin/
|
||||||
COPY public/ ./public/
|
COPY public/ ./public/
|
||||||
COPY templates/ ./templates/
|
COPY templates/ ./templates/
|
||||||
COPY .counts .
|
|
||||||
COPY .mmCreds.xml .
|
COPY .mmCreds.xml .
|
||||||
COPY .msg.bans .
|
COPY .msg.bans .
|
||||||
COPY .name.bans .
|
COPY .name.bans .
|
||||||
|
|
|
@ -139,14 +139,14 @@ sub params_in {
|
||||||
# Parse the banned names list
|
# Parse the banned names list
|
||||||
chomp(my @nameBan = <$nameBans>);
|
chomp(my @nameBan = <$nameBans>);
|
||||||
for (@nameBan) {
|
for (@nameBan) {
|
||||||
last if $ban == 1;
|
last if $ban;
|
||||||
$ban = 1 if $name =~ /$_/;
|
$ban = 1 if $name =~ /$_/;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse the banned phrases list
|
# Parse the banned phrases list
|
||||||
chomp(my @thoughtCrime = <$thoughtCrimes>);
|
chomp(my @thoughtCrime = <$thoughtCrimes>);
|
||||||
for (@thoughtCrime) {
|
for (@thoughtCrime) {
|
||||||
last if $ban == 1;
|
last if $ban;
|
||||||
$ban = 1 if $message =~ /$_/;
|
$ban = 1 if $message =~ /$_/;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
34
www-swagg.pl
34
www-swagg.pl
|
@ -6,30 +6,22 @@
|
||||||
use Mojolicious::Lite;
|
use Mojolicious::Lite;
|
||||||
use Regexp::Common qw{net};
|
use Regexp::Common qw{net};
|
||||||
use Digest::SHA qw{sha1_hex};
|
use Digest::SHA qw{sha1_hex};
|
||||||
use Fcntl qw{:flock :seek};
|
|
||||||
use Number::Format qw{format_number};
|
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
|
# The main landing page; pass in the output of the fortune command
|
||||||
get '/' => sub {
|
get '/' => sub {
|
||||||
my ($c) = @_;
|
my ($c) = @_;
|
||||||
my $fortune = `/usr/games/fortune` || `fortune` || "huh??\n";
|
my $fortune = `/usr/games/fortune` || `fortune` || "huh??\n";
|
||||||
my ($count, %serverSide);
|
my $count = format_number time; # Grab epoch and add commas
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Gather all our server-side stuff
|
# Gather all our server-side stuff
|
||||||
%serverSide = (
|
my %serverSide = (
|
||||||
count => $count,
|
count => $count,
|
||||||
fortune => $fortune
|
fortune => $fortune
|
||||||
);
|
);
|
||||||
|
@ -40,9 +32,6 @@ get '/' => sub {
|
||||||
# Deprecation of IE page
|
# Deprecation of IE page
|
||||||
get '/die';
|
get '/die';
|
||||||
|
|
||||||
# guest.cgi script
|
|
||||||
plugin CGI => ['/cgi-bin/guest' => './cgi-bin/guest_mm.cgi'];
|
|
||||||
|
|
||||||
get '/me';
|
get '/me';
|
||||||
|
|
||||||
get '/news';
|
get '/news';
|
||||||
|
@ -55,10 +44,10 @@ get '/news';
|
||||||
# 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 = lc $c->param('macaddr'); # Lower-case plz
|
my ($mac, $ula6);
|
||||||
my $ula6;
|
|
||||||
|
|
||||||
# Check the MAC
|
# Check the MAC
|
||||||
|
$mac = ($c->param('macaddr')) ? lc $c->param('macaddr') : '';
|
||||||
if ($mac =~ /$RE{net}{MAC}/) {
|
if ($mac =~ /$RE{net}{MAC}/) {
|
||||||
# Local vars for this bit
|
# Local vars for this bit
|
||||||
my (
|
my (
|
||||||
|
@ -99,8 +88,5 @@ get '/ula6' => sub {
|
||||||
$c->render(ula6 => $ula6);
|
$c->render(ula6 => $ula6);
|
||||||
};
|
};
|
||||||
|
|
||||||
# whoami.cgi script
|
|
||||||
plugin CGI => ['/cgi-bin/whoami' => './cgi-bin/whoami.cgi'];
|
|
||||||
|
|
||||||
# Send it
|
# Send it
|
||||||
app->start();
|
app->start();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user