e48ea4f97f
fix: add CSS stylesheets via document API for SSR
...
- Add document::Stylesheet for /style.css and /highlight.css in AppRouter
- This ensures CSS is included in SSR HTML for all pages (home, post detail, etc.)
- Also add public/index.html for production builds
- Remove stale ISRG cache files
2026-06-03 15:37:17 +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
6b3e086628
feat: read theme from cookie during SSR
2026-06-03 14:38:00 +08:00
269095cc65
feat: configure incremental SSR caching
2026-06-03 14:36:22 +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
fe30d0495f
feat: SSR for post detail page
2026-06-03 14:17:52 +08:00
60a2cd49ab
feat: add SuspenseWrapper component for SSR
2026-06-03 14:14:45 +08:00
5e449013d6
refactor(highlight): output CSS to public/, add syntax aliases and case-insensitive lookup, fix code block CSS
2026-06-03 14:08:16 +08:00
34e3bcdf95
fix: address code review feedback
...
- Remove unnecessary 'style' from ammonia whitelist (syntect uses classes)
- Log syntect parse errors instead of silently discarding them
- Simplify find_syntax fallback: return &'static directly, remove OnceLock
- Add generated/highlight.css to .gitignore (build artifact)
- Add #[cfg(feature = "server")] guard on mod highlight in main.rs
- Remove redundant code_buffer/code_lang clear on CodeBlock end
2026-06-03 13:13:29 +08:00
2e1d05cb03
refactor: clean up highlight module, remove unused theme getters and imports
2026-06-03 11:54:26 +08:00
11261836c7
feat: add syntect code highlighting with catppuccin themes
...
- Add syntect dependency (server feature, fancy-regex backend)
- Create highlight module with LazyLock globals for SyntaxSet + themes
- Intercept CodeBlock events in markdown rendering for syntax highlighting
- Update ammonia whitelist to allow span/pre/code class/style attributes
- Add generate_highlight_css binary for CSS generation
- Add highlight-css Makefile target (runs before tailwindcss)
- Import generated highlight.css in input.css
- Remove hardcoded code block colors, let catppuccin CSS take over
2026-06-03 11:52:58 +08:00
c6ced73bac
fix(admin): resolve compilation errors in posts and write pages
2026-06-03 10:57:22 +08:00
6c039e16e8
refactor(api): remove unused word_count/reading_time from RenderedContent
2026-06-03 10:54:02 +08:00
09060e12c0
fix(admin): cap tiptap editor ready-polling at 100 attempts
...
Replace infinite loop with bounded for-loop (100 × 100ms = 10s max).
On timeout the skeleton overlay is dismissed so the user can still
interact with the form instead of being stuck forever.
2026-06-03 10:34:06 +08:00
61ae3abbc2
fix(api): generate ASCII-only slugs with timestamp fallback
...
Use is_ascii_alphanumeric() instead of is_alphanumeric() to keep
URLs clean. Non-ASCII characters (CJK, etc.) are replaced with
dashes. When the result is empty (pure non-ASCII title), fall back
to a Unix timestamp.
2026-06-03 10:33:11 +08:00
f5413e00cc
fix(auth): prevent password_hash from reaching the frontend
...
Introduce PublicUser struct without password_hash field. The
get_current_user server function now returns PublicUser via
CurrentUserResponse, so Argon2 hashes are never serialized to WASM.
Internal server-side functions (get_current_admin_user) continue
using the full User struct.
2026-06-03 10:32:15 +08:00
8146a8a779
perf(api): split row_to_post into list and full variants
...
List pages (home, tags, search, admin) now use row_to_post_list which
reads pre-rendered content_html from DB instead of re-rendering markdown
on every request. Only get_post_by_slug uses row_to_post_full which
includes TOC, anchors, word count, and prev/next navigation.
2026-06-03 10:29:46 +08:00
19e5a0be41
fix(api): correct count_words for CJK characters
...
Chinese characters (U+4E00-U+9FFF) also return true for is_alphabetic(),
so they were being counted as part of English words instead of individually.
Fix: check CJK range before is_alphabetic().
2026-06-03 10:25:38 +08:00
e6c3cacf12
chore: format with cargo fix
2026-06-03 10:12:04 +08:00
0290f4d2e7
fix(api): remove debug logging that caused UTF-8 boundary panic; configure ammonia to preserve anchor attributes
2026-06-03 10:09:14 +08:00
0c34df4ba7
fix(api): configure ammonia to preserve class and aria-hidden attributes for anchor links
2026-06-03 09:54:16 +08:00
fb4f5790fc
fix(api): remove hidden attr from anchor links, use CSS display instead
2026-06-03 09:48:12 +08:00
5ff58fec59
fix(api): fix markdown rendering to properly handle code blocks and other elements
2026-06-02 18:30:26 +08:00
14e4a26dc0
fix(api): use rendered HTML with anchors in row_to_post
2026-06-02 18:28:24 +08:00
5544ea0c18
feat(admin): add cover_image input field in write form
2026-06-02 18:22:22 +08:00
6b1f2e27c9
feat(components): add post page components (header, toc, content, footer, nav)
2026-06-02 18:21:25 +08:00
1088691dca
feat(api): enhance markdown rendering with TOC, anchors, word count; add cover_image support; prev/next post navigation
2026-06-02 18:17:21 +08:00
203591ff65
feat(model): extend Post with cover_image, reading_time, word_count, toc_html, prev/next nav
2026-06-02 18:13:04 +08:00
f3c1718cd0
feat: add use_delayed_loading hook to prevent skeleton flash
2026-06-02 17:53:04 +08:00
9c5b09a278
chore: code cleanup - formatting, EOF newlines, model helper, and UI tweaks
2026-06-02 17:33:28 +08:00
1950646bef
feat: add shared components, new pages, and pagination
2026-06-02 17:33:28 +08:00
36231a8ec2
feat: add XSS sanitization with ammonia for markdown rendering
2026-06-02 17:33:28 +08:00
327738c2e0
refactor: replace post_status ENUM with TEXT + CHECK constraint
2026-06-02 17:33:28 +08:00
32e8407ed7
fix: use Debug format {:?} for database errors
...
tokio-postgres Display only shows 'db error', use {:?} for full error chain
2026-06-02 17:33:28 +08:00
5695b1c62b
feat: add explicit error logging and startup validation
...
- Add DATABASE_URL validation on server startup (exit early with clear error)
- Add tracing::error! to all server functions in api/auth.rs
- Bulk add tracing::error! to all database error handlers in api/posts.rs
- Server 500 errors now log detailed context to terminal
2026-06-02 17:33:28 +08:00
b6cabe489f
feat: migrate frontend to database-driven posts
...
- Replace hardcoded POSTS with API-driven data in home, archives, tags
- Add post detail page /post/:slug with HTML rendering
- Add admin posts management page with list and soft delete
- Update dashboard with real stats from database
- Add admin navigation for posts management
- Fix PartialEq derives for Post, Tag, PostStats models
- Use use_resource and use_memo for data fetching with proper loading states
2026-06-02 17:33:28 +08:00
df339cb084
feat: add post creation form to write.rs
...
- Add summary, slug, tags, status fields to editor
- Integrate create_post API with validation
- Add loading and error states
- Keep Tiptap editor initialization intact
2026-06-02 17:33:28 +08:00
973d6f3d57
feat: add posts, tags database schema and API
...
- Add migration 002_posts.sql with posts, tags, post_tags tables
- Add Post/Tag/PostStats models with PostStatus enum
- Add posts API with full CRUD:
- create_post, update_post, delete_post (admin only)
- get_post_by_slug, list_published_posts (public)
- list_posts, get_post_stats (admin)
- list_tags, get_posts_by_tag, search_posts (public)
- Slug auto-generation with uniqueness check
- Server-side markdown rendering with pulldown-cmark
- Auto-summary extraction from markdown
- Soft delete support
2026-06-02 17:33:28 +08:00
a58e0f4e3b
修复 Footer 组件滚动监听器未正确清理的问题
2026-06-02 17:33:28 +08:00
2b90fd05d6
将 session 清理错误日志改为 Debug 格式并忽略 tiptap 资源目录
...
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 17:33:28 +08:00
c924b1e643
修复编译器警告并改进代码质量
2026-06-02 17:33:28 +08:00
24b04ee638
修复请求日志不输出的问题
...
TraceLayer 默认使用 DEBUG 级别,被 INFO 过滤器过滤;且放在
serve_dioxus_application 之前会被其重建路由时丢弃。将级别提升
至 INFO 并移至 serve_dioxus_application 之后。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 17:33:28 +08:00
李林军
4093178fc3
添加tracing日志并重构服务器启动逻辑
2026-05-27 11:39:09 +08:00
9c834ba1df
添加骨架屏组件,优化 admin 路由切换和编辑器初始化体验
...
- AdminLayout 使用骨架屏替代简单"加载中"文字,保持布局结构一致避免闪烁
- WritePage 添加编辑器初始化骨架屏和就绪状态轮询
- 新增 admin_skeleton.rs 和 write_skeleton.rs 组件
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 09:25:26 +08:00
61376f6ba9
修复 admin 路由切换闪烁,全局替换原生导航为客户端路由
...
- 新增全局 UserContext,将用户认证状态提升到 App 级别缓存
- 将 /admin 和 /admin/write 改为嵌套路由,AdminLayout 作为共享父布局
- AdminLayout 使用 Outlet 渲染子页面,避免路由切换时重复挂载
- 修复所有原生 <a> 标签导致的整页刷新问题:
- Header 导航栏 Logo 和 NavItem
- 首页文章卡片、分页按钮
- 归档页文章条目
- 标签页标签云、文章卡片、标签链接
- 登录/注册页面链接
- Dashboard 快捷操作按钮
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 00:18:15 +08:00
0be0719fdb
将 session cookie 改为后端 HttpOnly 设置
...
- login 通过 Set-Cookie 响应头设置 HttpOnly cookie
- get_current_user 从请求 Cookie header 读取 token,匹配具体 session
- logout 通过 Set-Cookie 清除 cookie,并删除对应 session
- 移除前端 document.cookie 操作代码
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 23:54:58 +08:00
e358f2af7d
登录页面支持回车键提交表单
...
将 on_submit 改为 Callback::new,在用户名和密码输入框上监听
onkeydown 事件,按下 Enter 键时触发登录提交。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 23:45:24 +08:00
f6d60520eb
集成 Tiptap Markdown 编辑器到文章撰写页面
...
- 新增 libs/tiptap-editor/ 打包子项目(Tiptap Core + StarterKit + Markdown)
- 构建产物输出到 public/tiptap/
- 替换原有的 textarea + pulldown_cmark 预览为 WYSIWYG 编辑器
- Makefile 新增 build-editor target
- Dioxus.toml 引入 editor.js 和 editor.css
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 17:46:04 +08:00