2026-08-11
lezi-fun
7188d07aea
security: server-side CAPTCHA (HMAC-signed) + magic-byte upload sniff + pagination bounds
...
Port upstream ac4af62 + PR #14/#17:
- lib/captcha.js: HMAC(CAPTCHA_SECRET, id:answer) challenge; GET
/api/captcha returns {id, text, sig}; register/createPost/createReply
verify answer server-side (bad answer / forged sig rejected)
- Frontend (Modals/NewPost/ReplyList): fetch challenge from server,
submit id+answer+sig; no more client-side answer check (was bypassable)
- Upload: sniff JPEG/PNG/GIF/WebP magic bytes (ignore client MIME), UUID
filenames — blocks spoofed HTML-as-image (stored XSS)
- Posts pagination: limit cap 50, page cap (deep-pagination DoS)
- CAPTCHA_SECRET env (falls back to JWT_SECRET)
2026-08-11 20:25:16 +08:00
lezi-fun
6947cdaf36
fix: polish forum navigation and interface states
2026-08-11 15:25:05 +08:00
lezi-fun
0562dd735a
feat: i18n (i18next + react-i18next) zh/en + hydration fixes
...
- i18next + react-i18next: zh/en locales, language detection
(localStorage > navigator > zh), settings language switcher
- Components i18n'd: Navbar, Feed, NewPost, Modals, SettingsPage,
SettingsProfile, AccountSecurity, RecoveryCodes
- Fix hydration mismatch (spinner restart): forum name via cookie
(Server Component reads cookie, SSR outputs name, no inline script
DOM injection); remove createPortal in RecoveryCodes modal; i18n
sync init (initImmediate) so SSR/CSR text matches
- LoadingScreen: React-state name rendering (no script-injected nodes)
- Fix double spinner in Feed; DM icon emoji → SVG in ConversationList
2026-08-11 11:32:15 +08:00
2026-08-10
lezi-fun
b2368f68df
feat: toast notifications, canvas captcha, super admin, mobile fixes
...
- Toast system (ToastProvider + useToast): right-top colored toasts
replace alert for publish success/error; CSS + layout mount
- Captcha as canvas image (noise + distortion) in NewPost/ReplyList/
register modal — blocks bots, click to refresh
- Super admin: first registered user cannot be demoted (isFirstUser by
created_at, DB-agnostic)
- Admins can delete others' posts/replies (UI buttons shown for admin)
- Mobile: post-actions wrap + compact, feed excerpt 2.5 lines
- Fix: missing sun icon in Icons (dark mode toggle showed nothing)
- Feed long posts: gradient fade mask instead of line-clamp
2026-08-10 21:54:28 +08:00
lezi-fun
1a8a588d60
feat: markdown rendering + dark mode input fixes + DM icon align
...
- Add marked dependency; render post/reply content and signature via
marked.parse (matches upstream). lib/markdown.js helper + CSS for
code/pre/blockquote/tables in glass theme
- Fix hardcoded #e2e8f0 white inputs in dark mode: NewPost title/content,
Modals report select, ReplyList, AdminForumSettings/Links/Users/Logs
- DM button: replace ✉️ emoji with upstream SVG chat bubble icon
2026-08-10 18:18:19 +08:00
lezi-fun
4a30e79269
feat: edit post images (upload/remove) + fix captcha input in dark mode
...
- PostDetail edit modal: show existing images with delete button, upload
new images (multi-file, 5MB limit), save replaces image list
- API PUT /posts/:id accepts images array; omitting keeps original
- lib/api updatePost passes images
- NewPost/ReplyList captcha answer input: use CSS vars (was hardcoded
#e2e8f0 border with white bg — glaring in dark mode)
2026-08-10 17:41:46 +08:00
2026-08-09
lezi-fun
02ac24ba88
feat: port pagination and drag-drop upload from upstream
...
- GET /api/posts now supports page/limit, returns {data, pagination}
- Feed: pagination controls (‹ page numbers ›), reset to page 1 on sort change
- NewPost: dashed drop zone with click/drag-drop image upload, 5MB limit
- UserProfile adapts to paginated response
2026-08-09 21:14:18 +08:00
lezi-fun
70a198ae32
fix: restore original Feather icons across UI
...
- Add components/Icons.js with SVG paths extracted verbatim from the original index.html (14 unique icons)
- Restore icons on navbar menu, sidebar, feed actions, post/reply, modals, admin tabs and settings
- Replaces emoji placeholders from the initial migration
2026-08-09 18:12:46 +08:00
lezi-fun
281460fb03
feat: migrate to Next.js 14 (App Router + Route Handlers)
...
- Replace Express server with Next.js Route Handlers (16 API routes)
- Rewrite index.html SPA as React components (feed, post, admin, modals)
- Move style.css to app/globals.css with dark/light themes intact
- Add lib/db.js, lib/auth.js (JWT), lib/api.js (client API wrapper)
- Server binds 0.0.0.0 by default; host/port configurable via config.js
- Uploads served via /api/uploads route (rewrite keeps /uploads/ URLs)
- Multi-stage dockerfile using standalone output
2026-08-09 17:02:11 +08:00