Problem/Motivation

We recently ran into this issue, when using Vidstack Player. This module uses the remote script https://cdn.vidstack.io/player, but for some reason it was still blocked even after disabling "Block unknown external resources". We also tried to create a new Vidstack "Klaro! service" using "vidstack.io", "cdn.vidstack.io" and "https://vidstack.io" as the Sources to allow, but even after cache clear and accepting all services, the cdn script was still blocked.

Steps to reproduce

  • Enable Klaro and its setting "Block unknown external resources"
  • Require drupal/vidstack_player, enable it and use it as a formatter on the media video type, video field.
  • Disable "Block unknown external resources" and create a Klaro! service with the sources stated above.
  • Flush all caches and reload the page containing a vidstack formatted video.
  • Accept all klaro services (cookies) and see that the cdn script is still blocked by klaro.

Proposed resolution

The script shouldn't be blocked.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork klaro-3521502

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

grevil created an issue. See original summary.

jan kellermann’s picture

You are using "module" for type-attribute. I suspect that this can cause the problem. I have to check later.

Edit: this line https://git.drupalcode.org/project/klaro/-/blob/3.x/klaro.module?ref_typ...

jan kellermann’s picture

Priority: Normal » Major

jan kellermann’s picture

Status: Active » Needs review

I added the handling for given type.

Can you please test, review and feedback?

Thank you!

grevil’s picture

Assigned: Unassigned » grevil

Thank you, @jan kellermann! I'll test it later this day! :)

anybody’s picture

Nice finding @jan kellermann that looks promising and totally makes sense! Thank you for the super quick reply!

grevil’s picture

Assigned: grevil » Unassigned

Ok, the script is present now! Unfortunately at the time, that the vidstack player gets initiated, klaro hasn't finished processing the script yet, and therefore we still have the same warning in the console output:

Uncaught Vidstack Player JS library could not be loaded.

So if klaro is present, we somehow need to wait for klaro until we can fire our script. I tried to add klaro/klaro as a dependency to our script, but it doesn't seem to fix the problem...

@anybody, any idea? Should we continue with this problem in the vidstack_player module?

anybody’s picture

No idea yet, sorry. Sounds like some kind of race condition / timing issue...

jan kellermann’s picture

I have the same problem without klaro but bigpipe enabled.
Maybe change your loading pattern like this?
https://git.drupalcode.org/project/klaro/-/merge_requests/58.diff

See https://git.drupalcode.org/issue/vidstack_player-3519538/-/compare/1.x.....

jan kellermann’s picture

Title: External cdn script gets blocked, ignoring "block_unknown" completely » Add support for Javascript with type "module"
Category: Bug report » Feature request
jan kellermann’s picture

@sascha_meissner: I replaced application/javascript with text/javascript. Can you please test again?

@anybody / @grevil: Did you check my suggestions to avoid race conditions in vidstack_player? Maybe you can review this issue also?

sascha_meissner’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed and tested, Looking great for me :)

jan kellermann’s picture

Status: Reviewed & tested by the community » Fixed

The fix is merged.
Thank you all for fixing this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.