temporairly accepting both strings and numbers

This commit is contained in:
Miodec 2022-02-21 13:56:25 +01:00
parent 251b7234a4
commit 6cf1f06d0d
2 changed files with 6 additions and 5 deletions

View file

@ -34,7 +34,10 @@ const CONFIG_SCHEMA = joi.object({
mode: joi.string().valid("time", "words", "quote", "zen", "custom"),
quoteLength: joi.array().items(joi.number()),
language: joi.string(),
fontSize: joi.string().valid("1", "125", "15", "2", "3", "4"),
fontSize: joi.alternatives().try(
joi.number().valid(1, 125, 15, 2, 3, 4), //todo remove after a week
joi.string().valid("1", "125", "15", "2", "3", "4")
),
freedomMode: joi.boolean(),
difficulty: joi.string().valid("normal", "expert", "master"),
blindMode: joi.boolean(),
@ -45,10 +48,7 @@ const CONFIG_SCHEMA = joi.object({
layout: joi.string(),
funbox: joi.string(),
confidenceMode: joi.string().valid("off", "on", "max"),
indicateTypos: joi.alternatives().try(
joi.boolean(), //todo remove
joi.string().valid("off", "below", "replace")
),
indicateTypos: joi.string().valid("off", "below", "replace"),
timerStyle: joi.string().valid("bar", "text", "mini"),
colorfulMode: joi.boolean(),
randomTheme: joi.string().valid("off", "on", "fav", "light", "dark"),

View file

@ -1557,6 +1557,7 @@ export function setFontSize(
fontSize: MonkeyTypes.FontSize,
nosave?: boolean
): void {
fontSize = fontSize.toString() as MonkeyTypes.FontSize; //todo remove after around a week
if (!isConfigValueValid(fontSize, [["1", "125", "15", "2", "3", "4"]]))
return invalid("font size", fontSize);