Disallow word lists less than 25 words

This commit is contained in:
zikaeroh 2020-05-23 15:38:44 -07:00
parent 30811bf861
commit 8192cf3315
2 changed files with 10 additions and 1 deletions

View File

@ -361,7 +361,13 @@ const Sidebar = ({ send, state, pState, pTeam }: GameViewProps) => {
const file = files[i]; const file = files[i];
const name = file.name.substring(0, file.name.lastIndexOf('.')) || file.name; const name = file.name.substring(0, file.name.lastIndexOf('.')) || file.name;
const text = (await file.text()).trim(); 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); send.addPacks(packs);

View File

@ -397,6 +397,9 @@ func (r *Room) handleNote(playerID game.PlayerID, note *protocol.ClientNote) err
return err return err
} }
for _, p := range params.Packs { for _, p := range params.Packs {
if len(p.Words) < 25 {
continue
}
r.room.AddPack(p.Name, p.Words) r.room.AddPack(p.Name, p.Words)
} }