diff options
Diffstat (limited to 'util')
-rwxr-xr-x | util/docker-init.sh | 9 | ||||
-rwxr-xr-x | util/vndb-dev-server.pl | 7 | ||||
-rwxr-xr-x | util/vndb3.pl | 74 |
3 files changed, 4 insertions, 86 deletions
diff --git a/util/docker-init.sh b/util/docker-init.sh index c78c5e76..d6994583 100755 --- a/util/docker-init.sh +++ b/util/docker-init.sh @@ -89,7 +89,7 @@ pg_start() { # Should run as devuser devshell() { cd /var/www - util/vndb-dev-server.pl $1 + util/vndb-dev-server.pl bash } @@ -100,15 +100,10 @@ case "$1" in su devuser -c '/var/www/util/docker-init.sh pg_start' exec su devuser -c '/var/www/util/docker-init.sh devshell' ;; - 3) - mkdevuser - su devuser -c '/var/www/util/docker-init.sh pg_start' - exec su devuser -c '/var/www/util/docker-init.sh devshell 3' - ;; pg_start) pg_start ;; devshell) - devshell $2 + devshell ;; esac diff --git a/util/vndb-dev-server.pl b/util/vndb-dev-server.pl index d1d051a8..a7571e10 100755 --- a/util/vndb-dev-server.pl +++ b/util/vndb-dev-server.pl @@ -15,8 +15,6 @@ use Cwd 'abs_path'; my $listen_port = $ENV{TUWF_HTTP_SERVER_PORT} || 3000; $ENV{TUWF_HTTP_SERVER_PORT} = $listen_port+1; -my $script = $ARGV[0] && $ARGV[0] eq '3' ? 'vndb3.pl' : 'vndb.pl'; - my($pid, $prog, $killed); sub prog_start { @@ -30,7 +28,7 @@ sub prog_start { } print $d; }; - $prog = run_cmd "$ROOT/util/$script", + $prog = run_cmd "$ROOT/util/vndb.pl", '$$' => \$pid, '>' => $output, '2>' => $output; @@ -104,7 +102,6 @@ sub checkmod { chdir $ROOT; $check->($_) for (qw{ util/vndb.pl - util/vndb3.pl data/conf.pl }); @@ -152,6 +149,6 @@ while(1) { my $prog_conn = AE::cv; tcp_connect '127.0.0.1', $ENV{TUWF_HTTP_SERVER_PORT}, sub { $prog_conn->send(shift); }; - my $prog_fh = $prog_conn->recv || die "Unable to connect to $script? $!"; + my $prog_fh = $prog_conn->recv || die "Unable to connect to vndb.pl? $!"; pipe_fhs($serv_fh, $prog_fh); } diff --git a/util/vndb3.pl b/util/vndb3.pl deleted file mode 100755 index 693639b0..00000000 --- a/util/vndb3.pl +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use TUWF; - -use Cwd 'abs_path'; -my $ROOT; -BEGIN { ($ROOT = abs_path $0) =~ s{/util/vndb3\.pl$}{}; } -use lib $ROOT.'/lib'; - -use PWLookup; -use VNDB::Config; - -$|=1; # Disable buffering on STDOUT, otherwise vndb-dev-server.pl won't pick up our readyness notification. - -# Make the configuration available as tuwf->conf -sub TUWF::Object::conf { config } - - -# Make our root path available as tuwf->root -# Optionally accepts other path components to assemble a file path: -# tuwf->root('static/sf/01/1.jpg') -sub TUWF::Object::root { shift; join '/', $ROOT, @_ } - - -# tuwf->imgpath(cg => $image_id) -sub TUWF::Object::imgpath { - tuwf->root(static => $_[1] => sprintf '%02d/%d.jpg', $_[2]%100, $_[2]); -} - - -# tuwf->imgurl(cv => $image_id) -sub TUWF::Object::imgurl { - sprintf '%s/%s/%02d/%d.jpg', $_[0]->conf->{url_static}, $_[1], $_[2]%100, $_[2]; -} - - -# tuwf->resDenied -sub TUWF::Object::resDenied { - TUWF::_very_simple_page(403, '403 - Permission Denied', 'You do not have the permission to access this page.'); -} - -# tuwf->isUnsafePass($pass) -sub TUWF::Object::isUnsafePass { - $_[0]->conf->{password_db} && PWLookup::lookup($_[0]->conf->{password_db}, $_[1]) -} - - -TUWF::set %{ config->{tuwf} || {} }; - -TUWF::set import_modules => 0; - -# If we're running standalone, serve www/ and static/ too. -TUWF::hook before => sub { - my $static = tuwf->{_TUWF}{http} && - ( tuwf->resFile(tuwf->root('www'), tuwf->reqPath) - || tuwf->resFile(tuwf->root('static'), tuwf->reqPath) - ); - if($static) { - tuwf->resHeader('Cache-Control' => 'max-age=31536000'); - tuwf->done; - } -}; - - -require VN3::Validation; # Load this early, to ensure the custom_validations are available -TUWF::load_recursive 'VN3'; - -if($ARGV[0] && $ARGV[0] eq 'elmgen') { - VN3::ElmGen::print(); -} else { - TUWF::run; -} |