16 Commits

Author SHA1 Message Date
xfy
5e77e7efea build: verify image upload feature compiles and passes checks 2026-06-05 15:25:59 +08:00
xfy
5b481e801c feat: add custom .sublime-syntax loading for Swift and Kotlin, improve alias table
- Enable yaml-load feature in syntect to support loading .sublime-syntax files
- Load custom syntax definitions from syntaxes/ directory via SyntaxSet::into_builder
- Add Swift and Kotlin syntax definitions as .sublime-syntax files
- Fix alias table to properly resolve full language names (javascript,
  typescript, python, swift, kotlin, golang) via file extension lookup
- Redirect ts/typescript to JavaScript highlighting (syntect v5.3.0 does not
  support TypeScript's Sublime Text v2 syntax format)
- Add documentation comments to generate_highlight_css.rs binary
2026-06-05 09:27:21 +08:00
xfy
f81656bb18 revert: disable wasm-split due to fullstack SSR incompatibility
wasm-split is incompatible with Dioxus fullstack SSR/hydration.
The feature causes hydration failures because split WASM chunks
are not available during client-side hydration of server-rendered HTML.

Changes reverted:
- Remove wasm-split feature from dioxus and dioxus-router
- Remove --wasm-split flag from dx build in Makefile
2026-06-04 17:44:33 +08:00
xfy
a282d1dd29 feat: enable wasm-split for route-based code splitting
Enable Dioxus 0.7 automatic WASM bundle splitting by route:

- Add wasm-split feature to dioxus and dioxus-router in Cargo.toml
- Add --wasm-split flag to dx build in Makefile
- Router definitions stay as plain #[route] — splitting is automatic

Dioxus 0.7.9 handles splitting automatically when the feature and
CLI flag are enabled. Per-route #[wasm_split] attributes are not
required (and not supported by this version's derive macro).
2026-06-04 17:32:00 +08:00
xfy
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
xfy
36231a8ec2 feat: add XSS sanitization with ammonia for markdown rendering 2026-06-02 17:33:28 +08:00
李林军
4093178fc3 添加tracing日志并重构服务器启动逻辑 2026-05-27 11:39:09 +08:00
xfy
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
xfy
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
xfy
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
xfy
8b9c6aa83d 重构 admin 模块,新增共享组件和文章撰写页面
- 将 monolithic admin.rs 拆分为 admin/ 目录模块(dashboard、write)
- 新增 components 模块:Header、Footer、AdminLayout
- 新增 /admin/write 文章撰写页面,支持 Markdown 实时预览
- 添加 pulldown-cmark 依赖用于 Markdown 渲染
- .env 移出版本控制,新增 .env.example 模板
- Home、Archives、Tags、Login、Register 等页面适配新组件

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 16:13:18 +08:00
xfy
61638fafcc 更新依赖版本:http 1.4.1, log 0.4.30, regex 1.12
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 08:28:49 +08:00
xfy
6df0a7ee19 US-006: 验证 + 修复编译和运行时问题
- 修复 migration: role 从 ENUM 改为 VARCHAR(20) 以兼容 tokio-postgres
- 修复 Cargo.toml: 将 chrono/argon2/uuid/rand 改为非 optional,添加 wasm-bindgen/getrandom js
- 修复 main.rs: Tokio runtime panic,改用 std::thread + Runtime::new
- 修复 db/mod.rs wasm stub: DummyPool 替代 deadpool_postgres
- 修复 login/admin.rs: wasm_bindgen::JsCast 条件编译
- 验证通过: 注册✓ 登录✓ get_current_user✓ 重复注册拒绝✓ 错误密码✓

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:49:43 +08:00
xfy
14b92c3a89 US-005: 后台页面与路由整合
- src/router.rs: Dioxus 路由定义 (/login, /register, /admin, /)
- src/main.rs: 整合所有模块 + server block 启动 dotenvy + session 清理任务
- src/tasks/session_cleanup.rs: 每小时清理过期 session
- 修复编译错误: chrono serde, tokio-postgres chrono, argon2 OsRng
- 移除 server_context 依赖,简化 get_current_user 查询
- Tailwind CSS CDN + darkMode class 配置

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:29:50 +08:00
xfy
031a7aa0f2 US-001: 数据库配置与建表
- 添加依赖: tokio-postgres, deadpool-postgres, argon2, uuid, chrono, regex, dotenvy
- 创建 .env 文件模板 (DATABASE_URL)
- 创建 migrations/001_init.sql: users 表 + sessions 表 + 部分唯一索引
- 创建 src/db/mod.rs 和 src/db/pool.rs: std::sync::LazyLock 全局初始化 deadpool

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:15:47 +08:00
xfy
2dd53e3516 Initial commit: Dioxus project scaffold
Add project configuration and main entry point.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 15:00:12 +08:00