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

5
Cargo.lock generated
View File

@@ -2677,14 +2677,19 @@ version = "0.1.1"
name = "pacman-server" name = "pacman-server"
version = "0.4.0" version = "0.4.0"
dependencies = [ dependencies = [
"anyhow",
"async-trait", "async-trait",
"axum", "axum",
"axum-cookie", "axum-cookie",
"bytes 1.10.1",
"chrono", "chrono",
"dashmap", "dashmap",
"dotenvy", "dotenvy",
"fast_image_resize", "fast_image_resize",
"figment", "figment",
"http",
"hyper",
"hyper-util",
"image", "image",
"jsonwebtoken", "jsonwebtoken",
"oauth2", "oauth2",

View File

@@ -14,6 +14,10 @@ categories.workspace = true
publish.workspace = true publish.workspace = true
default-run = "pacman-server" default-run = "pacman-server"
[lib]
name = "pacman_server"
path = "src/lib.rs"
[dependencies] [dependencies]
axum = { version = "0.8", features = ["macros"] } axum = { version = "0.8", features = ["macros"] }
tokio = { version = "1", features = ["full"] } tokio = { version = "1", features = ["full"] }
@@ -44,3 +48,11 @@ fast_image_resize = { version = "5.3", features = ["image"] }
image = { version = "0.25", features = ["png", "jpeg"] } image = { version = "0.25", features = ["png", "jpeg"] }
sha2 = "0.10" sha2 = "0.10"
# validator = { version = "0.16", features = ["derive"] } # 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) 13. API Rate Limiting (inbound requests, by IP, by User)
14. Provider Circuit Breaker 14. Provider Circuit Breaker
15. Merge migration files 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;