201 Commits

Author SHA1 Message Date
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
xfy
08bd69d64b feat(write): add onImageUpload callback to tiptap editor 2026-06-05 15:23:36 +08:00
xfy
c2c7b46958 fix(tiptap-editor): use insertContentAt with drop position in onDrop handler
Previously dropped images were inserted at the current cursor position
instead of the actual drop position. Now uses insertContentAt(pos, ...)
to place images at the correct location.
2026-06-05 15:21:38 +08:00
xfy
00c5a880f4 feat(editor): add FileHandler extension for image paste/drop upload 2026-06-05 15:19:31 +08:00
xfy
3d7dd5b5a5 deps(editor): add @tiptap/extension-file-handler 2026-06-05 15:17:39 +08:00
xfy
76797f1bc3 feat(server): register upload route and static file serving 2026-06-05 15:14:10 +08:00