Commit f4f25aab authored by Luc Didry's avatar Luc Didry

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 :-)
parent c6ee5408
......@@ -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');
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment