Ripple's mirror api. Outdated, not used anymore.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Giuseppe Guerra fc59608f01 Fix subprocess call to ./mirror not working 2 years ago
.gitignore Initial commit 2 years ago
LICENSE Add license 2 years ago
README.md Add requests to requirements list 2 years ago
exceptions.py Initial commit 2 years ago
mirrorapi.py Fix subprocess call to ./mirror not working 2 years ago
requirements.txt Add requests to requirements list 2 years ago
settings.sample.json Initial commit 2 years ago
test_async.py Initial commit 2 years ago
test_wait.py Initial commit 2 years ago

README.md

MirrorAPI

This is a little api written in Python + Bottle + Gevent that handles beatmap set update requests from Bancho. When someone uses the !update command from FokaBot, Bancho sends a request to this server.

Requirements

  • Python 3.5
  • Bottle
  • Gevent
  • Requests

Setting up

Install all the required dependencies with pip

$ pip install -r requirements.txt

Then copy and edit the config file

$ cp settings.sample.json settings.json
$ nano settings.json
...

Finally, start the server

$ python3 mirrorapi.py
Bottle v0.12.9 server starting up (using GeventServer())...
Listening on http://0.0.0.0:9274/
Hit Ctrl-C to quit.

API Docs

POST /api/v1/update_beatmap

Request a beatmap set update and send message to Bancho using FokaBot’s api when done.

POST Parameters

Name Description
beatmap_set_id Beatmap set id to update.
beatmap_name Song name, used in FokaBot’s response
username User who requested the beatmap update. Used for rate limiting.
key Secret api key, configurable in settings.json

Response

Field name Type Value
status int 200 if ok, 400 if missing/wrong parameters, 403 if wrong key, 429 if user has passed rate limit
message string Response message

Rate limiting

The default rate limit is 1 request every 20 seconds per user.
You can change rate limits in settings.json.

License

All code in this repository is licensed under the GNU AGPL 3 License. See the “LICENSE” file for more information