projects
/
APKPM.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
93b0427
)
implement psql plain-text output
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 8 Jul 2011 23:20:22 +0000
(
01:20
+0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 8 Jul 2011 23:20:22 +0000
(
01:20
+0200)
web_ui.pl
patch
|
blob
|
history
diff --git
a/web_ui.pl
b/web_ui.pl
index
52ad371
..
76d2132
100755
(executable)
--- a/
web_ui.pl
+++ b/
web_ui.pl
@@
-193,6
+193,16
@@
get '/user' => sub {
$self->render('user');
};
$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( "\$ <b><tt>$command</tt></b>\n\n<pre>$output</pre>" );
+};
+
+# create pid file
open(my $pid, '>', '/tmp/apkpm.web_ui.pid');
print $pid "$$\n";
close $pid;
open(my $pid, '>', '/tmp/apkpm.web_ui.pid');
print $pid "$$\n";
close $pid;