Skip to content

Commit

Permalink
Merge branch 'master' into i18n-assets-squashed
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar authored Oct 17, 2024
2 parents 00bbc05 + d6fce8d commit d764b29
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion modules/api/src/main/SocketTestResult.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion ui/analyse/src/study/relay/relayTourView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,19 @@ 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: '/broadcast/app' } }, 'Broadcaster App'),
]),
]),
)
: multiBoardView(ctx.study.multiBoard, ctx.study),
!ctx.ctrl.isEmbed && showSource(ctx.relay.data),
];

Expand Down
11 changes: 2 additions & 9 deletions ui/bits/src/bits.cropDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,14 @@ export async function initModule(o?: CropOpts): Promise<void> {
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,
);
};
Expand Down Expand Up @@ -155,9 +154,3 @@ export async function initModule(o?: CropOpts): Promise<void> {
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;
};

0 comments on commit d764b29

Please sign in to comment.