# rC3 Counter-Badge This project was created during [rC3 2021 NOWHERE][rc3] in order to issue badges (i.e. achievements) for a treasure hunt style game on a [WorkAdventure][wa] map. **Disclaimer**: This project was hacked in a single evening, doesn't have any quality control measures and is not actively maintained. Use with appropriate care. ## License See LICENSE ## Dependencies * Python 3 >= 3.6 * Bottle * Beaker ## How To Set Up ### Create your Badges in Maschinenraum ![Create your badge in Maschinenraum](./howto/01-create-badge.png) 1. Click the `+` button next to the `Badges` menu entry 1. Give you badge a name 1. Make the badge an achievement 1. Upload a badge picture 1. Save the badge Repeat for every badge you want to create. ### Issue Badge Redeem Tokens ![Issue Badge Redeem Tokens](./howto/02-issue-badge-tokens.png) 1. Click on the `Badges` menu entry 1. Select your badge 1. Under `Create Badge Redeem Tokens`, choose the `Permanent` type. 1. Click Create Redeem Token. **Save the redeem token for later use.** Repeat for every badge you want to create. ### Create OAuth2 Client ![Create OAuth2 Client](./howto/03-register-oauth-client.png) 1. Click on the `Authentication` menu entry 1. If not already done, create a rC3 API token by clicking `Request a new token`. **Save the API token for later use.* 1. Give your new OAuth2 client a name. 1. Set its type to `Public`. 1. Set the grant type to `Auhtoziation code`. 1. Click `New application` to create the OAuth2 client. ### Generate Counter Tokens ![Create Layers in Tiled](./howto/04-create-tiled-layer.png) 1. For each unique place on your WorkAdventure map, generate a unique token, e.g. using `uuidgen`. 1. Create a layer in Tiled for each unique place and add at least the `openWebsite` layer property with a value of e.g. `https:///counter//`. ### Deploy Set up counterbadge.py as a service on your system, e.g. as a systemd service (see `counterbadge.service` as an example). Set up a TLS-terminating reverse proxy. ### Configure See `counterbadge.example.json` as a config example. Put in the API, OAuth2 and Badge credentials you created earlier. [rc3]: http://web.archive.org/web/20211229071129/https://links.rc3.world/ [wa]: https://workadventu.re/