diff --git a/app/controllers/Relay.scala b/app/controllers/Relay.scala
index 1f70a6d92c..8341bba487 100644
--- a/app/controllers/Relay.scala
+++ b/app/controllers/Relay.scala
@@ -18,13 +18,13 @@ object Relay extends LilaController {
}
}
- def form = Auth { implicit ctx => me =>
+ def form = Secure(_.Beta) { implicit ctx => me =>
NoLame {
Ok(html.relay.create(env.forms.create)).fuccess
}
}
- def create = AuthBody { implicit ctx => implicit me =>
+ def create = SecureBody(_.Beta) { implicit ctx => me =>
implicit val req = ctx.body
env.forms.create.bindFromRequest.fold(
err => BadRequest(html.relay.create(err)).fuccess,
@@ -34,13 +34,13 @@ object Relay extends LilaController {
)
}
- def edit(slug: String, id: String) = Auth { implicit ctx => implicit me =>
+ def edit(slug: String, id: String) = Auth { implicit ctx => me =>
OptionFuResult(env.api.byIdAndOwner(RelayModel.Id(id), me)) { relay =>
Ok(html.relay.edit(relay, env.forms.edit(relay))).fuccess
}
}
- def update(slug: String, id: String) = AuthBody { implicit ctx => implicit me =>
+ def update(slug: String, id: String) = AuthBody { implicit ctx => me =>
OptionFuResult(env.api.byIdAndOwner(RelayModel.Id(id), me)) { relay =>
implicit val req = ctx.body
env.forms.edit(relay).bindFromRequest.fold(
diff --git a/app/views/base/topmenu.scala.html b/app/views/base/topmenu.scala.html
index 25ecd97048..73ed540509 100644
--- a/app/views/base/topmenu.scala.html
+++ b/app/views/base/topmenu.scala.html
@@ -25,6 +25,9 @@
diff --git a/app/views/relay/index.scala.html b/app/views/relay/index.scala.html
index 9bb9ecc202..6774d9465b 100644
--- a/app/views/relay/index.scala.html
+++ b/app/views/relay/index.scala.html
@@ -1,18 +1,17 @@
@(sel: lila.relay.Relay.Selection)(implicit ctx: Context)
-@sublist(relays: List[lila.relay.Relay.WithStudy]) = {
-@if(relays.isEmpty) {
-
-} else {
-
- @relays.map { r =>
-
- @widget(r)
+@sublist(name: String, relays: List[lila.relay.Relay.WithStudy]) = {
+@if(relays.nonEmpty) {
+
+ @name
+
+ @relays.map { r =>
+
+ @widget(r)
+
+ }
- }
-
+
}
}
@@ -23,17 +22,8 @@ moreCss = cssTag("relay-list.css")) {
Live tournament broadcasts
-
- Ongoing
- @sublist(sel.started)
-
-
- Upcoming
- @sublist(sel.created)
-
-
- Completed
- @sublist(sel.closed)
-
+ @sublist("Ongoing", sel.started)
+ @sublist("Upcoming", sel.created)
+ @sublist("Completed", sel.closed)
}
diff --git a/modules/relay/src/main/RelayFetch.scala b/modules/relay/src/main/RelayFetch.scala
index f70291fe56..fe1ca883c2 100644
--- a/modules/relay/src/main/RelayFetch.scala
+++ b/modules/relay/src/main/RelayFetch.scala
@@ -65,11 +65,11 @@ private final class RelayFetch(
case Some(delay) => fuccess(delay)
case None => api.getNbViewers(r) map {
case 0 => 30
- case nb => (11 - nb / 2) atLeast 2
+ case nb => (16 - nb) atLeast 5
}
}) map { seconds =>
sync.copy(nextAt = DateTime.now plusSeconds {
- seconds atLeast { if (sync.log.isOk) 2 else 5 }
+ seconds atLeast { if (sync.log.isOk) 5 else 10 }
} some)
}
} flatMap { api.setSync(r.id, _) }
diff --git a/ui/analyse/src/study/relay/relayCtrl.ts b/ui/analyse/src/study/relay/relayCtrl.ts
index e61ec00f4a..2d9d395ea2 100644
--- a/ui/analyse/src/study/relay/relayCtrl.ts
+++ b/ui/analyse/src/study/relay/relayCtrl.ts
@@ -26,13 +26,15 @@ export default class RelayCtrl {
c.relay = this.convertDate(r);
if (!c.tags.find(t => t[0] === 'Result' && t[1] !== '*')) {
const delay = (Date.now() - r.lastMoveAt!) % 1000;
- console.log(delay);
- setTimeout(() => setInterval(this.redraw, 1000), delay);
+ console.log(delay, r.lastMoveAt);
+ setTimeout(() => {
+ this.clockInterval = setInterval(this.redraw, 1000);
+ }, delay);
}
}
}
- convertDate = (r: StudyChapterRelay): StudyChapterRelay => {
+ private convertDate = (r: StudyChapterRelay): StudyChapterRelay => {
if (typeof r.secondsSinceLastMove !== 'undefined' && !r.lastMoveAt) {
r.lastMoveAt = Date.now() - r.secondsSinceLastMove * 1000;
}
@@ -49,7 +51,7 @@ export default class RelayCtrl {
this.data.sync.log.push(event);
this.data.sync.log = this.data.sync.log.slice(-20);
this.cooldown = true;
- setTimeout(() => { this.cooldown = false; this.redraw(); }, 3000);
+ setTimeout(() => { this.cooldown = false; this.redraw(); }, 4500);
this.redraw();
if (event.error) console.warn(`relay synchronisation error: ${event.error}`);
}