Commit Graph
28 Commits
Author SHA1 Message Date

2026-08-13

lezi-fun 84c9e97451 feat: add path navigation and shared settings transitions 2026-08-13 12:29:09 +08:00

2026-08-12

lezi-fun 96e0e6f08e fix: prevent super admin demotion 2026-08-12 20:12:22 +08:00
lezi-fun 3840bb3c54 fix: support replies on legacy databases 2026-08-12 20:05:29 +08:00
lezi-fun b9d6ca5da8 security: server-owned audit logs + fullscreen custom pages
Port upstream PR #22 + Lite style updates:
- lib/audit.js: server-side logAudit(req, action, userId), records
  IP from x-forwarded-for / cf-connecting-ip
- login/register/create_post/create_reply record server-side
- Remove client logEvent calls (AppProvider/NewPost/ReplyList)
- Remove forgeable POST /api/event-logs endpoint
- CustomPage: fullscreen immersive (fixed, 100vh-nav, mobile 56px
  nav offset) matching upstream Lite
2026-08-12 09:06:50 +08:00

2026-08-11

lezi-fun 6c100ff3a1 fix: reply chain uses reply_to_id (UUID) instead of reply_to_username
- reply_to_id UUID FK: precise parent tracking (username was ambiguous
  when same user wrote multiple replies in a chain)
- GET /api/replies: JOIN replies + users to return reply_to_username
- POST /api/replies: accept reply_to_id (UUID) instead of reply_to_username
- Frontend depth calc: follow reply_to_id chain (not username)
- Preview bar: resolve username from local replies by ID
- Indicator scroll: target by data-reply-id
2026-08-11 21:38:45 +08:00
lezi-fun 4d0d5edec3 feat: Discourse-style reply-to indicator (↩ @username)
- replies table: add reply_to_username column
- POST /api/replies: accept reply_to_username param
- GET /api/replies: LEFT JOIN users to return reply_to_username
- ReplyList: submit replyTo as reply_to_username on create
- UI: each reply shows '↩ 正在回复 @username' indicator (clickable,
  scrolls to target reply)
- data-username attribute on .reply-item for scroll targeting
2026-08-11 21:18:18 +08:00
lezi-fun d757bde780 feat: super admin badge — earliest admin shows 超级管理员 in user list
- /api/users: mark is_super for the earliest-registered admin (matches
  the auto-promotion migration semantics)
- AdminUsers: render 超级管理员 badge for is_super, 管理员 otherwise
- i18n keys admin.user.roleSuper (zh/en)
- Mobile settings nav: active tab gets top-left/top-right rounded
  corners only (desktop unchanged)
2026-08-11 20:40:02 +08:00
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 7c6b816ac7 fix: pinned posts not sorted to top + compose pulls GHCR image
- posts API: ORDER BY is_pinned DESC, pinned_at DESC NULLS LAST before
  sort (matches upstream) — pinned posts now appear first
- docker-compose: app service pulls ghcr.io/lezi-fun/forumlify-deploy:next
  instead of local build (auto-rebuilt on push)
2026-08-11 18:55:10 +08:00
lezi-fun ae2d5e82ca fix: smooth post title and card morph 2026-08-11 15:32:26 +08:00
lezi-fun 6947cdaf36 fix: polish forum navigation and interface states 2026-08-11 15:25:05 +08:00
lezi-fun 0933220c70 fix: restore dark post view and API revalidation 2026-08-11 13:32:44 +08:00
lezi-fun 0b86c54867 feat: public user profile API + settings swipe navigation
- GET /api/users/profile/:username public endpoint (no auth) for user
  pages, matching upstream main; UserProfile uses it (was admin /users
  search)
- Settings page: vertical scroll-snap panels (profile/security/recovery),
  swipe up/down to switch smoothly; sidebar nav scrolls to panel and
  active highlight follows scroll position
2026-08-11 10:07:21 +08:00
lezi-fun 6d41c6208c feat: upgrade Next.js 16 + React 19, R2 binding storage, adaptive build
- Next.js 14 → 16.3.0, React 18 → 19.2.8
- Route handlers: async params (await params) for Next 15+ — 17 files
- Fix destructuring params pattern (const {id} = await params) in
  users/[id] and users/[id]/role
- storage.js: prefer Cloudflare R2 binding (FORUMLIFY_BUCKET, no S3
  keys) on Workers; fallback S3-compatible API (Vercel/local)
- wrangler.jsonc: add FORUMLIFY_BUCKET binding to forum bucket
- scripts/build.js: adaptive build (CF env → OpenNext, else next build);
  fix recursion via NEXT_PRIVATE_STANDALONE detection
- 40/40 tests pass on Next 16
2026-08-11 09:45:56 +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 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
lezi-fun 34c06c206c fix: loading page logo/name flash, settings name flash, post card radius
- LoadingScreen: remove 🌊 logo; show forum name only after server
  responds (fades in place), delayed 650ms before switching to home
- AppProvider: new forumNameLoaded flag; title rotation already handled
- settings API: always returns forum_name (inserts default if missing)
- AdminForumSettings: name input starts empty, fills after fetch
- PostDetail: add id=pagePost so #pagePost .post-detail-card styles
  apply (border-radius/shadow were missing)
2026-08-10 17:05:23 +08:00
lezi-fun 581925ad7d feat: user signature (设置页编辑 + 帖子底部显示)
- schema: users.signature column (upstream aligned)
- API: posts query JOIN signature, /auth/me returns signature, PUT /users/:id updates signature
- Settings: signature textarea (Markdown hint), saved with profile
- PostDetail: signature shown under post content with divider
- README: remove upstream DB schema note (fixed upstream)
2026-08-10 14:45:50 +08:00
lezi-fun c171efc1ec fix: dropdown menu not opening on avatar click
React synthetic event stopPropagation doesn't stop native document
listeners (React 17+ attaches to root, document listener is separate).
The document click handler was closing the menu right after avatar
opened it. Now it checks if the click target is inside the dropdown
or on the avatar and skips closing.
2026-08-10 14:38:30 +08:00
lezi-fun 4ee38f6486 feat: align with upstream — pin posts, edit marker, custom CSS, UX fixes
- Pin/unpin posts (PUT /api/posts/:id/pin, admin) with notification to author
- is_pinned/pinned_at in schema; 📌 badge on feed + detail; admin pin button
- Edited marker (已编辑) on feed + detail; edit button + modal for authors
- Custom CSS: upload/delete API + admin tab + global loader (style.css override)
- Fix: duplicate post title on detail page (remove card title, keep header)
- Fix: forum name flicker on load (localStorage cache before fetch)
- Fix: dropdown menu closes on outside click (document listener)
- Fix: document.title + <title> sync on forum rename
2026-08-10 12:32:06 +08:00
lezi-fun 7ce81969ac fix: 405 on write methods in Vercel (static GET optimization)
Route handlers with both GET and write methods get the GET statically
optimized on Vercel, which 405s POST/PUT/DELETE. Add
export const dynamic = 'force-dynamic' to all 7 affected routes
(settings, posts, custom-pages, event-logs, links, conversations, reports).
2026-08-10 11:02:11 +08:00
lezi-fun d1c06741f6 fix: uploads route ignored by .gitignore, image 404s
.gitignore 'uploads/' pattern matched app/api/uploads/ too, so the
image-serving route handler was never committed. Anchor it to /uploads/
so only the runtime storage dir is ignored. Also add vercel.json.
2026-08-10 10:45:25 +08:00
lezi-fun ec50efea89 feat: support serverless deployment (Vercel / Cloudflare Pages)
- Replace bcrypt (native) with bcryptjs (pure JS) — no native build on serverless
- Storage abstraction (lib/storage.js): local uploads/ for traditional deploy, S3-compatible (R2/MinIO/S3 via aws4fetch) for serverless
- DB pool auto-adapts to serverless (single connection, rotation, timeouts)
- next.config.js: standalone output only when DOCKER=1 (serverless skips it)
- Docs: serverless deployment section in README, S3 env vars in .env.example
2026-08-10 09:55:18 +08:00
lezi-fun 4732e7d61d feat: port upstream custom pages, notifications, recovery codes, account security
- schema: custom_pages, notifications, recovery_codes tables + UNIQUE(conversations) + posts.edited_at
- API: custom-pages CRUD (public + admin), notifications (list/read/read-all), recovery-codes (generate/count/reset-password), user avatar/password/email, post edit
- UI: custom page nav links + iframe rendering, admin custom pages tab with editor modal, messages page shows notifications, settings page gains avatar upload, password/email change, recovery codes manager
- Sync globals.css with upstream rewrite
2026-08-10 09:07:06 +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 300ad5959c feat: port private messaging (私信) from upstream
- Add conversations/messages tables to schema.sql (upstream missed them)
- API: GET/POST /api/conversations, GET/POST /api/conversations/[id]/messages, PUT /api/messages/[id]/read
- Chat UI: conversation list modal, chat window with 3s polling, unread badge
- Navbar message entry opens DM list; user profile has 发私信 button
- Access control: only conversation participants (403 otherwise)
2026-08-09 21:01:55 +08:00
lezi-fun 5ef8d4b1ff feat: port user profile feature from upstream
- GET /api/users?username= filter (admin)
- GET /api/posts?user_id= filter
- Add UserProfile page (profile card + user's posts), reachable via ?user=<username>
- Clickable usernames on feed, post detail, replies
2026-08-09 18:30:49 +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