Add server-side deck validation
While the current architecture of all deck validation happening client-side in javascript is workable, it causes a number of issues that can't be ignored in the long run:
- security (decks loaded, submitted and validated in javascript allow for many shenanigans, e.g. swapping your deck for an invalid one last second before starting a hosted game, which won't be noticed by the opponent)
- speed (even currently solution for many players complaining about site slowness is to delete some of their decks - validation is a huge part of that)
- tool flexibility (once the validation code is out of cljs and in a separate module, it will be far easier to unit test it)
Code sharing between server Clojure code and Clojurescript is supported by lein-cljsbuild and can be achieved e.g. via .cljc files described in https://github.com/emezeske/lein-cljsbuild/blob/master/doc/CROSSOVERS.md
Obviously server-side validation would happen only on saving a deck and its status would be stored in database together with the deck - this would stop decks from being validated over and over again. JS validation should be used only live, when editing a deck.
Since the new privacy rework by @nealterrell reloads all the cards in a deck on the server-side, maybe the whole deck functionality could be rewritten to manage the deck mainly on the server-side, just passing a deck-id around or something.
Done!