Commit Graph
231 Commits
Author SHA1 Message Date

2026-08-11

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 f0867935ac fix: mobile narrow — post action buttons wrap to own row
@media (max-width:640px): .post-header flex-wrap; .post-detail-controls
full-width right-aligned row (no more icon/text split across lines).
2026-08-11 20:34:05 +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 2780dab8e2 feat: auto-promote earliest-registered user to super admin (idempotent)
users PK is UUID (no uid=1), so bootstrap super admin via semantics:
if no admin exists, promote the user with earliest created_at. Idempotent
(no-op when an admin already exists), safe on any existing database.
Matches the admin-list ordering (earliest user at the bottom).
2026-08-11 20:05:36 +08:00
Furrium Network 684d502deb Update README.md 2026-08-11 20:03:42 +08:00
Furrium Network 1fcea44c49 Update README.md 2026-08-11 20:02:25 +08:00
Furrium Network 07cf69b723 Update README.md 2026-08-11 20:01:41 +08:00
lezi-fun 4ff8488587 fix: settings page portrait layout — flex fill instead of fixed 70vh
Root becomes flex column (header fixed, layout flex:1); scroll
container uses flex:1 + minHeight:0 instead of fixed height:70vh so
portrait/phone screens get full remaining height instead of a short
squished panel.
2026-08-11 19:48:32 +08:00
lezi-fun 8e538fea80 chore: allowedDevOrigins reads ALLOWED_DEV_ORIGINS env (no hardcoded IPs)
Dev-only origin allowlist stays 127.0.0.1 by default; LAN devices can
be enabled per-machine via ALLOWED_DEV_ORIGINS=ip1,ip2 without touching
the repo.
2026-08-11 19:40:52 +08:00
lezi-fun dfe3556987 ci: revert to single multi-arch build job (simplest working version)
One build job pushes linux/amd64 + linux/arm64 together — buildx
creates the multi-arch :next manifest automatically. No manifest job,
no PAT, no repo filter. Node 24.
2026-08-11 19:27:22 +08:00
lezi-fun ab069c4b91 ci: fixed image name + PAT login (publish from upstream next to lezi-fun GHCR)
- IMAGE_NAME pinned to lezi-fun/forumlify-deploy (not github.repository)
- login uses secrets.GHCR_TOKEN (PAT with packages:write) so any repo
  (upstream Furrium/forumlify included) can publish to lezi-fun GHCR
- removed repo filter
2026-08-11 19:26:44 +08:00
lezi-fun 8cbde6dbc4 ci: only build GHCR image in forumlify-deploy repo (skip upstream)
Add job-level if: github.repository == 'lezi-fun/forumlify-deploy' so
pushes to Furrium/forumlify don't trigger broken builds (uppercase repo
name invalid for docker, and image would target wrong GHCR).
2026-08-11 19:22:35 +08:00
lezi-fun d074e27418 ci: fix manifest merge — newline in tags broke shell loop 2026-08-11 19:18:12 +08:00
lezi-fun f96d21ade7 ci: merge per-arch tags into multi-arch manifests (:next etc.)
Separate amd64/arm64 jobs push :next-amd64 / :next-arm64; add manifest
job that merges them into :next, :main, semver and sha tags so the
branch tag is a real multi-arch manifest (both platforms).
2026-08-11 19:13:46 +08:00
lezi-fun de69cd81a1 ci: drop Windows image (official node Windows base images removed)
node:24-windowsservercore* / nanoserver don't exist on Docker Hub (Node
stopped publishing Windows container images; even node:20 Windows tags
are gone). Keep linux/amd64 + linux/arm64 on node 24.
2026-08-11 19:09:27 +08:00
lezi-fun 1cfc61ff45 ci: node 24 + per-platform jobs (linux-amd64, linux-arm64, win64)
- Dockerfile/Dockerfile.windows: node 20 → 24
- 3 parallel jobs: linux/amd64, linux/arm64 (buildx, -arch tags),
  win64 (windows-latest native Windows containers, :next-windows)
- winarm64 dropped (no official Windows ARM64 node base image)
2026-08-11 19:05:48 +08:00
lezi-fun cc90c93673 ci: multi-arch images — linux/amd64 + linux/arm64 + windows/amd64
- Linux: build-push-action platforms linux/amd64,linux/arm64
- Windows: separate job on windows-latest (switch to Windows container
  engine, native docker build with Dockerfile.windows) → :next-windows
- Dockerfile.windows: node:20-windowsservercore-ltsc2022, bun install,
  standalone output
2026-08-11 18:59:22 +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 d265caa5bf ci: build & push Docker image to GHCR on push/tag
Trigger: push to next/main, semver tags, manual dispatch.
Tags: branch name, semver, git sha. Uses GHA cache.
2026-08-11 18:17:53 +08:00
lezi-fun d349660944 fix: remove stray merge conflict marker in schema.sql
Line '<<<<<<< HEAD' (no matching =======/>>>>>>>) broke postgres
init in Docker (db container exited 3 → all API 500). Remove it.
2026-08-11 18:06:45 +08:00
lezi 66047c0c4b Delete bun.lock 2026-08-11 18:03:28 +08:00
lezi-fun d304e7e863 fix: remove OpenNext dev hook from next.config (spawns workerd in build)
initOpenNextCloudflareForDev() runs when next.config.js loads → spawns
workerd binary (missing in Docker/node:20-alpine) → build crashes with
ENOENT. The hook is only for opennextjs-cloudflare preview (dev);
production build/deploy doesn't need it.
2026-08-11 18:00:03 +08:00
lezi-fun a53304cefa fix(docker): use bun install (npm reads stale lockfile → react 18) + .dockerignore
Docker build failed at npm run build: stale package-lock.json pins
react@18 while next@16 requires react@19. Switch builder to bun install
(bun.lock is current). Add .dockerignore (was shipping 700MB context).
2026-08-11 17:56:42 +08:00
lezi-fun dce94fd5af feat: auto-detect browser language (SSR Accept-Language + cookie)
- layout (server): derive language from cookie (user choice) > browser
  Accept-Language; set <html lang> accordingly
- I18nInit → I18nProvider: sync initI18n(lng) before children render
  (SSR/CSR first render same language, no hydration mismatch)
- setAppLanguage also writes cookie so SSR first paint uses chosen lang
- Verified: en browser → lang=en, zh → zh-CN, cookie overrides
2026-08-11 17:42:08 +08:00
lezi 08302dc0d7 Update LICENSE 2026-08-11 17:36:34 +08:00
lezi-fun 5a9a454ef3 fix: replies drawer auto-expand, settings no-scroll, title bug, admin links
- PostDetail: replies open as drawer (grid-rows animation) automatically
  after post loads — no toggle button
- SettingsPage: outer frame overflow hidden (100vh), only inner panel
  scrolls; hide #app layout when not on feed (fixes navbar moving when
  scrolling settings)
- Title: metadata 'Loading...' → 'Forumlify' (Next resets <title> to
  metadata on re-render → title became Loading... after load); unify
  title effect (rotate Loading. only while !ready && !forumNameLoaded)
- AdminLinks: link divider uses var(--border) (was #f1f5f9, invisible
  in dark mode); add admin.link i18n keys
- AdminPage i18n nav labels
2026-08-11 17:35:48 +08:00
lezi ad89aa3e04 Update README.md 2026-08-11 17:27:20 +08:00
lezi 77d4cc370a Update README.md 2026-08-11 17:26:37 +08:00
lezi-fun 7cdb7c1ac2 security: sync upstream XSS fix + moderation history (reports SET NULL)
- renderMarkdown: sanitize marked output with sanitize-html (allowed
  tags/attrs whitelist, http/https schemes only, strip on* attrs) —
  prevents stored XSS in posts/replies/signatures
- schema: reports.post_id ON DELETE CASCADE → SET NULL (keep moderation
  history when a reported post is deleted); migration applied to prod DB
2026-08-11 17:06:56 +08:00
lezi-fun 7cc1f0e228 fix: polish post transition details 2026-08-11 16:56:07 +08:00
lezi-fun cb89f1190c fix: stabilize markdown post transition 2026-08-11 15:58:39 +08:00
lezi-fun 0060034dec fix: morph post card content by element 2026-08-11 15:46:46 +08:00
lezi-fun ae2d5e82ca fix: smooth post title and card morph 2026-08-11 15:32:26 +08:00
lezi-fun 608e6b2522 Merge remote-tracking branch 'origin/next' into next
# Conflicts:
#	app/HomeClient.js
#	app/globals.css
#	components/AccountSecurity.js
#	components/AppProvider.js
#	components/Feed.js
#	components/Modals.js
#	components/Navbar.js
#	components/NewPost.js
#	components/PostDetail.js
#	components/RecoveryCodes.js
#	components/ReplyList.js
#	components/SettingsPage.js
#	components/SettingsProfile.js
#	components/Toast.js
#	components/admin/AdminCustomCss.js
#	components/admin/AdminCustomPages.js
#	components/admin/AdminForumSettings.js
#	components/admin/AdminLinks.js
#	components/admin/AdminLogs.js
#	components/admin/AdminReports.js
#	components/admin/AdminUsers.js
#	components/chat/ConversationList.js
#	locales/en.json
#	locales/zh.json
2026-08-11 15:27:27 +08:00
lezi-fun 6947cdaf36 fix: polish forum navigation and interface states 2026-08-11 15:25:05 +08:00
lezi-fun b60aff7c25 fix: restore dark post view and API revalidation 2026-08-11 13:34:44 +08:00
lezi-fun 0933220c70 fix: restore dark post view and API revalidation 2026-08-11 13:32:44 +08:00
lezi 773db0dec7 Update README.md 2026-08-11 12:25:27 +08:00
lezi-fun ef9d8b8f9c fix: Next 16 cookies() is async — await it in Home (page rendering error
cookies().get() without await threw in Next 16 (sync dynamic API
removed), breaking the whole Home SSR render → layout broken, spinner
restart, flash. Await cookies() before reading forumlify-name.
Also raise glass-bg opacity (0.18→0.62 light / 0.35→0.60 dark) so
cards/navbar/modal aren't see-through.
2026-08-11 11:43:27 +08:00
lezi-fun 5c554f27ea fix: Next 16 cookies() is async — await it in Home (page rendering error
cookies().get() without await threw in Next 16 (sync dynamic API
removed), breaking the whole Home SSR render → layout broken, spinner
restart, flash. Await cookies() before reading forumlify-name.
Also raise glass-bg opacity (0.18→0.62 light / 0.35→0.60 dark) so
cards/navbar/modal aren't see-through.
2026-08-11 11:43:10 +08:00
lezi-fun 78ef6cd798 fix: desktop layout — use #app flex container (was .app-container with no CSS)
HomeClient rendered className='app-container' but globals.css only
defines #app (flex) — sidebar/feed fell back to block layout, feed
pushed below. Switch to id='app' to match upstream stylesheet.
Also: AdminPage i18n (nav labels + title).
2026-08-11 11:38:18 +08:00
lezi-fun 72e93ca5bb fix: desktop layout — use #app flex container (was .app-container with no CSS)
HomeClient rendered className='app-container' but globals.css only
defines #app (flex) — sidebar/feed fell back to block layout, feed
pushed below. Switch to id='app' to match upstream stylesheet.
Also: AdminPage i18n (nav labels + title).
2026-08-11 11:38:10 +08:00
lezi-fun 1934edebd5 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

# Conflicts:
#	components/AppProvider.js
#	components/NewPost.js
2026-08-11 11:33:57 +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
lezi-fun 024b678ad3 fix: hydration mismatch (loading spinner restart) + cache strategy
Root cause of loading spinner restarting / name appearing twice:
React hydration mismatch → whole tree regenerated. Fixed all sources:
- AppProvider: remove typeof window in useState init (SSR/client diff);
  read cached forum name in useEffect instead
- ToastProvider: remove createPortal(document.body) (SSR absent →
  mismatch)
- LoadingScreen: name container uses dangerouslySetInnerHTML('') so
  React never manages/clobbers the inline-script-filled text
- layout.js: inline script moved to body first child (React official
  anti-FOUC pattern)

Cache: dynamic pages/API no-cache + ETag (304 on revalidate); static
/_next/static assets immutable 1y. Verified: 304 + immutable headers.
2026-08-11 10:52:33 +08:00
lezi-fun 82bc2eb885 fix: hydration mismatch (loading spinner restart) + cache strategy
Root cause of loading spinner restarting / name appearing twice:
React hydration mismatch → whole tree regenerated. Fixed all sources:
- AppProvider: remove typeof window in useState init (SSR/client diff);
  read cached forum name in useEffect instead
- ToastProvider: remove createPortal(document.body) (SSR absent →
  mismatch)
- LoadingScreen: name container uses dangerouslySetInnerHTML('') so
  React never manages/clobbers the inline-script-filled text
- layout.js: inline script moved to body first child (React official
  anti-FOUC pattern)

Cache: dynamic pages/API no-cache + ETag (304 on revalidate); static
/_next/static assets immutable 1y. Verified: 304 + immutable headers.
2026-08-11 10:52:21 +08:00
lezi-fun 517661441a fix: long post fade uses mask (text fades out, no white block)
Replace background gradient overlay with mask-image so the text itself
fades to transparent toward the bottom; no solid edge color visible.
2026-08-11 10:30:44 +08:00
lezi-fun b5fafdbc09 fix: long post fade uses mask (text fades out, no white block)
Replace background gradient overlay with mask-image so the text itself
fades to transparent toward the bottom; no solid edge color visible.
2026-08-11 10:30:34 +08:00
lezi-fun c4ec3340de fix: loading title double-render + spinner restart (hydration)
Inline script fills cached name into #loadingTitle before React
hydrate; React then saw text mismatch and rewrote the DOM, making the
name appear twice and restarting the spinner animation. Add
suppressHydrationWarning so React keeps the script-filled content.
2026-08-11 10:25:33 +08:00
lezi-fun 91ab1c6239 fix: loading title double-render + spinner restart (hydration)
Inline script fills cached name into #loadingTitle before React
hydrate; React then saw text mismatch and rewrote the DOM, making the
name appear twice and restarting the spinner animation. Add
suppressHydrationWarning so React keeps the script-filled content.
2026-08-11 10:25:24 +08:00