diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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(). |
2240 | if ($response->getStatusCode() == 404) { | 2241 | if ($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); |