Add GET /infos API endpoint

See https://framagit.org/luc/lutim/wikis/API for details

This commit is dedicated to Schoumi. Thx for your support on Tipeee :-)
This commit is contained in:
Luc Didry
2016-11-14 13:13:07 +01:00
parent c6ee5408da
commit f4f25aab4f
2 changed files with 21 additions and 1 deletions
+5 -1
View File
@@ -148,7 +148,7 @@ sub startup {
my $short;
do {
$short= $c->shortener($c->config->{length});
} while (LutimModel::Lutim->count('WHERE short = ?', $short) || $short eq 'about' || $short eq 'stats' || $short eq 'd' || $short eq 'm' || $short eq 'gallery' || $short eq 'zip');
} while (LutimModel::Lutim->count('WHERE short = ?', $short) || $short eq 'about' || $short eq 'stats' || $short eq 'd' || $short eq 'm' || $short eq 'gallery' || $short eq 'zip' || $short eq 'infos');
LutimModel::Lutim->create(
short => $short,
@@ -357,6 +357,10 @@ sub startup {
to('Controller#about')->
name('about');
$r->get('/infos')->
to('Controller#infos')->
name('infos');
$r->get('/stats')->
to('Controller#stats')->
name('stats');
+16
View File
@@ -51,6 +51,22 @@ sub stats {
);
}
sub infos {
my $c = shift;
$c->render(
json => {
broadcast_message => $c->config('broadcast_message'),
image_magick => ($im_loaded) ? true : false,
contact => $c->config('contact'),
max_file_size => $c->config('max_file_size'),
default_delay => $c->config('default_delay'),
max_delay => $c->config('max_delay'),
always_encrypt => ($c->config('always_encrypt')) ? true : false,
}
);
}
sub webapp {
my $c = shift;