Skip to content

Commit f46f606

Browse files
committed
Rename binary and artifact names to cdn
Also, change the binary name in the workflows and examples.
1 parent bcd34a1 commit f46f606

File tree

5 files changed

+96
-46
lines changed

5 files changed

+96
-46
lines changed

.github/workflows/cli.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
env:
1313
CARGO_TERM_COLOR: always
14-
BINARY_NAME: change_me
14+
BINARY_NAME: cdn
1515

1616
jobs:
1717
lint:
@@ -46,38 +46,38 @@ jobs:
4646
# linux x64
4747
- os: ubuntu-latest
4848
target: x86_64-unknown-linux-gnu
49-
artifact_name: change_me
50-
asset_name: change_me-linux-amd64
49+
artifact_name: cdn
50+
asset_name: cdn-linux-amd64
5151

5252
# linux arm
5353
- os: ubuntu-latest
5454
target: aarch64-unknown-linux-gnu
55-
artifact_name: change_me
56-
asset_name: change_me-linux-arm
55+
artifact_name: cdn
56+
asset_name: cdn-linux-arm
5757

5858
# windows x64
5959
- os: windows-latest
6060
target: x86_64-pc-windows-gnu
61-
artifact_name: change_me.exe
62-
asset_name: change_me-windows-amd64.exe
61+
artifact_name: cdn.exe
62+
asset_name: cdn-windows-amd64.exe
6363

6464
# windows arm
6565
- os: windows-latest
6666
target: aarch64-pc-windows-msvc
67-
artifact_name: change_me.exe
68-
asset_name: change_me-windows-arm.exe
67+
artifact_name: cdn.exe
68+
asset_name: cdn-windows-arm.exe
6969

7070
# macos x64
7171
- os: macos-latest
7272
target: x86_64-apple-darwin
73-
artifact_name: change_me
74-
asset_name: change_me-macos-amd64
73+
artifact_name: cdn
74+
asset_name: cdn-macos-amd64
7575

7676
# macos arm
7777
- os: macos-latest
7878
target: aarch64-apple-darwin
79-
artifact_name: change_me
80-
asset_name: change_me-macos-arm
79+
artifact_name: cdn
80+
asset_name: cdn-macos-arm
8181

8282
steps:
8383
- uses: actions/checkout@v4
@@ -144,12 +144,12 @@ jobs:
144144
uses: softprops/action-gh-release@v2
145145
with:
146146
files: |
147-
change_me-linux-amd64/change_me-linux-amd64
148-
change_me-windows-amd64.exe/change_me-windows-amd64.exe
149-
change_me-macos-amd64/change_me-macos-amd64
150-
change_me-linux-arm/change_me-linux-arm
151-
change_me-windows-arm.exe/change_me-windows-arm.exe
152-
change_me-macos-arm/change_me-macos-arm
147+
cdn-linux-amd64/cdn-linux-amd64
148+
cdn-windows-amd64.exe/cdn-windows-amd64.exe
149+
cdn-macos-amd64/cdn-macos-amd64
150+
cdn-linux-arm/cdn-linux-arm
151+
cdn-windows-arm.exe/cdn-windows-arm.exe
152+
cdn-macos-arm/cdn-macos-arm
153153
draft: false
154154
prerelease: false
155155
generate_release_notes: true

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
CARGO_TERM_COLOR: always
11-
BINARY_NAME: change_me
11+
BINARY_NAME: cdn
1212

1313
jobs:
1414
lint:

README.md

Lines changed: 72 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,83 @@
1-
# rust-template-default
2-
Default project template for rust project with my credentials
1+
# DDNet Tee Generator CDN
32

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.
144

15-
---
5+
## Description
166

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.
188

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+
```
2061
21-
## How to use
22-
```sh
62+
* **Get a list of all cached skins:**
63+
```
64+
GET /skin/cache
65+
```
2366
24-
```
67+
* **Check the health of the service:**
68+
```
69+
GET /health
70+
```
2571
26-
## Examples
72+
* **Access the API documentation:**
73+
```
74+
GET /doc
75+
```
2776
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+
```
3481
3582
## License
3683
MIT License

src/app/skin.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ pub fn skin_router() -> Ohkami {
2727
}
2828

2929
#[derive(Debug, Clone, Deserialize, Schema, Hash, PartialEq, Eq, Serialize)]
30+
/// Base/Default/Main skin query
3031
pub struct SkinQuery {
3132
/// Replace all whitespaces to `_`
3233
pub name: String,
34+
/// DDNet value
3335
pub body: Option<u32>,
36+
/// DDNet value
3437
pub feet: Option<u32>,
3538
}
3639

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn init_logger(level: Level) {
1919

2020
// Check for RUST_LOG env var, default to INFO if not present
2121
let env_filter = EnvFilter::try_from_default_env()
22-
.unwrap_or_else(|_| EnvFilter::new("cdn=trace,ohkami=trace"));
22+
.unwrap_or_else(|_| EnvFilter::new("cdn=info,ohkami=trace"));
2323

2424
let fmt_layer = fmt::layer().compact().with_ansi(true).with_target(true);
2525

0 commit comments

Comments
 (0)