csp: allow twitter embeds in blog posts

pull/4351/head
Niklas Fiekas 2018-05-09 12:06:09 +02:00
parent 4542fc5906
commit 2e214dc6ea
2 changed files with 8 additions and 1 deletions

View File

@ -10,7 +10,8 @@ title = title,
moreCss = cssTag("blog.css"),
moreJs = pageJs,
side = side,
openGraph = openGraph) {
openGraph = openGraph,
csp = defaultCsp.withTwitter.some) {
<div id="lichess_blog" class="content_box">
@body
</div>

View File

@ -40,6 +40,12 @@ case class ContentSecurityPolicy(
scriptSrc = Nil
)
def withTwitter = copy(
scriptSrc = "https://platform.twitter.com" :: "https://*.twimg.com" :: scriptSrc,
childSrc = "https://platform.twitter.com" :: childSrc,
styleSrc = "https://platform.twitter.com" :: styleSrc
)
override def toString: String =
List(
"default-src " -> defaultSrc,