A caching proxy for SendDB focusing on efficiently checking if levels have been sent or not
- Rust installed
- A device or server capable of running 24/7
1. Download the repository manually or clone it:
git clone https://github.com/M336G/senddb_cache.git
cd senddb_cache2. Create a .env file and fill it according to your needs using .env.example as a template:
- Enter a custom port if you need to change the default one (8273)
- Specify SendDB's endpoint URL for accessing a level's data
- Set an expiration for how many minutes before temporarily cached not sent levels are able to be re-checked
- Set for how long sent levels will be cached by Cloudflare
- Set for how long not sent levels will be cached by Cloudflare
3. Start the instance with:
cargo run --releasefor productioncargo runfor development/testing
Once you've done all of this, you should have a running instance!
Once you've got your instance running, you may use these endpoints:
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Check if the server's up or |
GET |
/stats |
Get some statistics about the server |
GET |
/level/<id> |
Check if a level has been sent or not |
GET |
/ws |
Initializes a new WebSocket connection |
GET |
/swagger |
Get documentation about each endpoint |
GET |
/swagger/openapi.json |
Get JSON documentation about each endpoint |
Responses to GET /level/<id> will look like this:
{
"error": null,
"sent": true
}errorwill benullon success or a string describing the errorsentwill betrueif the level has been sent,falseif not, ornullif an error occurred
Additionally, if you are looking for something more efficient, you may use the WebSocket endpoint:
Once connected to GET /ws, you may send any of the following:
{ "type": "status" }: allows you to check if the connection's still up or not (it will just return{ "error": null }){ "type": "stats" }: returns statistics about the server (same response asGET /stats){ "type": "level", "ids": [id1, id2, ...] }: checks if one or multiple levels have been sent (up to 50 at a time)
Responses to { "type": "level", ... } will look like this:
{
"error": null,
"levels": {
"6508283": { "error": null, "sent": false },
"128279390": { "error": null, "sent": true }
}
}Each level entry has the same kind of response as GET /level/<id>
This project is licensed under the MIT License.