Skip to content
Snippets Groups Projects
Commit bf468363 authored by Jairo Llopis's avatar Jairo Llopis Committed by Thibault Delavallée
Browse files

[FIX] website_slides: embed YouTube videos without cookies


Due to recent legal changes in EU, you cannot install tracking cookies in a user's browser without explicit consent.

Before this patch, Odoo embedded youtube videos were violating that law (AFAIK & IANAL).

With this simple patch, you benefit from YouTube's offering to embed videos without cookies. The UI remains the same, but no tracking is done.

@Tecnativa TT26153

closes odoo/odoo#61824

X-original-commit: a1a1169f
Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
parent cfb942ab
Branches
Tags
No related merge requests found
......@@ -345,7 +345,7 @@ class Slide(models.Model):
# embed youtube video
query = urls.url_parse(record.url).query
query = query + '&theme=light' if query else 'theme=light'
record.embed_code = '<iframe src="//www.youtube.com/embed/%s?%s" allowFullScreen="true" frameborder="0"></iframe>' % (record.document_id, query)
record.embed_code = '<iframe src="//www.youtube-nocookie.com/embed/%s?%s" allowFullScreen="true" frameborder="0"></iframe>' % (record.document_id, query)
else:
# embed google doc video
record.embed_code = '<iframe src="//drive.google.com/file/d/%s/preview" allowFullScreen="true" frameborder="0"></iframe>' % (record.document_id)
......@@ -740,7 +740,7 @@ class Slide(models.Model):
url_obj = urls.url_parse(url)
if url_obj.ascii_host == 'youtu.be':
return ('youtube', url_obj.path[1:] if url_obj.path else False)
elif url_obj.ascii_host in ('youtube.com', 'www.youtube.com', 'm.youtube.com'):
elif url_obj.ascii_host in ('youtube.com', 'www.youtube.com', 'm.youtube.com', 'www.youtube-nocookie.com'):
v_query_value = url_obj.decode_query().get('v')
if v_query_value:
return ('youtube', v_query_value)
......
......@@ -147,7 +147,8 @@ class TestFromURL(slides_common.SlidesCase):
'hlhLv0GN1hA': [
'https://www.youtube.com/v/hlhLv0GN1hA',
'https://www.youtube.com/embed/hlhLv0GN1hA',
'https://m.youtube.com/watch?v=hlhLv0GN1hA'
'https://www.youtube-nocookie.com/embed/hlhLv0GN1hA',
'https://m.youtube.com/watch?v=hlhLv0GN1hA',
],
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment