67e23d672c
feat(admin): add rebuild content button to posts management page
...
Outline-style button next to '写文章', calls rebuild_content_html(false)
to rebuild posts with NULL content_html. Shows result message below header.
2026-06-12 10:43:49 +08:00
75e0659cb2
fix(admin): 后台管理页改为 CSR 避免闪烁
...
- dashboard: use_resource → use_signal + wasm32-only 加载
- posts: use_server_future → use_signal + wasm32-only 加载 + 乐观删除
- write: use_resource → use_signal + wasm32-only 加载
- 移除 use_server_future/use_resource 导致的骨架屏闪烁
- 操作按钮使用乐观更新,不调用 restart()
2026-06-11 18:04:07 +08:00
ea440cd61c
fix(admin): 评论管理页改为 CSR 避免按钮点击闪烁
2026-06-11 17:34:39 +08:00
569eec5bf8
fix(admin): 评论管理页多项修复
...
- 修复默认头像无法显示:AdminComment 添加 avatar_url 字段
- 修复状态标签换行:移除 w-20 固定宽度,添加 whitespace-nowrap
- 操作按钮添加 cursor-pointer
- 已处于该状态的评论隐藏对应操作按钮
- 修复操作后页面不自动刷新:将 restart() 移到异步块内
2026-06-11 16:10:42 +08:00
c10134c32e
fix(comments): convert confirm_with_message Result to Option for WASM compatibility
2026-06-11 13:15:17 +08:00
04737300e6
feat(comments): add complete comment system with guest commenting, moderation, and admin UI
...
Implements a fully self-built comment system for the blog:
Data layer:
- comments table with BIGSERIAL PK, parent_id self-reference (ON DELETE SET NULL),
depth tracking (max 20), status workflow (pending/approved/spam/trash),
content hashing for dedup, GDPR consent tracking, IP/UA storage with auto-purge
- 5 partial indexes optimized for read patterns
- updated_at auto-trigger
API (9 Dioxus server functions):
- Public: get_comments, get_comment_count, create_comment
- Admin: get_pending_comments, get_pending_count, get_all_comments,
approve_comment (with ancestor auto-approval), spam_comment, trash_comment,
batch_update_comment_status
Security:
- Function-level rate limiting (1/sec, burst 5) via FullstackContext IP extraction
- Input validation (name, email, URL scheme, content length, consent)
- Parent chain validation (must be approved, same post)
- Strict comment Markdown renderer (headings→strong, no img/id/data URIs, nofollow links)
- Honeypot anti-spam field
- 5-minute dedup window via SHA-256 content hash
Frontend:
- CommentSection with SuspenseBoundary isolation
- Flat-list rendering with depth-based CSS indentation (responsive)
- Gravatar via cravatar.cn (server-computed, email never exposed)
- Inline reply forms (one-at-a-time via Signal)
- Admin action buttons (approve/spam/delete) visible per-comment
- CommentForm with privacy consent, Markdown hint, loading states
Admin:
- /admin/comments page with status tabs, batch operations, pagination
- Pending count badge on admin dashboard
Infrastructure:
- Shared get_current_admin_user moved from posts/helpers to auth module
- COMMENT_LIMITER rate limiter tier
- Moka caches (60s TTL for comments, 10s for pending count)
- IP/UA purge background task (daily, 90-day retention)
2026-06-11 12:34:26 +08:00
efa41b42c2
feat(auth): add loading state to login/register forms and update AGENTS.md
2026-06-11 10:44:27 +08:00
f9d23d1eed
refactor(ui): redesign with warm palette, sage accent, and consistent theme vars
...
- Warm editorial color palette (#faf9f6 light / #141416 dark)
- Sage green accent (#5c7a5e) for nav, links, buttons, tags
- Replace all hardcoded hex colors with CSS theme utilities
- Serif font (system Georgia) only on header logo
- Better hover states: scale, brightness, color transitions
- Accent-colored focus rings on inputs
- Fix language mixing: Back to Home → 返回首页
- No external font dependencies
2026-06-11 10:29:11 +08:00
9cf6a7e4e6
fix(admin): replace use_delayed_loading with DelayedSkeleton for posts page
...
Use the same skeleton pattern as Home/Archives/Search pages.
Skeleton shows immediately (static gray blocks) instead of opacity-0 blank,
eliminating white flash during fast loads.
2026-06-10 18:15:46 +08:00
265eb15887
feat(admin): add pagination to posts management page
...
- list_posts API now accepts page/per_page params with LIMIT/OFFSET
- Add /admin/posts/:page route with PostsPage component
- Pagination component with prev/next navigation (20 posts/page)
- Update dashboard to use new list_posts(1, 5) signature
2026-06-10 18:03:36 +08:00
373d4f09ed
refactor: clean up write page formatting and remove separator line
...
- Reorder imports to group wasm32-gated items together
- Format struct pattern matches for readability
- Remove metadata/editor separator line for cleaner visual flow
2026-06-10 17:50:07 +08:00
d3c5653808
feat: redesign admin write page with fixed-height editor layout
...
- Redesign write page UI with cleaner, more immersive editing experience
- Use CSS variables for theme-aware styling (paper-theme colors)
- Make editor fill remaining viewport height with internal scrolling
- Move action bar below editor (left-aligned, non-floating)
- Fix layout: page no longer scrolls, only editor content scrolls
- Update write skeleton to match new layout
- Update admin layout to use h-dvh for write routes to prevent page scroll
- Fix Dioxus.toml dev resource loading to include style.css
Fixes from review:
- Add missing relative positioning for loading overlay
- Use consistent root_class in unauthenticated state
- Use h-dvh instead of h-screen for mobile viewport compatibility
- Ensure skeleton matches actual component layout classes
2026-06-10 17:41:31 +08:00
2f433e8f11
feat: add 404 Not Found page
...
- Add NotFound component with elegant design
- Register catch-all route in router
- Add skeleton placeholder for NotFound route
- Remove unused design-taste-frontend skill
2026-06-10 15:43:05 +08:00
bd9053132b
refactor(admin): use explicit field ignores and separate error/loading arms
2026-06-10 14:38:52 +08:00
31b83cd449
chore: adapt admin pages to new PostListResponse shape
2026-06-10 14:35:51 +08:00
a2ec043c59
chore: adapt search page to new PostListResponse shape
2026-06-10 14:30:57 +08:00
4015412b41
feat: display accurate total in tag detail page
2026-06-10 14:25:54 +08:00
2ade51bd0f
feat: display accurate total in archives page
2026-06-10 14:22:18 +08:00
a2b0c759af
feat: use total count for accurate home page pagination
2026-06-10 14:18:22 +08:00
a3fa602df2
refactor(api): unify error handling with AppError enum
...
Replace scattered ServerFnError::new("...") inline calls and utils.rs
helper functions with a single AppError enum that provides:
- Automatic tracing::error logging for system errors
- Safe generic messages to frontend (no SQL/connection detail leaks)
- Typed error variants (Unauthorized, Forbidden, NotFound, etc.)
- 5 unit tests for message passthrough and detail hiding
Removes src/api/utils.rs entirely; all error creation now goes through
src/api/error.rs.
2026-06-10 13:16:06 +08:00
717266db1e
fix: resolve conditional compilation and dead code warnings
2026-06-08 16:11:24 +08:00
3fc91db515
fix(posts): replace space-x-3 with flex gap-3 for edit/delete button spacing
2026-06-05 18:22:59 +08:00
f6db477a88
fix(write): reset tiptap editor state on unmount to prevent blank editor on re-navigation
2026-06-05 18:16:46 +08:00
72b932c21b
fix(write): add allow lint for unused vars in write_editor
2026-06-05 17:58:05 +08:00
4805f915c7
fix(write): address review feedback - backfill race, load errors, nav delay
2026-06-05 17:51:46 +08:00
2ecdc09138
feat(write): support edit mode with data backfill
2026-06-05 17:45:54 +08:00
0c3a084c9b
feat(admin): add edit button to post list
2026-06-05 17:37:37 +08:00
026a331dcd
feat(router): add /admin/write/:id route for post editing
2026-06-05 17:34:26 +08:00
08bd69d64b
feat(write): add onImageUpload callback to tiptap editor
2026-06-05 15:23:36 +08:00
dd7022ec75
fix: replace select element with overlay pattern to fix dropdown arrow alignment in write page
2026-06-05 11:09:02 +08:00
28d1ee0d52
fix: reset UserContext on login/logout to prevent admin page stuck on re-login
...
Root cause: UserContext.checked was never reset on logout, causing AdminLayout's use_effect to skip get_current_user() on subsequent mounts, leaving the page in (checked=true, user=None) limbo.
- Reset ctx.user and ctx.checked on logout in admin_layout.rs
- Reset ctx.checked on login success in login.rs so AdminLayout re-validates session on mount
2026-06-05 10:42:20 +08:00
58cfcc31bf
fix: improve label and button text contrast in write page light mode
2026-06-05 10:33:41 +08:00
5321b8cf97
refactor: reorganize admin write page layout with card-based sections
2026-06-05 09:58:26 +08:00
c26c62558e
fix: add status_badge_class for badge styling, restore posts table backgrounds
2026-06-04 16:17:41 +08:00
58e9dbc5b7
refactor: add status_label/status_class/formatted_date helpers to Post model
2026-06-04 16:13:49 +08:00
58f972aa17
fix: restore register success alert layout with login link
2026-06-04 15:59:17 +08:00
4e33bd3ee6
refactor: extract form atoms (FormInput, FormLabel, AlertBox) and replace repeated input/button styles
2026-06-04 15:55:40 +08:00
ce14c476b5
refactor: replace string-based navigation with typed Route and Link components
2026-06-04 14:55:18 +08:00
5d018864c2
refactor: remove PageLayout from all frontend pages, delegate to FrontendLayout
...
- Remove PageLayout wrapper from Home, HomePage, Archives, Tags,
TagDetail, PostDetail, Search, and About components
- Remove unused imports: use_nav_items, use_route, PageLayout, Route
- Pages now render only their content; Header/Footer are provided by
FrontendLayout via the router's #[layout] attribute
- Skeleton screens (DelayedSkeleton) remain in data-loading branches
- This eliminates redundant Header/Footer re-mounting on every route
change, which was the primary source of page transition flicker
Files changed:
- src/pages/home.rs: remove PageLayout, keep HomeInfo + HomePosts
- src/pages/about.rs: remove PageLayout, render content directly
- src/pages/archives.rs: remove PageLayout, keep header + ArchivesContent
- src/pages/post_detail.rs: remove PageLayout, keep PostDetailContent
- src/pages/search.rs: remove PageLayout, keep search form + results
- src/pages/tags.rs: remove PageLayout from Tags and TagDetail
2026-06-03 18:38:11 +08:00
778726251a
fix: remove SuspenseBoundary, render skeleton screens directly in loading branch
2026-06-03 17:59:38 +08:00
754c1f5b86
feat: wrap all skeleton screens with DelayedSkeleton to prevent flicker
2026-06-03 17:43:34 +08:00
62519d620d
feat: add SearchSkeleton component and replace inline skeleton on search page
2026-06-03 17:30:47 +08:00
c2e1fbe3ac
feat: add TagsSkeleton/TagDetailSkeleton and replace generic fallback on tags pages
2026-06-03 17:25:47 +08:00
5becd73ebc
feat: add ArchiveSkeleton and replace generic fallback on archives page
2026-06-03 17:19:29 +08:00
372c701b07
feat: add PostDetailSkeleton and replace generic fallback on post detail page
2026-06-03 17:13:39 +08:00
076448d6ed
feat: add HomeSkeleton and replace generic fallback on home page
2026-06-03 17:09:20 +08:00
ccffab851a
fix: admin pages use client-only fetching; fix theme cookie parsing; restore custom skeletons
2026-06-03 14:55:50 +08:00
6cfe664085
feat: SSR for home and tags pages
2026-06-03 14:40:15 +08:00
34e70f6c57
feat: SSR for admin pages
2026-06-03 14:33:49 +08:00
1afb477829
feat: SSR for archives page
2026-06-03 14:23:44 +08:00