Gargaj / wuhu

Lightweight Party Management System
http://wuhu.function.hu/
Other
41 stars 26 forks source link

Export votekeys in text or JSON format #57

Closed falken42 closed 2 years ago

falken42 commented 2 years ago

While Wuhu has support for importing votekeys (and printing), it currently does not have any method to export votekeys. For our purposes, we've found using Wuhu's votekey generation to be useful, but we needed a way to make use of the votekeys with other applications.

This is a simple feature addition to allow votekeys to be viewed or downloaded as either plaintext or JSON from the Votekeys page in the Admin panel.

Screen Shot 2021-10-31 at 15 28 16

For reference, the exported JSON is formatted as a single array of strings, like so:

{ "votekeys": [ "VOTEKEY-TFPTDPYL", ... ] }
Gargaj commented 2 years ago

Not sure what the use case is but sure, why not.

falken42 commented 2 years ago

Thanks!

Just to expand on our use case: we build Wuhu in a Docker container, and have a script which executes a series of POSTs directly on the admin panel to automate the entire configuration process for TDF. The final step grabs the generated votekeys from Wuhu and copies the .json out to the local filesystem.

We could have also generated votekeys ourselves and imported them into Wuhu instead, but this was the easier route to take. :)

Gargaj commented 2 years ago

There's a few concerns; for one, this exports all votekeys, even if they're already used - don't know if that's something you'd want? Also the content-type header should be application/json, and so on.

falken42 commented 2 years ago

Good points. I did consider expanding out the JSON to potentially store more data (such as whether a particular key was used or not), but this was a quick throw-together solution for what we needed.

I can make it more robust in a future update!