Commit Graph
8 Commits
Author SHA1 Message Date

2026-08-11

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 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 0933220c70 fix: restore dark post view and API revalidation 2026-08-11 13:32:44 +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 962f7f67c1 feat: Cloudflare Workers deployment (OpenNext adapter)
- Add @opennextjs/cloudflare + wrangler config, open-next.config.ts,
  public/_headers, .dev.vars.example template
- package.json: cf build/preview/deploy/upload scripts
- Verified deployed: https://forumlify.roylikerebecca19930.workers.dev
  (DB read/write via outbound TCP to Postgres, R2 image upload + public
  domain access all working)
2026-08-11 09:18:29 +08:00

2026-08-10

lezi-fun 1486d95f89 fix: no-cache HTML headers (dynamic forum content)
Next.js default s-maxage=31536000 caches HTML for a year at CDN level,
serving stale pages after deploys. Add Cache-Control: no-store for all
routes so CDN/browser always fetch fresh.
2026-08-10 10:15:16 +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

2026-08-09

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