huffman beta regex

This commit is contained in:
Thibault Duplessis 2018-03-08 13:51:21 -05:00
parent d0d6be5840
commit ffe0f800c1
2 changed files with 4 additions and 4 deletions

View file

@ -33,8 +33,8 @@ final class Env(
lazy val pgnEncodingSetting = settingStore[String](
"pgnEncodingSetting",
default = "none",
text = "Use Huffman encoding for game PGN [none|beta|all]".some
default = "thibault|revoof|isaacly", // `[a-h].*` for users starting with a,b,c...h
text = "Use Huffman encoding for game PGN [none|all|regex]".some
)
lazy val gameColl = db(CollectionGame)

View file

@ -73,12 +73,12 @@ private object PgnStorage {
castles: Castles // irrelevant after game ends
)
private val betaTesters = Set("thibault", "revoof", "isaacly")
private def shouldUseHuffman(variant: Variant, playerUserIds: List[lila.user.User.ID]) = variant.standard && {
try {
lila.game.Env.current.pgnEncodingSetting.get() match {
case "all" => true
case "beta" if playerUserIds.exists(betaTesters.contains) => true
case "none" => false
case regex if playerUserIds.exists(_ matches regex) => true
case _ => false
}
} catch {