Ganonmaster 2c219f5565 Fix S3 collision, alias clearing, upload limit, TOCTOU; add tests
Bug fixes:
- S3 key is now emoji/{uuid}.{ext} instead of emoji/{filename},
  preventing silent overwrites when two emotes share a filename
- UpdateEmoteRequest.alias uses Option<Option<String>> with a custom
  deserializer so a JSON null clears the alias rather than being ignored;
  the manage UI now sends null when the alias field is emptied
- POST /emotes is limited to 8 MiB via DefaultBodyLimit
- update_emote replaced the fetch-then-update pair with a single
  UPDATE … RETURNING using COALESCE/CASE WHEN, eliminating the TOCTOU
  race between concurrent edits

Refactoring:
- Extracted src/lib.rs so domain logic is a library crate; src/main.rs
  is now a thin startup entry point
- auth::check decoupled from AppState — takes Option<&AuthConfig> directly
- Removed unused config field from Database struct

Tests (40 total):
- auth: 10 unit tests covering all check() branches
- models: 6 unit tests for timestamp parsing and alias deserialization
- db: 9 unit tests against in-memory SQLite covering full CRUD
- routes: 15 integration tests in tests/routes.rs covering auth
  middleware, input validation, and all mutating endpoints
2026-04-28 11:31:25 +02:00
2026-04-11 22:53:33 +02:00
2026-04-28 03:23:57 +02:00
2026-04-11 22:03:08 +02:00
2026-04-28 03:23:57 +02:00
2026-03-18 13:54:42 +01:00
2026-03-18 13:54:42 +01:00

mikebase

A Rust-based emote database and API.

S
Description
A Rust-based emote database and API.
Readme GPL-3.0 261 KiB
v0.4.0 Latest
2026-05-02 00:53:09 +00:00
Languages
Rust 75.3%
HTML 23.2%
Dockerfile 1.5%