From 74ac00267c08f10b8235e182937e8d81ac195796 Mon Sep 17 00:00:00 2001 From: Guido Schmechel <guido.schmechel@brandung.de> Date: Thu, 10 Oct 2019 22:41:32 +0200 Subject: [PATCH] [TASK] Use no-cookie setting for vimeo by default Improve the privacy of users by using the no-cookie setting by default and set the do not track parameter to 1. Resolves: #89381 Releases: master, 9.5 Change-Id: I81d1a6aae802126f66765702417b7ffd350d8fb7 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61948 Reviewed-by: Susanne Moog <look@susi.dev> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: Benni Mack <benni@typo3.org> --- .../Classes/Resource/Rendering/VimeoRenderer.php | 3 +++ .../Unit/Resource/Rendering/VimeoRendererTest.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/typo3/sysext/core/Classes/Resource/Rendering/VimeoRenderer.php b/typo3/sysext/core/Classes/Resource/Rendering/VimeoRenderer.php index b8d935032fed..51ee4b99862c 100644 --- a/typo3/sysext/core/Classes/Resource/Rendering/VimeoRenderer.php +++ b/typo3/sysext/core/Classes/Resource/Rendering/VimeoRenderer.php @@ -144,6 +144,9 @@ class VimeoRenderer implements FileRendererInterface if (isset($options['api']) && (int)$options['api'] === 1) { $urlParams[] = 'api=1'; } + if (!empty($options['no-cookie'])) { + $urlParams[] = 'dnt=1'; + } $urlParams[] = 'title=' . (int)!empty($options['showinfo']); $urlParams[] = 'byline=' . (int)!empty($options['showinfo']); $urlParams[] = 'portrait=0'; diff --git a/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php b/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php index cb1db8f9be6a..41b4f6f28cf1 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php @@ -283,4 +283,18 @@ class VimeoRendererTest extends UnitTestCase $this->subject->render($fileResourceMock, '300m', '200', ['api' => 1]) ); } + + /** + * @test + */ + public function renderOutputWithDisabledNoCookieIsCorrect() + { + /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */ + $fileResourceMock = $this->createMock(File::class); + + self::assertSame( + '<iframe src="https://player.vimeo.com/video/7331?api=1&dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', + $this->subject->render($fileResourceMock, '300m', '200', ['api' => 1, 'no-cookie' => 1]) + ); + } } -- GitLab