Closed jepiqueau closed 1 year ago
@jepiqueau if you are using latest version there is a 'setupContentSecurityPolicy' function in setup.ts file (electron folder). where you can edit CSP string.
@JuliusSkrisa thanks for your answer but hiw do i have to edit it let says for example for https:://example.com/example.mp4
you should be able to find your answer here https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP but example 2 in the link I think would work.
@JuliusSkrisa You know if i am asking this is because i google and try without success to update the setup.ts file
'Content-Security-Policy': [
electronIsDev
? `default-src ${customScheme}://* media-src://* 'unsafe-inline' devtools://* 'unsafe-eval' data:`
: `default-src ${customScheme}://* 'unsafe-inline' data:`,
],
and i got
Refused to load media from 'https://brenopolanski.github.io/html5-video-webvtt-example/MIB2.mp4' because it violates the following Content Security Policy directive: "default-src capacitor-electron://* media-src://* 'unsafe-inline' devtools://* 'unsafe-eval' data:". Note that 'media-src' was not explicitly set, so 'default-src' is used as a fallback.
So i need someone to give me the right syntax
@JuliusSkrisa if finally got it
'Content-Security-Policy': [
electronIsDev
? `default-src ${customScheme}://* 'unsafe-inline' devtools://* 'unsafe-eval' data:; media-src ${customScheme}: https://*`
: `default-src ${customScheme}://* 'unsafe-inline' data:`,
],
Describe the bug I could not find the way in the documentation to add a media-src directive to the content security policy it is not a bug but a lack of documentation
Can we use the
customUrlScheme
in the ElectronConfig? and if yes how to define the string with the urls of the video Do we have to change thesetupContentSecurityPolicy
method in thesetup.ts
file to define a media-src ? if yes howThanks
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.