2018-11-12 03:08:33 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Slim\Http\Request;
|
|
|
|
use Slim\Http\Response;
|
|
|
|
|
|
|
|
// Routes
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var $app \Slim\App
|
|
|
|
*/
|
|
|
|
|
2019-02-03 15:30:31 +01:00
|
|
|
$app->get('/servers/surprise', \Friendica\Directory\Routes\Http\Surprise::class);
|
2018-11-16 05:59:00 +01:00
|
|
|
$app->get('/servers', \Friendica\Directory\Routes\Web\Servers::class);
|
2018-11-12 03:08:33 +01:00
|
|
|
|
2018-11-16 05:59:00 +01:00
|
|
|
$app->get('/search[/{account_type}]', function (Request $request, Response $response, $args) {
|
|
|
|
if ($request->getAttribute('negotiation')->getMediaType() == 'application/json') {
|
|
|
|
$route = new \Friendica\Directory\Routes\Http\Search($this);
|
|
|
|
} else {
|
|
|
|
$route = new \Friendica\Directory\Routes\Web\Search($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $route($request, $response, $args);
|
|
|
|
})->setName('search');
|
2018-11-12 03:08:33 +01:00
|
|
|
|
2018-12-24 03:22:52 +01:00
|
|
|
$app->post('/msearch', \Friendica\Directory\Routes\Http\MatchSearch::class);
|
|
|
|
|
2018-11-18 16:38:43 +01:00
|
|
|
$app->get('/stats', \Friendica\Directory\Routes\Web\Statistics::class);
|
|
|
|
|
2018-11-12 03:08:33 +01:00
|
|
|
$app->get('/submit', \Friendica\Directory\Routes\Http\Submit::class);
|
|
|
|
|
|
|
|
$app->get('/photo/{profile_id:[0-9]+}.jpg', \Friendica\Directory\Routes\Http\Photo::class)->setName('photo');
|
|
|
|
|
|
|
|
$app->get('/sync/pull/all', \Friendica\Directory\Routes\Http\SyncPull::class);
|
|
|
|
$app->get('/sync/pull/since/{since}', \Friendica\Directory\Routes\Http\SyncPull::class);
|
|
|
|
|
|
|
|
$app->get('/VERSION', function (Request $request, Response $response) {
|
|
|
|
$response->getBody()->write(file_get_contents(__DIR__ . '/../VERSION'));
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
});
|
|
|
|
|
2018-11-20 04:12:09 +01:00
|
|
|
|
|
|
|
foreach(glob(__DIR__ . '/../config/pages/*.html') as $page) {
|
|
|
|
$app->get('/' . strtolower(basename($page, '.html')), function (Request $request, Response $response, $args) use ($page) {
|
|
|
|
$route = new \Friendica\Directory\Routes\Web\Pages($this, $page);
|
|
|
|
|
|
|
|
return $route($request, $response, $args);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-11-16 05:59:00 +01:00
|
|
|
$app->get('/[{account_type}]', \Friendica\Directory\Routes\Web\Directory::class)->setName('directory');
|