disallow TV embedding
since the TV page reloads for each game, it can be heavy on the server when embedded on a popular page
This commit is contained in:
parent
bacb008ee1
commit
554a10105c
|
@ -48,6 +48,9 @@ private[controllers] trait LilaController
|
|||
protected def NoCache(res: Result): Result = res.withHeaders(
|
||||
CACHE_CONTROL -> "no-cache, no-store, must-revalidate", EXPIRES -> "0"
|
||||
)
|
||||
protected def NoIframe(res: Result): Result = res.withHeaders(
|
||||
"X-Frame-Options" -> "SAMEORIGIN"
|
||||
)
|
||||
|
||||
protected def Socket[A: FrameFormatter](f: Context => Fu[(Iteratee[A, _], Enumerator[A])]) =
|
||||
WebSocket.tryAccept[A] { req =>
|
||||
|
|
|
@ -37,14 +37,16 @@ object Tv extends LilaController {
|
|||
val onTv = lila.round.OnTv(channel.key, flip)
|
||||
negotiate(
|
||||
html = {
|
||||
Env.api.roundApi.watcher(pov, lila.api.Mobile.Api.currentVersion, tv = onTv.some) zip
|
||||
Env.game.crosstableApi(game) zip
|
||||
Env.tv.tv.getChampions map {
|
||||
case ((data, cross), champions) => NoCache {
|
||||
Env.api.roundApi.watcher(pov, lila.api.Mobile.Api.currentVersion, tv = onTv.some) zip
|
||||
Env.game.crosstableApi(game) zip
|
||||
Env.tv.tv.getChampions map {
|
||||
case ((data, cross), champions) => NoCache {
|
||||
NoIframe { // can be heavy as TV reloads for each game
|
||||
Ok(html.tv.index(channel, champions, pov, data, cross, flip, history))
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
api = apiVersion => Env.api.roundApi.watcher(pov, apiVersion, tv = onTv.some) map { Ok(_) }
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue