oveleon / contao-cookiebar

Cookie bar for the Contao Open Source CMS
GNU Affero General Public License v3.0
58 stars 24 forks source link

Add "youtube" to the iframe_types ("ce_youtube" becomes "youtube" since Contao 5.13) #211

Closed Funbug closed 2 months ago

Funbug commented 2 months ago

Prerequisites

Please select the topic(s) that most closely match your concern

Backend (PHP)

Description

In Contao 5.13 a YouTube element only gets blocked when adding - youtube to the iframe_types in the parameters.yaml. This is because the content elements have been renamed, here ce_youtube to (content_elements/) youtube. I suggest to add this as default.

Relevant log output

No response

zoglo commented 2 months ago

@Funbug Did you ever test this? It's working as intended.

This is handled here: https://github.com/oveleon/contao-cookiebar/blob/b5f4e56a70533a0d73d2cdb968f653b1d0e8bd00/src/EventListener/KernelRequestListener.php#L356

Funbug commented 2 months ago

I tested it this night with Contao 5.3.11 and Contao Cookiebar 2.0.2. It didn't work (for me) until I added - youtube to the parameters.yaml. If I remove it, the YouTube video is loading, even without accepting the cookie consent.

Maybe it's an error on my side. I just wanted to report it if not.

zoglo commented 2 months ago

Why is it in the parameters.yaml in the first place? How does your config.yaml look like?

Rather, we are using the Cookiebar in the same version under 5.3.11 and youtube is being blocked without changing the configuration after all

Funbug commented 2 months ago

It's the only way I could get it to work. https://pastebin.com/1gQC2FUh

zoglo commented 2 months ago

What happens if you drop all configuration you have stored in the parameters.yaml regarding the cookiebar? This also shouldn't be saved in the parameters.yaml at all, that's what you use the config.yaml for.

zoglo commented 2 months ago

You also have improper spacing in your yaml file. Either use 4 or 2, not both.

zoglo commented 2 months ago

@Funbug are you using any custom templates and what happens if you remove the content-youtube from here:

# config.yaml
contao_cookiebar:
    consider_dnt: true
    anonymize_ip: true
    consent_log: false
    iframe_types:
        youtube:
          - youtube
          - ce_youtube

or did you just add it because it's the class name?

Funbug commented 2 months ago

I don't use custom templates and no extensions except this one. I don't need "content-youtube", right. That was just an attempt. Forget that. It doesn't change the behaviour though.

When i drop all cookiebar related lines (and after reloading the prod-cache of course) the video is loading without consent, just as without "- youtube".

Until now, I've never hat a config.yaml. :D Does it make any difference?

zoglo commented 2 months ago

@Funbug I wonder... did you activate the cookiebar in the root page? Did you configure it in the backend? And did you add a cookietype of iframe -> youtube in the cookiebar?

And to be clear, adding youtube fixes it for you, right? (I'll add it in the next release since it also affects Elements that were rendered using the ContentProxy)

Funbug commented 2 months ago

Yes, yes, yes and yes. :) I’m happy to test the new release when it’s out.

Funbug commented 2 months ago

2.1.0 works for me without adding something to the config/parameters.yaml. Thank you. ❤️