206 Commits

Author SHA1 Message Date
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
xfy
3fc91db515 fix(posts): replace space-x-3 with flex gap-3 for edit/delete button spacing 2026-06-05 18:22:59 +08:00
xfy
c776536678 fix(write-skeleton): align skeleton layout with actual write page
- fix bottom button bar layout (justify-end -> items-center with flex-1 spacer)
- remove extra p-6 padding from editor container
- add p-4 padding to toolbar area to match Tiptap editor padding
2026-06-05 18:21:35 +08:00
xfy
078e9b1da1 fix(tiptap-editor): configure link via StarterKit to avoid duplicate extension warning 2026-06-05 18:19:24 +08:00
xfy
f6db477a88 fix(write): reset tiptap editor state on unmount to prevent blank editor on re-navigation 2026-06-05 18:16:46 +08:00
xfy
ad208a4603 fix(tiptap-editor): correct setContent call signature for markdown parsing 2026-06-05 18:05:47 +08:00
xfy
72b932c21b fix(write): add allow lint for unused vars in write_editor 2026-06-05 17:58:05 +08:00
xfy
077573af67 fix(layout): highlight write nav for both /write and /write/:id 2026-06-05 17:55:18 +08:00
xfy
4805f915c7 fix(write): address review feedback - backfill race, load errors, nav delay 2026-06-05 17:51:46 +08:00
xfy
2ecdc09138 feat(write): support edit mode with data backfill 2026-06-05 17:45:54 +08:00
xfy
0c3a084c9b feat(admin): add edit button to post list 2026-06-05 17:37:37 +08:00
xfy
026a331dcd feat(router): add /admin/write/:id route for post editing 2026-06-05 17:34:26 +08:00
xfy
6d28c2b4ce feat(api): add get_post_by_id server function for editing 2026-06-05 17:29:48 +08:00
xfy
0a33a843f8 fix(theme): resolve hydration mismatch in ThemeToggle by deferring icon render until mounted 2026-06-05 17:07:23 +08:00
xfy
6d621d9ec4 feat(admin): remove '前台' nav item from admin header 2026-06-05 17:07:22 +08:00
xfy
26eb62c2ae fix(upload): disable default body limit and fix error object serialization 2026-06-05 16:52:52 +08:00
xfy
ad6c69b0e8 db(migration): merge slug partial unique into 002_posts.sql 2026-06-05 16:29:20 +08:00
xfy
22de5add83 fix(api): restore deleted_at filter in slug uniqueness check 2026-06-05 16:20:43 +08:00
xfy
488dbc144d Add migration: partial unique index on posts.slug 2026-06-05 16:19:45 +08:00
xfy
c7668c679c fix(api): include deleted posts in slug uniqueness check 2026-06-05 16:02:45 +08:00
xfy
53047bf824 fix(utils): strip images before links in markdown stripping 2026-06-05 15:58:35 +08:00
xfy
5e77e7efea build: verify image upload feature compiles and passes checks 2026-06-05 15:25:59 +08:00