diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 9a6f39d63b388c47addd7793d22cc5599613cd4c..d13aa02fe934c54c4d154258364ba48b243a2dad 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -34,4 +34,4 @@ security: # switch_user: true access_control: - - { path: ^/(?!register|login|generate-captcha|verify/email|reset-password), roles: ROLE_USER } \ No newline at end of file + - { path: ^/(?!register|login|generate-captcha|verify/email|reset-password|preview|legacy), roles: ROLE_USER } \ No newline at end of file diff --git a/src/Controller/CapsuleController.php b/src/Controller/CapsuleController.php index 6591914ff9bba923e51b64ae4eb89baef4237393..e49221a66e11dd87ed5d789b815cb4518c834f1d 100644 --- a/src/Controller/CapsuleController.php +++ b/src/Controller/CapsuleController.php @@ -79,4 +79,17 @@ class CapsuleController extends AbstractController 'capsuleCreationForm' => $form->createView() ]); } + + /** + * @Route("/preview/{path}", name="preview_capsule") + */ + public function preview(string $path): Response + { + $url = $this->getParameter('app.legacy_external_prefix') . '/' . $path . "/?w=1"; + + return $this->render( + 'capsule/preview.html.twig', + [ 'url' => $url ] + ); + } } diff --git a/templates/capsule/index.html.twig b/templates/capsule/index.html.twig index d120f01091b9ebe5ad6f94b0ab576cad92e15440..e5e772bd8762f927b935caf263a123dd41215a6f 100644 --- a/templates/capsule/index.html.twig +++ b/templates/capsule/index.html.twig @@ -39,7 +39,7 @@ <div class="capsule-item pb-4 m-5"> <div class="d-flex flex-column flex-md-row justify-content-center align-items-center mt-sm-4"> <div class="list-item"> - <a href="{{ capsule.getEditionLink() }}" class="capsule-title"> + <a href="/preview/{{ capsule.getPreviewLink() }}/?w=1" class="capsule-title"> {{ capsule.getName() }} </a> </div> @@ -51,7 +51,7 @@ <div class="d-flex flex-column flex-md-row justify-content-center align-items-center"> <div class="m-4 ratio ratio-16x9"> <iframe - src="{{ legacy_url }}/{{ capsule.getPreviewLink() }}/?p=read" + src="/preview/{{ capsule.getPreviewLink() }}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe> diff --git a/templates/capsule/preview.html.twig b/templates/capsule/preview.html.twig new file mode 100644 index 0000000000000000000000000000000000000000..650a202ab4ba28d644f8f5d7cb98f9a6939483c3 --- /dev/null +++ b/templates/capsule/preview.html.twig @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="UTF-8"> + <title>{% block title %}MemoRekall{% endblock %}</title> + + {% block stylesheets %} + {{ encore_entry_link_tags('app') }} + {% endblock %} + + {% block javascripts %} + {{ encore_entry_script_tags('app') }} + {% endblock %} + + <link rel="icon" type="image/x-icon" href="{{ asset('build/images/favicon.ico') }}" /> + +</head> + +<body class="container col-10 col-md-8 col-lg-6 m-auto"> + + <div class="position-relative d-flex flex-row align-items-center justify-content-center mb-5"> + <img id="header-memorekall-logo" class="memorekall-logo" src="{{ asset('build/images/MemoRekall.png') }}"> + </div> + + <iframe src="{{ url }}" + style="width:100%;height:100%;top:0;left:0;position:absolute" + + frameborder="0" + webkitallowfullscreen + mozallowfullscreen + allowfullscreen> + </iframe> + +</body> +</html>