From 8192cf331536593f164b2dc12028aa0cf7755817 Mon Sep 17 00:00:00 2001 From: zikaeroh <48577114+zikaeroh@users.noreply.github.com> Date: Sat, 23 May 2020 15:38:44 -0700 Subject: [PATCH] Disallow word lists less than 25 words --- frontend/src/pages/gameView.tsx | 8 +++++++- internal/server/server.go | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/gameView.tsx b/frontend/src/pages/gameView.tsx index 31f60f4..2eb2d5e 100644 --- a/frontend/src/pages/gameView.tsx +++ b/frontend/src/pages/gameView.tsx @@ -361,7 +361,13 @@ const Sidebar = ({ send, state, pState, pTeam }: GameViewProps) => { const file = files[i]; const name = file.name.substring(0, file.name.lastIndexOf('.')) || file.name; const text = (await file.text()).trim(); - packs.push({ name, words: text.split('\n') }); + const words = text.split('\n'); + + if (words.length < 25) { + continue; + } + + packs.push({ name, words }); } send.addPacks(packs); diff --git a/internal/server/server.go b/internal/server/server.go index 87b2174..e0d4a80 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -397,6 +397,9 @@ func (r *Room) handleNote(playerID game.PlayerID, note *protocol.ClientNote) err return err } for _, p := range params.Packs { + if len(p.Words) < 25 { + continue + } r.room.AddPack(p.Name, p.Words) }