+ * Display index
+ *
+ * @param Request $request The request instance
+ * @return Response The rendered view
+ */
+ public function index(Request $request): Response {
+ //Get user
+ $user = $this->security->getUser();
+
+ //With not enough albums
+ if (($this->count = $this->doctrine->getRepository(Album::class)->findCountAsInt($user?->getId())) < $this->page * $this->limit) {
+ //Throw 404
+ throw $this->createNotFoundException($this->translator->trans('Unable to find albums'));
+ }
+
+ //Get albums
+ if ($this->context['albums'] = $this->doctrine->getRepository(Album::class)->findAllAsArray($user?->getId(), $this->page, $this->limit)) {
+ //Set modified
+ $this->modified = max(array_map(function ($v) { return $v['modified']; }, $this->context['albums']));
+ //Without albums
+ } else {
+ //Set empty modified
+ $this->modified = new \DateTime('-1 year');
+ }
+
+ /*header('Content-Type: text/plain');
+ var_dump($this->context['albums']);
+ exit;*/
+
+ //Create response
+ $response = new Response();
+
+ //With logged user
+ if ($this->checker->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
+ //Set last modified
+ $response->setLastModified(new \DateTime('-1 year'));
+
+ //Set as private
+ $response->setPrivate();
+ //Without logged user
+ } else {
+ //Set etag
+ //XXX: only for public to force revalidation by last modified
+ $response->setEtag(md5(serialize($this->context['albums'])));
+
+ //Set last modified
+ $response->setLastModified($this->modified);
+
+ //Set as public
+ $response->setPublic();
+
+ //Without role and modification
+ if ($response->isNotModified($request)) {
+ //Return 304 response
+ return $response;
+ }
+ }
+
+ //Set keywords
+ /*$this->context['head']['keywords'] = implode(
+ ', ',
+ //Use closure to extract each unique article keywords sorted
+ (function ($t) {
+ //Return array
+ $r = [];
+
+ //Iterate on articles
+ foreach($t as $a) {
+ //Non empty keywords
+ if (!empty($a['keywords'])) {
+ //Iterate on keywords
+ foreach($a['keywords'] as $k) {
+ //Set keyword
+ $r[$k['title']] = $k['title'];
+ }
+ }
+ }
+
+ //Sort array
+ sort($r);
+
+ //Return array
+ return $r;
+ })($this->context['articles'])
+ );
+ //Get albums
+ $this->context['albums'] = $this->config['albums'];*/
+
+ //Return rendered response
+ return $this->render('@RapsysTree/index.html.twig', $this->context, $response);
+ }
+
+ /**
+ * The directory page
+ *
+ * Display directory
+ *
+ * @param Request $request The request instance
+ * @param string $path The directory path
+ * @return Response The rendered view
+ */
+ public function directory(Request $request, string $path): Response {
+ header('Content-Type: text/plain');
+ var_dump($path);
+ exit;
+
+ //Render template
+ $response = $this->render('@RapsysTree/directory.html.twig', $this->context);
+
+ $response->setEtag(md5($response->getContent()));
+ $response->setPublic();
+ $response->isNotModified($request);
+
+ //Return response
+ return $response;
+ }
+
+ /**
+ * The document page
+ *
+ * Display document