|
1 | | -# rust-template-default |
2 | | -Default project template for rust project with my credentials |
| 1 | +# DDNet Tee Generator CDN |
3 | 2 |
|
4 | | -# Contains |
5 | | -- CI/CD pipeline on tag `v*.*.*` |
6 | | -- CI link on every push |
7 | | -- Test folder |
8 | | -- License (MIT) |
9 | | -- .env file |
10 | | -- Configurated Cargo.toml |
11 | | -- Configurated .gitignore |
12 | | -- Configurated rust-toolchain.toml |
13 | | -- Configurated rustfmt.toml |
| 3 | +This project serves as a Content Delivery Network (CDN) for DDNet (DDrace Network) tee skins. It's designed to generate custom tee skins on demand, cache them for performance, and synchronize with official DDNet skin repositories. |
14 | 4 |
|
15 | | ---- |
| 5 | +## Description |
16 | 6 |
|
17 | | -# Name of packet |
| 7 | +The DDNet Tee Generator CDN provides an API to create and serve custom tee skins for the DDraceNetwork game. It allows users to specify skin parameters like name, body color, and feet color to generate unique tee appearances. The system leverages caching to serve frequently requested skins quickly and synchronizes with DDNet's official skin sources to maintain an up-to-date collection. |
18 | 8 |
|
19 | | -## Description |
| 9 | +## Routes |
| 10 | + |
| 11 | +The following API routes are available: |
| 12 | + |
| 13 | +* **`GET /skin`** |
| 14 | + * **Description**: Generates and returns a custom tee skin based on the provided query parameters. |
| 15 | + * **Query Parameters**: |
| 16 | + * `name`: (String, **Required**) The name of the skin. Whitespaces are replaced with underscores. |
| 17 | + * `body`: (u32, Optional) The DDNet color value for the tee's body. |
| 18 | + * `feet`: (u32, Optional) The DDNet color value for the tee's feet. |
| 19 | + |
| 20 | +* **`GET /skin/store`** |
| 21 | + * **Description**: Returns a JSON array of the names of all currently stored (downloaded and synchronized) skins. |
| 22 | + |
| 23 | +* **`GET /skin/cache`** |
| 24 | + * **Description**: Returns a JSON array of the names of all currently cached (generated) skins. |
| 25 | + |
| 26 | +* **`GET /uvs`** |
| 27 | + * **Description**: Serves a folder containing all UV (unwrap) images. This route acts as a mirror for the UV data. |
| 28 | + |
| 29 | +* **`GET /health`** |
| 30 | + * **Description**: Performs a health check and returns a `204 No Content` response if the service is operational. |
| 31 | + |
| 32 | +* **`GET /doc`** |
| 33 | + * **Description**: Serves the OpenAPI documentation for the API. |
| 34 | + |
| 35 | +## Created Folders |
| 36 | + |
| 37 | +The application creates and utilizes the following folders: |
| 38 | + |
| 39 | +* `static/`: Store generated scalar doc `doc.html`. |
| 40 | +* `.cache/`: Used for storing generated tee skins to prevent redundant computations. These cached skins have a TTL (Time To Live) of 15 minutes. |
| 41 | +* `.store/`: Contains the downloaded base skin images from DDNet sources and a `lock.json` file which tracks metadata about these stored skins. |
| 42 | + |
| 43 | +## Examples of Requests |
| 44 | + |
| 45 | +Here are examples of how to interact with the API: |
| 46 | + |
| 47 | +* **Generate a skin named "my_custom_tee" with specific body and feet colors:** |
| 48 | + ``` |
| 49 | + GET /skin?name=my_custom_tee&body=322&feet=322 |
| 50 | + ``` |
| 51 | +
|
| 52 | +* **Generate a skin named "another_tee" with only a name:** |
| 53 | + ``` |
| 54 | + GET /skin?name=another_tee |
| 55 | + ``` |
| 56 | +
|
| 57 | +* **Get a list of all stored skins:** |
| 58 | + ``` |
| 59 | + GET /skin/store |
| 60 | + ``` |
20 | 61 |
|
21 | | -## How to use |
22 | | -```sh |
| 62 | +* **Get a list of all cached skins:** |
| 63 | + ``` |
| 64 | + GET /skin/cache |
| 65 | + ``` |
23 | 66 |
|
24 | | -``` |
| 67 | +* **Check the health of the service:** |
| 68 | + ``` |
| 69 | + GET /health |
| 70 | + ``` |
25 | 71 |
|
26 | | -## Examples |
| 72 | +* **Access the API documentation:** |
| 73 | + ``` |
| 74 | + GET /doc |
| 75 | + ``` |
27 | 76 |
|
28 | | -## How to build |
29 | | -```sh |
30 | | -git clone repo-url |
31 | | -cd repo-name |
32 | | -cargo build |
33 | | -``` |
| 77 | +* **Access the UV images:** |
| 78 | + ``` |
| 79 | + GET /uvs |
| 80 | + ``` |
34 | 81 |
|
35 | 82 | ## License |
36 | 83 | MIT License |
0 commit comments