155 Commits

Author SHA1 Message Date
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
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
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
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
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
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
22de5add83 fix(api): restore deleted_at filter in slug uniqueness check 2026-06-05 16:20:43 +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
08bd69d64b feat(write): add onImageUpload callback to tiptap editor 2026-06-05 15:23:36 +08:00
xfy
76797f1bc3 feat(server): register upload route and static file serving 2026-06-05 15:14:10 +08:00
xfy
371ebcf8f9 fix(upload): gate axum imports behind #[cfg(feature = "server")]
Wrap all axum imports and constants with #[cfg(feature = "server")]
to prevent WASM compilation failures. Provide a no-op stub for
non-server builds.

Fixes: error[E0433]: cannot find module or crate  in scope
2026-06-05 15:08:19 +08:00
xfy
93020a8e14 fix(upload): remove space in filename format and unused UploadResponse struct 2026-06-05 15:00:29 +08:00
xfy
1bae3446e6 feat(api): add image upload handler with admin auth 2026-06-05 14:56:29 +08:00
xfy
dd7022ec75 fix: replace select element with overlay pattern to fix dropdown arrow alignment in write page 2026-06-05 11:09:02 +08:00
xfy
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
xfy
58cfcc31bf fix: improve label and button text contrast in write page light mode 2026-06-05 10:33:41 +08:00
xfy
7866c53e36 feat: add dark mode toggle button to admin layout 2026-06-05 10:33:34 +08:00
xfy
5321b8cf97 refactor: reorganize admin write page layout with card-based sections 2026-06-05 09:58:26 +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
81d3d72a48 feat: enable extended markdown parsing with table support in post rendering 2026-06-04 18:06:46 +08:00
xfy
245fd83ec8 feat: replace in-footer scroll-to-top link with fixed floating button 2026-06-04 17:55:26 +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
c44f37e9ec feat: enable wasm_split for non-core routes
Split low-frequency routes into separate WASM chunks:
- archives, tags, search, about
- admin/* (dashboard, write, posts)
- login, register

Core reading paths (home, post detail) remain in initial bundle.
2026-06-04 17:15:14 +08:00
xfy
675349a5b4 fix: add #[cfg(feature = server)] to server-only imports for WASM compatibility 2026-06-04 16:40:42 +08:00
xfy
e5ce1580e2 fix: restore dead_code allow on CreatePostRequest to suppress warning 2026-06-04 16:25:05 +08:00
xfy
1830fc9f2e cleanup: remove dead code, debug prints, and unused dead_code allow attributes 2026-06-04 16:20:43 +08:00