specific CSP for twitch streams
This commit is contained in:
parent
6fd6f6d85e
commit
f142294cd3
|
@ -1,6 +1,6 @@
|
||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import play.api.mvc._
|
import play.api.mvc._, Results._
|
||||||
import play.twirl.api.Html
|
import play.twirl.api.Html
|
||||||
|
|
||||||
import lila.api.Context
|
import lila.api.Context
|
||||||
|
@ -67,8 +67,12 @@ object Tv extends LilaController {
|
||||||
Env.tv.streamsOnAir.all flatMap { streams =>
|
Env.tv.streamsOnAir.all flatMap { streams =>
|
||||||
val others = streams.filter(_.id != id)
|
val others = streams.filter(_.id != id)
|
||||||
streams find (_.id == id) match {
|
streams find (_.id == id) match {
|
||||||
case None => fuccess(Ok(html.tv.notStreaming(streamer, others)))
|
case None => fuccess(Ok(html.tv.notStreaming(streamer, others)))
|
||||||
case Some(s) => fuccess(Ok(html.tv.stream(s, others)))
|
case Some(s) => fuccess {
|
||||||
|
Ok(html.tv.stream(s, others)) withHeaders (
|
||||||
|
"Content-Security-Policy" -> """connect-src http://*.lichess.org ws://*.lichess.org:* http://lichess1.org http://www.twitch.tv http://www-cdn.jtvnw.net http://*.googleapis.com"""
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue