Added Cache-Control header + use POD for the ncdu manual

This commit is contained in:
Yorhel 2012-01-18 11:32:59 +01:00
parent b7746b3122
commit 72a63e80dd
2 changed files with 151 additions and 115 deletions

View file

@ -13,7 +13,7 @@ BEGIN { ($ROOT = abs_path $0) =~ s{index\.cgi$}{}; }
TUWF::register(
qr{} => sub { podpage(shift, 'home', '', '', "Yorhel's Projects") },
qr{ncdu} => sub { podpage(shift, 'ncdu', 'ncdu', '', 'NCurses Disk Usage') },
qr{ncdu/man} => sub { manpage(shift, 'ncdu-man', 'ncdu', 'man', 'Ncdu Manual') },
qr{ncdu/man} => sub { podpage(shift, 'ncdu-man', 'ncdu', 'man', 'Ncdu Manual') },
qr{ncdu/changes} => sub { changelog(shift, 'ncdu-changelog', 'ncdu', 'changes', 'Ncdu Changelog') },
qr{ncdu/scr} => sub { podpage(shift, 'ncdu-scr', 'ncdu', 'scr', 'Ncdu Screenshots') },
qr{ncdc} => sub { podpage(shift, 'ncdc', 'ncdc', '', 'NCurses Direct Connect') },
@ -34,23 +34,14 @@ TUWF::register(
TUWF::set(
logfile => '/www/err.log',
#pre_request_handler => sub { $ENV{REQUEST_URI} = $_[0]->reqGet('path')||''; 1 },
error_404_handler => \&notfound,
# this is a fairly static site, allow some aggressive caching
pre_request_handler => sub { $_[0]->resHeader('Cache-Control', 's-max-age=86400, max-age=3600'); 1; },
);
TUWF::run();
sub test {
my $s = shift;
$s->htmlHeader(title => 'Test', page => 'ncdu', sec => 'changes');
(my $f = $INC{"TUWF.pm"}) =~ s/\.pm$/.pod/;
#$s->htmlPOD($f, 1);
$s->htmlPOD('home');
$s->htmlFooter;
}
sub podpage {
my($s, $f, $p, $se, $t, $toc) = @_;
$s->htmlHeader(title => $t, page => $p, sec => $se);