companion: move invidious-companion url CSP

This commit is contained in:
Fijxu 2024-12-30 18:41:22 -03:00
parent f248024b65
commit 391659780d
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
3 changed files with 2 additions and 16 deletions

View file

@ -43,9 +43,9 @@ module Invidious::Routes::BeforeAll
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data:",
"font-src 'self' data:",
"connect-src 'self'" + EXT_VIDEOP_LIST,
"connect-src 'self'" + CONFIG.invidious_companion.sample.public_url + EXT_VIDEOP_LIST,
"manifest-src 'self'",
"media-src 'self' blob:" + extra_media_csp + EXT_VIDEOP_LIST,
"media-src 'self' blob:" + extra_media_csp + CONFIG.invidious_companion.sample.public_url + EXT_VIDEOP_LIST,
"child-src 'self' blob:",
"frame-src 'self'",
"frame-ancestors " + frame_ancestors,

View file

@ -203,13 +203,6 @@ module Invidious::Routes::Embed
return env.redirect url
end
if companion_base_url = video.invidious_companion.try &.["baseUrl"].as_s
env.response.headers["Content-Security-Policy"] =
env.response.headers["Content-Security-Policy"]
.gsub("media-src", "media-src #{companion_base_url}")
.gsub("connect-src", "connect-src #{companion_base_url}")
end
rendered "embed"
end
end

View file

@ -217,13 +217,6 @@ module Invidious::Routes::Watch
video_url = nil
end
if companion_base_url = video.invidious_companion.try &.["baseUrl"].as_s
env.response.headers["Content-Security-Policy"] =
env.response.headers["Content-Security-Policy"]
.gsub("media-src", "media-src #{companion_base_url}")
.gsub("connect-src", "connect-src #{companion_base_url}")
end
templated "watch"
end