aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/index.php b/index.php
index d1eee098..8eb36d81 100644
--- a/index.php
+++ b/index.php
@@ -2232,12 +2232,13 @@ $app = new \Slim\App($container);
2232$app->group('/api/v1', function() { 2232$app->group('/api/v1', function() {
2233 $this->get('/info', '\Shaarli\Api\Controllers\Info:getInfo'); 2233 $this->get('/info', '\Shaarli\Api\Controllers\Info:getInfo');
2234 $this->get('/links', '\Shaarli\Api\Controllers\Links:getLinks'); 2234 $this->get('/links', '\Shaarli\Api\Controllers\Links:getLinks');
2235 $this->get('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:getLink');
2235})->add('\Shaarli\Api\ApiMiddleware'); 2236})->add('\Shaarli\Api\ApiMiddleware');
2236 2237
2237$response = $app->run(true); 2238$response = $app->run(true);
2238// Hack to make Slim and Shaarli router work together: 2239// Hack to make Slim and Shaarli router work together:
2239// If a Slim route isn't found, we call renderPage(). 2240// If a Slim route isn't found and NOT API call, we call renderPage().
2240if ($response->getStatusCode() == 404) { 2241if ($response->getStatusCode() == 404 && strpos($_SERVER['REQUEST_URI'], '/api/v1') === false) {
2241 // We use UTF-8 for proper international characters handling. 2242 // We use UTF-8 for proper international characters handling.
2242 header('Content-Type: text/html; charset=utf-8'); 2243 header('Content-Type: text/html; charset=utf-8');
2243 renderPage($conf, $pluginManager, $linkDb); 2244 renderPage($conf, $pluginManager, $linkDb);