feat: custom JWT auth + i18n with Chinese default

Replace Clerk with self-contained JWT auth (bcryptjs + jose), remove all
external auth dependencies. Add full i18n system with Chinese as default
language and English toggle — React Context + JSON dictionaries, no
external i18n library.

Auth:
- Add passwordHash to User model, generate JWT secret
- Create /api/auth/register, login, logout, me endpoints
- Rewrite proxy.ts middleware for custom session validation
- Add AuthProvider + useAuth hook, sign-in/sign-up pages
- Wire auth into layout and all API routes

i18n:
- React Context I18nProvider with localStorage + cookie persistence
- dictionaries/zh.ts (default) and dictionaries/en.ts
- LanguageSwitcher component, server-side createServerT() utility
- CJK font stack via [lang="zh"] CSS selector
- HTML lang attribute synced on language change
- All pages, components, TabBar, StageBadge translated
- Engine fallback strings (reflection-analyzer, summary-generator)
- API routes pass locale from cookie to engines

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jackyu66git
2026-05-20 22:47:14 +08:00
co-authored by Claude Opus 4.6
parent 4e83ce95cd
commit 00db3f6c96
43 changed files with 1647 additions and 300 deletions
+6 -1
View File
@@ -9,9 +9,13 @@
"lint": "eslint"
},
"dependencies": {
"@clerk/nextjs": "^7.3.7",
"@prisma/adapter-better-sqlite3": "^7.8.0",
"@prisma/adapter-pg": "^7.8.0",
"@prisma/client": "^7.8.0",
"bcryptjs": "^3.0.3",
"better-sqlite3": "^12.10.0",
"jose": "^6.2.3",
"next": "16.2.6",
"openai": "^6.38.0",
"react": "19.2.4",
@@ -19,6 +23,7 @@
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/bcryptjs": "^3.0.0",
"@types/node": "^20.19.41",
"@types/react": "^19",
"@types/react-dom": "^19",