A simple CDN server written in Rust, using axum and redb. Supports user authentication, file/image upload, and automatic cleanup of inactive users.
Build and run:
cargo run --release
The server will listen on 0.0.0.0:3000 (or your configured port).
Authentication:
Authorization: Bearer <token> header.{
"username": "yourname",
"password": "yourpassword"
}
{
"token": "<jwt>",
"user_id": "<uuid>",
"username": "yourname"
}
{
"username": "yourname",
"password": "yourpassword"
}
{
"token": "<jwt>",
"user_id": "<uuid>",
"username": "yourname"
}
Authorization: Bearer <token>{
"id": "<uuid>",
"username": "yourname",
"created_at": "<timestamp>",
"last_activity": "<timestamp>"
}
Authorization: Bearer <token>multipart/form-data with a field named file containing the file to upload.File uploaded successfully. ID: <uuid>
Access at: /files/<uuid> or /images/<uuid>
Content-Type set to the original MIME type.Content-Type set to the original MIME type.:variant must be one of thumb, mid, or full.Content-Type set to the original MIME type.{
"files": ["<uuid>", ...],
"images": ["<uuid>", ...],
"total": 42
}
{
"username": "yourname",
"password": "yourpassword"
}
[
{
"token": "<jwt>",
"last_used": "<timestamp>"
},
// ...
]
{
"username": "yourname",
"password": "yourpassword",
"token": "<jwt>"
}
Token invalidated
thumb (150px), mid (800px), full (original).