[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Use YouTube privacy-enhanced embeds by default

"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a05886a2a35b_3819148c847aa@gitlab-sidekiq-low-urgency-cpu-bound-v2-856b88fb9f-z2ddv.mail>

luci pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
2f1f343f by Olivier Kango at 2026-05-14T08:14:11+00:00
[FIX] Use YouTube privacy-enhanced embeds by default
---
* [FIX] Use YouTube privacy-enhanced embeds by default

See merge request tikiwiki/tiki!10212

- - - - -


2 changed files:

- lib/test/wiki-plugins/YoutubeTest.php
- lib/wiki-plugins/wikiplugin_youtube.php


Changes:

=====================================
lib/test/wiki-plugins/YoutubeTest.php
=====================================
@@ -46,24 +46,32 @@ class WikiPlugin_YoutubeTest extends PHPUnit\Framework\TestCase
     {
         return [
             // Standard watch?v= formats
-            ['', 'youtube.com/embed/bPHuY7QL568', ['movie' => 'http://www.youtube.com/watch?v=bPHuY7QL568']],
-            ['', 'youtube.com/embed/NdPpffwYGoM', ['movie' => 'https://www.youtube.com/watch?v=NdPpffwYGoM']],
-            ['', 'youtube.com/embed/WbTkF-N-lO0', ['movie' => 'https://www.youtube.com/watch?v=WbTkF-N-lO0']],
+            ['', 'youtube-nocookie.com/embed/bPHuY7QL568', ['movie' => 'http://www.youtube.com/watch?v=bPHuY7QL568']],
+            ['', 'youtube-nocookie.com/embed/NdPpffwYGoM', ['movie' => 'https://www.youtube.com/watch?v=NdPpffwYGoM']],
+            ['', 'youtube-nocookie.com/embed/WbTkF-N-lO0', ['movie' => 'https://www.youtube.com/watch?v=WbTkF-N-lO0']],
 
             // Privacy enhanced mode via parameter
             ['', 'youtube-nocookie.com/embed/4AcGoG9PChs', [
                 'movie'           => 'https://www.youtube.com/watch?v=4AcGoG9PChs',
                 'privacyEnhanced' => 'y',
             ]],
+            ['', 'youtube-nocookie.com/embed/4AcGoG9PChs', [
+                'movie'           => 'https://www.youtube.com/watch?v=4AcGoG9PChs',
+                'privacyenhanced' => 'y',
+            ]],
+            ['', 'youtube.com/embed/4AcGoG9PChs', [
+                'movie'           => 'https://www.youtube.com/watch?v=4AcGoG9PChs',
+                'privacyEnhanced' => 'n',
+            ]],
 
             // All supported YouTube URL formats
-            ['', 'youtube.com/embed/j4dMnAPZu70', ['movie' => 'https://youtu.be/j4dMnAPZu70']],
-            ['', 'youtube.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/v/j4dMnAPZu70']],
-            ['', 'youtube.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/e/j4dMnAPZu70']],
-            ['', 'youtube.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/watch?v=j4dMnAPZu70']],
-            ['', 'youtube.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/shorts/j4dMnAPZu70']],
-            ['', 'youtube.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/embed/j4dMnAPZu70']],
-            ['', 'youtube.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/live/j4dMnAPZu70']],
+            ['', 'youtube-nocookie.com/embed/j4dMnAPZu70', ['movie' => 'https://youtu.be/j4dMnAPZu70']],
+            ['', 'youtube-nocookie.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/v/j4dMnAPZu70']],
+            ['', 'youtube-nocookie.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/e/j4dMnAPZu70']],
+            ['', 'youtube-nocookie.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/watch?v=j4dMnAPZu70']],
+            ['', 'youtube-nocookie.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/shorts/j4dMnAPZu70']],
+            ['', 'youtube-nocookie.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/embed/j4dMnAPZu70']],
+            ['', 'youtube-nocookie.com/embed/j4dMnAPZu70', ['movie' => 'https://youtube.com/live/j4dMnAPZu70']],
 
             // nocookie URL as input with privacyEnhanced=y → nocookie embed
             ['', 'youtube-nocookie.com/embed/j4dMnAPZu70', [
@@ -71,8 +79,8 @@ class WikiPlugin_YoutubeTest extends PHPUnit\Framework\TestCase
                 'privacyEnhanced' => 'y',
             ]],
 
-            // nocookie URL as input without privacyEnhanced → standard youtube.com embed
-            ['', 'youtube.com/embed/j4dMnAPZu70', [
+            // nocookie URL as input without privacyEnhanced → nocookie embed by default
+            ['', 'youtube-nocookie.com/embed/j4dMnAPZu70', [
                 'movie' => 'https://youtube-nocookie.com/embed/j4dMnAPZu70',
             ]],
         ];


=====================================
lib/wiki-plugins/wikiplugin_youtube.php
=====================================
@@ -30,10 +30,9 @@ function wikiplugin_youtube_info()
                 'required' => false,
                 'name' => tra('Privacy-Enhanced'),
                 'description' => tra('Enable privacy-enhanced mode'),
-                'default' => '',
+                'default' => 'y',
                 'filter' => 'alpha',
                 'options' => [
-                    ['text' => '', 'value' => ''],
                     ['text' => tra('Yes'), 'value' => 'y'],
                     ['text' => tra('No'), 'value' => 'n'],
                 ],
@@ -144,7 +143,7 @@ function wikiplugin_youtube($data, $params)
         'borderRadius' => 'y',
         'allowFullScreen' => 'y',
         'related' => 'y',
-        'privacyEnhanced' => '',
+        'privacyEnhanced' => 'y',
         'quality' => 'high',
     ], $params);
 
@@ -173,7 +172,7 @@ function wikiplugin_youtube($data, $params)
         $oEmbedData['height'] = 16;
     }
 
-    $privacyEnhanced = $params['privacyEnhanced'];
+    $privacyEnhanced = $params['privacyEnhanced'] ?? $params['privacyenhanced'] ?? 'y';
     $related = $params['related'];
 
     $fqdn = $privacyEnhanced === 'y' ? 'www.youtube-nocookie.com' : 'www.youtube.com';



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2f1f343ffe227084b3ee74ca76d90d37dc04723f

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2f1f343ffe227084b3ee74ca76d90d37dc04723f
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.