chore: setup lib for testing, image handling notes in README

This commit is contained in:
Ryan Walters
2025-09-18 13:18:53 -05:00
parent 7f9d3e9158
commit 3ad00bdcba
4 changed files with 43 additions and 1 deletions

View File

@@ -14,6 +14,10 @@ categories.workspace = true
publish.workspace = true
default-run = "pacman-server"
[lib]
name = "pacman_server"
path = "src/lib.rs"
[dependencies]
axum = { version = "0.8", features = ["macros"] }
tokio = { version = "1", features = ["full"] }
@@ -44,3 +48,11 @@ fast_image_resize = { version = "5.3", features = ["image"] }
image = { version = "0.25", features = ["png", "jpeg"] }
sha2 = "0.10"
# validator = { version = "0.16", features = ["derive"] }
[dev-dependencies]
tokio = { version = "1", features = ["full"] }
http = "1"
hyper = { version = "1", features = ["server", "http1"] }
hyper-util = { version = "0.1", features = ["server", "tokio", "http1"] }
bytes = "1"
anyhow = "1"

View File

@@ -45,3 +45,19 @@ This crate is a webserver that hosts an OAuth login and leaderboard API for the
13. API Rate Limiting (inbound requests, by IP, by User)
14. Provider Circuit Breaker
15. Merge migration files
## Notes
### Image Handling
Avatar images are stored in S3 as follows:
- `avatars/{user_public_id}/{avatar_hash}.original.png`
- `avatars/{user_public_id}/{avatar_hash}.mini.png`
- The original image is converted to PNG and resized to a maximum of 512x512 pixels.
- Ideally, non-square images are fitted to a square.
- The mini image is converted to PNG and resized to a maximum of 16x16, 24x24, or 32x32 pixels. TBD.
- All images receive a Content-Type header of `image/png`.
Image processing is handled immediately asynchronously, allowing a valid presigned URL to be generated immediately.

View File

@@ -1 +1,10 @@
pub mod app;
pub mod auth;
pub mod config;
pub mod data;
pub mod errors;
pub mod formatter;
pub mod image;
pub mod logging;
pub mod routes;
pub mod session;