227 Commits

Author SHA1 Message Date
xfy
91caf3f8bd feat(posts): invalidate caches on write operations 2026-06-09 17:09:17 +08:00
xfy
887aacb5f1 fix(posts): check cache before auth, skip caching None slugs 2026-06-09 17:06:53 +08:00
xfy
4c44b62e3d feat(posts): add caching to read operations 2026-06-09 17:01:12 +08:00
xfy
0b594ff719 refactor(cache): use CacheKey directly, remove unnecessary async 2026-06-09 16:56:41 +08:00
xfy
62e2045b35 feat: add cache module with moka-backed post/tag/stats caching
- Create src/cache.rs with CacheKey enum, moka cache instances,
  getter/setter functions, and invalidation helpers.
- TTLs: post list 60s, tags 300s, single post 600s, stats 60s,
  tag posts 120s.
- Register mod cache in src/main.rs.
- All cache internals gated behind #[cfg(feature = "server")]
2026-06-09 16:47:17 +08:00
xfy
9452c196fa docs: document why image crate excludes WebP decoder 2026-06-09 16:14:28 +08:00
xfy
c08d35856e test: add WebP config parsing and clamping tests 2026-06-09 16:04:26 +08:00
xfy
05cf2f79ea refactor: extract WebP encode helper to reduce duplication 2026-06-09 15:59:02 +08:00
xfy
7d9c4b9e0f refactor: simplify TraceLayer setup and reformat route definitions 2026-06-09 15:58:18 +08:00
xfy
035d11e39b fix: log warning when WebP env vars are clamped 2026-06-09 15:53:39 +08:00
xfy
db3379364f fix: limit WebP decode buffer size to prevent malicious allocations 2026-06-09 15:48:34 +08:00
xfy
7c6bab8019 fix: preserve f32 precision for WebP quality 2026-06-09 15:43:16 +08:00
xfy
2e2be7b16d feat: add WebP encoding support with zenwebp
- Replace image crate's WebP with zenwebp for better quality/speed
- Add webp.rs module with configurable quality and method
- Update .env.example with WEBP_QUALITY and WEBP_METHOD
- Add WebP decode support in image serving pipeline
- Add detailed timing logs for WebP conversion
2026-06-09 15:30:06 +08:00
xfy
5ecd8a9b86 feat: add disk-level cache for processed image variants 2026-06-09 13:45:49 +08:00
xfy
0319c927c6 chore: format code 2026-06-09 13:43:10 +08:00
xfy
b26094835f feat: convert uploaded images to WebP for storage savings 2026-06-09 13:39:36 +08:00
xfy
281da208f5 fix: remove stray space in upload filename format string 2026-06-09 13:37:11 +08:00
xfy
44c1358da5 refactor: extract post content JS into standalone script 2026-06-09 13:18:40 +08:00
xfy
0345fa70f2 fix: add click handler for code block copy button 2026-06-09 11:33:26 +08:00
xfy
1c492545c3 chore: add release skill for version publishing workflow 2026-06-09 11:24:39 +08:00
xfy
6ab101b053 chore: add CHANGELOG.md for v0.1.0 v0.1.0 2026-06-09 11:17:59 +08:00
xfy
28d3ed998a chore: optimize release profile for fullstack and add linux static build target
- Change opt-level from 'z' to 3 for better runtime performance
- Use thin LTO for faster compilation with similar results
- Remove panic=abort and strip=true to preserve server debuggability
- Add --debug-symbols=false to dx build for smaller WASM
- Add build-linux target for static musl binary
2026-06-09 10:30:36 +08:00
xfy
4595d1c8e7 chore: remove unused dependencies and slim down features
- Remove tower_governor (unused, governor used directly instead)
- Remove tower-http fs feature (only trace is used)
- Remove 4 unused web-sys features: HtmlDocument, HtmlScriptElement, HtmlButtonElement, HtmlElement
- Slim tokio features from full to rt-multi-thread,macros,fs,time,sync
2026-06-09 10:21:27 +08:00
xfy
42b39266a6 fix: preserve data URI in img src during markdown rendering
ammonia's default url_schemes whitelist excludes 'data', causing
data:image/* URLs to be stripped from img src attributes. Add 'data'
to allowed schemes. Also skip data: URIs in JS thumbnail logic.
2026-06-09 10:06:34 +08:00
xfy
3974856f3d fix: resolve image/upload 500 errors and refactor rate limiting
- Separate /uploads and /api/upload routes from Dioxus app to avoid
  IncrementalRenderer intercepting non-page requests
- Remove broken SmartIpKeyExtractor-based general_limit() that failed
  under Dioxus dev server proxy (Unable To Extract Key)
- Move rate limiting into handlers using governor::RateLimiter directly
- Add IMAGE_LIMITER for /uploads/* serving
- Make all rate limits configurable via environment variables
- Add rate limit config to .env.example with sensible defaults
2026-06-09 09:48:51 +08:00
xfy
4f368e6fb8 test: add 122 unit tests across 12 modules
Cover utils/text, api/slug, auth/password, auth/session,
models/post, models/user, api/auth validation, api/markdown,
api/image, highlight, api/rate_limit. Add make test target.
2026-06-09 09:25:44 +08:00
959d813630 feat: pg_trgm full-text search for posts (#2)
* feat(db): add pg_trgm search index on posts

* feat(api): use pg_trgm similarity search for posts

* fix(api): use ILIKE + word_similarity instead of % operator for search
2026-06-08 18:26:35 +08:00
xfy
e74b9f3c39 feat: apply rate limiting to Register, Login, and upload endpoints
- Remove unused tags.rs and related re-exports
- Convert strict_limit/upload_limit from Layer to manual check functions
- Add IP-based rate limiting checks to Register, Login, and upload_image
- Keep general_limit as global middleware for all other routes
2026-06-08 17:30:26 +08:00
xfy
dd8477c7a3 chore: sync Cargo.lock and remove unused seed script 2026-06-08 17:05:46 +08:00
xfy
db33d02154 feat: apply rate limiting middleware to axum router 2026-06-08 16:59:26 +08:00
xfy
76f1b8dd53 feat: add rate limiting configurations 2026-06-08 16:57:48 +08:00
xfy
771b155a88 refactor: split posts.rs and fix N+1 with JOIN+array_agg 2026-06-08 16:53:31 +08:00
xfy
32131377c3 refactor: integrate tags module into posts.rs and mod.rs 2026-06-08 16:45:20 +08:00
xfy
441060e7c2 refactor: extract tag operations into api/tags.rs 2026-06-08 16:44:38 +08:00
xfy
6e4e72b232 refactor: extract markdown rendering into api/markdown.rs 2026-06-08 16:42:55 +08:00
xfy
4c88d5e2bb refactor: extract slug utilities into api/slug.rs 2026-06-08 16:40:44 +08:00
xfy
4d7d7ec383 db: add performance indexes on posts, tags, sessions 2026-06-08 16:39:13 +08:00
xfy
72d28e2db3 deps: add tower-governor for rate limiting 2026-06-08 16:37:50 +08:00
xfy
185bcab9f9 cleanup(forms): remove unused BUTTON_SECONDARY_CLASS 2026-06-08 16:19:35 +08:00
xfy
e5d37aa034 refactor(api): extract error helper functions, DRY up db/query/tx error handling 2026-06-08 16:17:03 +08:00
xfy
717266db1e fix: resolve conditional compilation and dead code warnings 2026-06-08 16:11:24 +08:00
xfy
012704d0a5 chore(tiptap-editor): update package-lock.json 2026-06-08 15:54:27 +08:00
xfy
b6f41e74e7 feat: image thumbnail + lightbox viewer
- Add ImageViewer reusable component with thumbnail and click-to-zoom
- PostCover: load ?w=1200 thumbnail, click to view full-size
- PostCard: display cover thumbnail (?thumb=400x300) in list view
- PostContent: inline images load ?w=800 thumbnail, click to zoom
- Add lightbox overlay styles with fade-in animation
- Add zoom cursor and hover effect for zoomable images
- Extend web-sys features for DOM image/lightbox manipulation
2026-06-08 15:52:47 +08:00
xfy
2c08c6c7fd fix(image): case-insensitive format matching in process_image 2026-06-08 15:29:17 +08:00
xfy
8b1b949bf8 refactor: apply formatting to image.rs 2026-06-08 15:13:18 +08:00
xfy
d584ef6e00 fix(image): improve cache keys, case-insensitive format, strict thumb validation 2026-06-08 15:13:18 +08:00
xfy
7963103f62 feat: wire up image processing route replacing ServeDir 2026-06-08 15:13:18 +08:00
xfy
1f009f57c8 feat: add image processing handler with resize/thumbnail/rotate/format 2026-06-08 15:13:18 +08:00
xfy
8109740e94 chore: add image and moka dependencies for image processing 2026-06-08 15:13:18 +08:00
xfy
72ba8ea9ec chore(tiptap-editor): update package-lock.json 2026-06-06 00:29:53 +08:00