ajanata / PretendYoureXyzzy

A web clone of the card game Cards Against Humanity.
https://pretendyoure.xyz/zy
BSD 2-Clause "Simplified" License
1.22k stars 397 forks source link

Global chat enabled API endpoint #168

Closed devgianlu closed 6 years ago

devgianlu commented 6 years ago

Hi, I'm the owner of the Pretend You're Xyzzy app. Since I fixed a major issue (#161) in my app, I can now proceed with adding more features. In particular, it would be useful to have sent whether the global chat is enabled. This could be easily done in the FirstLoad handler.

I've already made a pull request (#169). I am also the owner of the https://github.com/devgianlu/PYX-Reloaded repo and therefore I have a deep knowledge of your game, if you need help.

Right now I'm sending an empty message and I determine if the chat enabled check has been passed based on the error given.

ajanata commented 6 years ago

For the record, this is already implemented in cah.config.js in the JavascriptConfigServlet, though this seems like a better way to do it.

Also note that this setting technically can change at any time, but in practice (for my servers, at least), it would only change shortly after the server starts.

devgianlu commented 6 years ago

I think I'll use the JavascriptConfigServlet, let me know when you'll update the server so that I can switch to the newer method.

ajanata commented 6 years ago

This should be deployed on my servers now. It'd probably be a good idea for some more server configuration information to be included in that response and not just on the js configuration servlet, but if I do add that I'll leave this for backwards compatibility at least for a while.

devgianlu commented 6 years ago

I'm still the JS handler because it has some more interesting stuff. Anyway you could dump all the keys and values into a map returned with FirstLoad. I'll make a pull request to explain better.