From 24bf52bdf1be405ddd3535f0ad692ac787bc81c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Gl=C3=B3rias?= Date: Wed, 16 Oct 2024 13:54:39 +0000 Subject: [PATCH 1/4] Relay: Show mensage in board tab if do not have boards --- ui/analyse/src/study/relay/relayTourView.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ui/analyse/src/study/relay/relayTourView.ts b/ui/analyse/src/study/relay/relayTourView.ts index 7598a352ec8b1..83d20d2a1c3d1 100644 --- a/ui/analyse/src/study/relay/relayTourView.ts +++ b/ui/analyse/src/study/relay/relayTourView.ts @@ -315,7 +315,23 @@ const roundSelect = (relay: RelayCtrl, study: StudyCtrl) => { const games = (ctx: RelayViewContext) => [ ...header(ctx), - ctx.study.chapters.list.looksNew() ? undefined : multiBoardView(ctx.study.multiBoard, ctx.study), + ctx.study.chapters.list.looksNew() + ? h( + 'div.relay-tour__note', + h('div', [ + h('div', 'No boards yet. These will appear once games are uploaded.'), + ctx.study.members.myMember() && + h('small', [ + 'Boards can be loaded with a source or via the ', + h( + 'a', + { attrs: { href: 'https://lichess.org/broadcast/app', target: '_blank' } }, + 'Broadcaster App', + ), + ]), + ]), + ) + : multiBoardView(ctx.study.multiBoard, ctx.study), !ctx.ctrl.isEmbed && showSource(ctx.relay.data), ]; From 5f2a32facf715462fc84009765292a533b27a87b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Gl=C3=B3rias?= Date: Wed, 16 Oct 2024 14:19:26 +0000 Subject: [PATCH 2/4] remove `_black` and static link --- ui/analyse/src/study/relay/relayTourView.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ui/analyse/src/study/relay/relayTourView.ts b/ui/analyse/src/study/relay/relayTourView.ts index 83d20d2a1c3d1..39d2a6a5efa90 100644 --- a/ui/analyse/src/study/relay/relayTourView.ts +++ b/ui/analyse/src/study/relay/relayTourView.ts @@ -323,11 +323,7 @@ const games = (ctx: RelayViewContext) => [ ctx.study.members.myMember() && h('small', [ 'Boards can be loaded with a source or via the ', - h( - 'a', - { attrs: { href: 'https://lichess.org/broadcast/app', target: '_blank' } }, - 'Broadcaster App', - ), + h('a', { attrs: { href: '/broadcast/app' } }, 'Broadcaster App'), ]), ]), ) From 033afd5f5091c7294ea9a1357cf6da1dcaa997a4 Mon Sep 17 00:00:00 2001 From: Jonathan Gamble Date: Thu, 17 Oct 2024 02:22:27 -0500 Subject: [PATCH 3/4] use webp for streamer, blog, coach, and tournament image uploads --- ui/bits/src/bits.cropDialog.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ui/bits/src/bits.cropDialog.ts b/ui/bits/src/bits.cropDialog.ts index ccc2676c89cd8..3b6948fdd2f63 100644 --- a/ui/bits/src/bits.cropDialog.ts +++ b/ui/bits/src/bits.cropDialog.ts @@ -93,15 +93,14 @@ export async function initModule(o?: CropOpts): Promise { maxWidth: opts.max?.pixels, maxHeight: opts.max?.pixels, }); - const imgOutputFormat = isJpeg(opts.source) ? 'jpeg' : 'png'; - const tryQuality = (quality = 1) => { + const tryQuality = (quality = 0.9) => { canvas.toBlob( blob => { if (blob && blob.size < (opts.max?.megabytes ?? 100) * 1024 * 1024) submit(blob); else if (blob && quality > 0.05) tryQuality(quality * 0.9); else submit(false, 'Rendering failed'); }, - `image/${imgOutputFormat}`, + `image/webp`, quality, ); }; @@ -155,9 +154,3 @@ export async function initModule(o?: CropOpts): Promise { return constrained; } } - -const isJpeg = (source?: Blob | string) => { - if (source instanceof Blob) return source.type == 'image/jpeg'; - if (typeof source == 'string') return /\.jpe?g$/i.test(source); - return false; -}; From 678f3cbd5eec12c76da1d1271ce8849ffa62938e Mon Sep 17 00:00:00 2001 From: Jonathan Gamble <101470903+schlawg@users.noreply.github.com> Date: Thu, 17 Oct 2024 03:16:55 -0500 Subject: [PATCH 4/4] use String.hashCode for better diffusion --- modules/api/src/main/SocketTestResult.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/api/src/main/SocketTestResult.scala b/modules/api/src/main/SocketTestResult.scala index bbc43159b066d..84441d8bc4eb2 100644 --- a/modules/api/src/main/SocketTestResult.scala +++ b/modules/api/src/main/SocketTestResult.scala @@ -12,7 +12,7 @@ final class SocketTestResult(resultsDb: lila.db.AsyncCollFailingSilently)(using object SocketTest: def isUserInTestBucket(net: NetConfig)(using ctx: Context) = - net.socketTest && ctx.pref.usingAltSocket.isEmpty && ctx.userId.exists(_.value.toList.sum % 128 == 0) + net.socketTest && ctx.pref.usingAltSocket.isEmpty && ctx.userId.exists(_.value.hashCode % 128 == 0) def socketEndpoints(net: NetConfig)(using ctx: Context): List[String] = ctx.pref.usingAltSocket.match