From: Dobrica Pavlinusic Date: Fri, 8 Jul 2011 23:20:22 +0000 (+0200) Subject: implement psql plain-text output X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;ds=sidebyside;h=e79823145e31e7e78e7cc8b4875ef3b96185cce0;p=APKPM.git implement psql plain-text output --- diff --git a/web_ui.pl b/web_ui.pl index 52ad371..76d2132 100755 --- a/web_ui.pl +++ b/web_ui.pl @@ -193,6 +193,16 @@ get '/user' => sub { $self->render('user'); }; +get '/psql/:command' => sub { + my $self = shift; + my $command = $self->param('command'); + $command =~ s/^_/\\/ && warn "internal psql command $command"; + $command = sprintf "psql -c '%s' apkpm", $command; + my $output = `$command`; # FIXME unsecure + $self->render_text( "\$ $command\n\n
$output
" ); +}; + +# create pid file open(my $pid, '>', '/tmp/apkpm.web_ui.pid'); print $pid "$$\n"; close $pid;