3 declare(strict_types
=1);
5 namespace Shaarli\Front\Controller\Admin
;
8 use Slim\Http\Response
;
11 * Controller used to retrieve/update bookmark's metadata.
13 class MetadataController
extends ShaarliAdminController
16 * GET /admin/metadata/{url} - Attempt to retrieve the bookmark title from provided URL.
18 public function ajaxRetrieveTitle(Request
$request, Response
$response): Response
20 $url = $request->getParam('url');
22 // Only try to extract metadata from URL with HTTP(s) scheme
23 if (!empty($url) && strpos(get_url_scheme($url) ?: '', 'http') !== false) {
24 return $response->withJson($this->container
->metadataRetriever
->retrieve($url));
27 return $response->withJson([]);