@lobehub/lobehub 2.0.0-next.123 → 2.0.0-next.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/db-migrations.mdc +16 -1
- package/.cursor/rules/project-introduce.mdc +1 -1
- package/.cursor/rules/project-structure.mdc +20 -2
- package/.env.example +148 -65
- package/.env.example.development +6 -8
- package/AGENTS.md +1 -3
- package/CHANGELOG.md +51 -0
- package/Dockerfile +6 -6
- package/GEMINI.md +63 -0
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/changelog/v1.json +18 -0
- package/docs/development/database-schema.dbml +38 -0
- package/docs/self-hosting/advanced/auth.mdx +75 -2
- package/docs/self-hosting/advanced/auth.zh-CN.mdx +75 -2
- package/docs/self-hosting/environment-variables/auth.mdx +187 -1
- package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +187 -1
- package/locales/en-US/auth.json +93 -0
- package/locales/zh-CN/auth.json +107 -1
- package/package.json +5 -2
- package/packages/const/src/auth.ts +2 -1
- package/packages/database/migrations/0048_add_editor_data.sql +1 -0
- package/packages/database/migrations/0049_better_auth.sql +49 -0
- package/packages/database/migrations/meta/0048_snapshot.json +7913 -0
- package/packages/database/migrations/meta/0049_snapshot.json +8151 -0
- package/packages/database/migrations/meta/_journal.json +14 -0
- package/packages/database/src/core/migrations.json +19 -0
- package/packages/database/src/index.ts +1 -0
- package/packages/database/src/models/__tests__/session.test.ts +1 -2
- package/packages/database/src/models/user.ts +9 -8
- package/packages/database/src/repositories/tableViewer/index.test.ts +2 -2
- package/packages/database/src/schemas/agent.ts +1 -0
- package/packages/database/src/schemas/betterAuth.ts +63 -0
- package/packages/database/src/schemas/index.ts +1 -0
- package/packages/database/src/schemas/ragEvals.ts +1 -2
- package/packages/database/src/schemas/user.ts +3 -2
- package/packages/database/src/server/models/__tests__/user.test.ts +1 -4
- package/packages/types/src/user/preference.ts +11 -0
- package/packages/utils/src/server/__tests__/auth.test.ts +52 -0
- package/packages/utils/src/server/auth.ts +18 -1
- package/src/app/(backend)/api/auth/[...all]/route.ts +19 -0
- package/src/app/(backend)/api/auth/check-user/route.ts +62 -0
- package/src/app/(backend)/middleware/auth/index.ts +14 -0
- package/src/app/(backend)/middleware/auth/utils.test.ts +16 -0
- package/src/app/(backend)/middleware/auth/utils.ts +13 -10
- package/src/app/(backend)/webapi/chat/[provider]/route.test.ts +1 -0
- package/src/app/[variants]/(auth)/reset-password/layout.tsx +12 -0
- package/src/app/[variants]/(auth)/reset-password/page.tsx +209 -0
- package/src/app/[variants]/(auth)/signin/layout.tsx +12 -0
- package/src/app/[variants]/(auth)/signin/page.tsx +448 -0
- package/src/app/[variants]/(auth)/signup/[[...signup]]/BetterAuthSignUpForm.tsx +192 -0
- package/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +31 -6
- package/src/app/[variants]/(auth)/verify-email/layout.tsx +12 -0
- package/src/app/[variants]/(auth)/verify-email/page.tsx +164 -0
- package/src/app/[variants]/(main)/(mobile)/me/(home)/__tests__/UserBanner.test.tsx +12 -10
- package/src/app/[variants]/(main)/(mobile)/me/(home)/__tests__/useCategory.test.tsx +13 -11
- package/src/app/[variants]/(main)/chat/components/topic/features/Topic/TopicListContent/TopicItem/TopicContent.tsx +15 -8
- package/src/app/[variants]/(main)/chat/components/topic/features/Topic/TopicListContent/TopicItem/index.tsx +27 -30
- package/src/app/[variants]/(main)/profile/(home)/Client.tsx +306 -52
- package/src/app/[variants]/(main)/profile/(home)/features/SSOProvidersList/index.tsx +89 -47
- package/src/auth.ts +118 -0
- package/src/components/NextAuth/AuthIcons.tsx +3 -1
- package/src/envs/auth.ts +260 -13
- package/src/envs/email.ts +37 -0
- package/src/features/AgentSetting/AgentPlugin/index.tsx +6 -2
- package/src/features/User/UserPanel/PanelContent.tsx +6 -5
- package/src/features/User/__tests__/PanelContent.test.tsx +15 -6
- package/src/features/User/__tests__/UserAvatar.test.tsx +17 -6
- package/src/features/User/__tests__/useMenu.test.tsx +14 -12
- package/src/layout/AuthProvider/BetterAuth/UserUpdater.tsx +51 -0
- package/src/layout/AuthProvider/BetterAuth/index.tsx +14 -0
- package/src/layout/AuthProvider/index.tsx +3 -0
- package/src/layout/GlobalProvider/StoreInitialization.tsx +3 -3
- package/src/libs/better-auth/auth-client.ts +34 -0
- package/src/libs/better-auth/constants.ts +13 -0
- package/src/libs/better-auth/email-templates/index.ts +3 -0
- package/src/libs/better-auth/email-templates/magic-link.ts +98 -0
- package/src/libs/better-auth/email-templates/reset-password.ts +91 -0
- package/src/libs/better-auth/email-templates/verification.ts +108 -0
- package/src/libs/better-auth/sso/helpers.ts +61 -0
- package/src/libs/better-auth/sso/index.ts +113 -0
- package/src/libs/better-auth/sso/providers/auth0.ts +33 -0
- package/src/libs/better-auth/sso/providers/authelia.ts +35 -0
- package/src/libs/better-auth/sso/providers/authentik.ts +35 -0
- package/src/libs/better-auth/sso/providers/casdoor.ts +48 -0
- package/src/libs/better-auth/sso/providers/cloudflare-zero-trust.ts +41 -0
- package/src/libs/better-auth/sso/providers/cognito.ts +45 -0
- package/src/libs/better-auth/sso/providers/feishu.ts +181 -0
- package/src/libs/better-auth/sso/providers/generic-oidc.ts +44 -0
- package/src/libs/better-auth/sso/providers/github.ts +30 -0
- package/src/libs/better-auth/sso/providers/google.ts +30 -0
- package/src/libs/better-auth/sso/providers/keycloak.ts +35 -0
- package/src/libs/better-auth/sso/providers/logto.ts +38 -0
- package/src/libs/better-auth/sso/providers/microsoft.ts +65 -0
- package/src/libs/better-auth/sso/providers/okta.ts +37 -0
- package/src/libs/better-auth/sso/providers/wechat.ts +140 -0
- package/src/libs/better-auth/sso/providers/zitadel.ts +54 -0
- package/src/libs/better-auth/sso/types.ts +25 -0
- package/src/libs/better-auth/utils/client.ts +1 -0
- package/src/libs/better-auth/utils/common.ts +20 -0
- package/src/libs/better-auth/utils/server.test.ts +61 -0
- package/src/libs/better-auth/utils/server.ts +18 -0
- package/src/libs/trpc/lambda/context.test.ts +116 -0
- package/src/libs/trpc/lambda/context.ts +27 -0
- package/src/libs/trpc/middleware/userAuth.ts +4 -2
- package/src/locales/default/auth.ts +114 -1
- package/src/proxy.ts +71 -7
- package/src/server/globalConfig/index.ts +12 -1
- package/src/server/routers/lambda/user.ts +4 -0
- package/src/server/services/email/README.md +241 -0
- package/src/server/services/email/impls/index.test.ts +39 -0
- package/src/server/services/email/impls/index.ts +32 -0
- package/src/server/services/email/impls/nodemailer/index.ts +108 -0
- package/src/server/services/email/impls/nodemailer/type.ts +31 -0
- package/src/server/services/email/impls/type.ts +61 -0
- package/src/server/services/email/index.test.ts +144 -0
- package/src/server/services/email/index.ts +40 -0
- package/src/services/user/index.test.ts +162 -2
- package/src/services/user/index.ts +6 -3
- package/src/store/aiInfra/slices/aiProvider/action.ts +4 -4
- package/src/store/user/slices/auth/action.test.ts +213 -16
- package/src/store/user/slices/auth/action.ts +86 -1
- package/src/store/user/slices/auth/initialState.ts +13 -2
- package/src/store/user/slices/auth/selectors.ts +6 -2
- package/src/store/user/slices/common/action.ts +5 -1
- package/src/app/(backend)/api/auth/[...nextauth]/route.ts +0 -3
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LobeChat 身份验证服务设置
|
|
3
|
-
description: 了解如何配置 LobeChat
|
|
3
|
+
description: 了解如何配置 LobeChat 的身份验证服务环境变量,包括 Better Auth、OAuth SSO、NextAuth 设置等。
|
|
4
4
|
tags:
|
|
5
5
|
- LobeChat
|
|
6
6
|
- 身份验证服务
|
|
7
|
+
- Better Auth
|
|
7
8
|
- 单点登录
|
|
8
9
|
- Next Auth
|
|
9
10
|
- Clerk
|
|
@@ -13,6 +14,191 @@ tags:
|
|
|
13
14
|
|
|
14
15
|
LobeChat 在部署时提供了完善的身份验证服务能力,以下是相关的环境变量,你可以使用这些环境变量轻松定义需要在 LobeChat 中开启的身份验证服务。
|
|
15
16
|
|
|
17
|
+
## Better Auth
|
|
18
|
+
|
|
19
|
+
### 通用设置
|
|
20
|
+
|
|
21
|
+
#### `NEXT_PUBLIC_ENABLE_BETTER_AUTH`
|
|
22
|
+
|
|
23
|
+
- 类型:必选
|
|
24
|
+
- 描述:设置为 `1` 以启用 Better Auth 服务。启用后,将使用 Better Auth 进行身份验证,而非 Next Auth 或 Clerk。
|
|
25
|
+
- 默认值:`-`
|
|
26
|
+
- 示例:`1`
|
|
27
|
+
|
|
28
|
+
#### `AUTH_SECRET`
|
|
29
|
+
|
|
30
|
+
- 类型:必选
|
|
31
|
+
- 描述:用于加密会话令牌的密钥,Better Auth 和 Next Auth 共享。使用以下命令生成:`openssl rand -base64 32`
|
|
32
|
+
- 默认值:`-`
|
|
33
|
+
- 示例:`Tfhi2t2pelSMEA8eaV61KaqPNEndFFdMIxDaJnS1CUI=`
|
|
34
|
+
|
|
35
|
+
#### `NEXT_PUBLIC_AUTH_URL`
|
|
36
|
+
|
|
37
|
+
- 类型:可选
|
|
38
|
+
- 描述:浏览器可访问的 Better Auth 回调 URL。仅在默认生成的 URL 不正确时设置。
|
|
39
|
+
- 默认值:`-`
|
|
40
|
+
- 示例:`https://example.com`
|
|
41
|
+
|
|
42
|
+
#### `NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION`
|
|
43
|
+
|
|
44
|
+
- 类型:可选
|
|
45
|
+
- 描述:设置为 `1` 以要求用户在登录前验证邮箱。用户注册后必须验证邮箱地址。
|
|
46
|
+
- 默认值:`0`
|
|
47
|
+
- 示例:`1`
|
|
48
|
+
|
|
49
|
+
#### `AUTH_SSO_PROVIDERS`
|
|
50
|
+
|
|
51
|
+
- 类型:可选
|
|
52
|
+
- 描述:启用的 SSO 提供商列表,以逗号分隔。顺序决定了登录页面上提供商的显示顺序。
|
|
53
|
+
- 默认值:`-`
|
|
54
|
+
- 示例:`google,github,microsoft,cognito`
|
|
55
|
+
|
|
56
|
+
### 邮件服务(SMTP)
|
|
57
|
+
|
|
58
|
+
启用邮箱验证和密码重置功能需要配置以下设置。
|
|
59
|
+
|
|
60
|
+
#### `SMTP_HOST`
|
|
61
|
+
|
|
62
|
+
- 类型:必选(用于邮件功能)
|
|
63
|
+
- 描述:SMTP 服务器主机名。
|
|
64
|
+
- 默认值:`-`
|
|
65
|
+
- 示例:`smtp.gmail.com`
|
|
66
|
+
|
|
67
|
+
#### `SMTP_PORT`
|
|
68
|
+
|
|
69
|
+
- 类型:必选(用于邮件功能)
|
|
70
|
+
- 描述:SMTP 服务器端口。TLS 通常为 `587`,SSL 为 `465`。
|
|
71
|
+
- 默认值:`-`
|
|
72
|
+
- 示例:`587`
|
|
73
|
+
|
|
74
|
+
#### `SMTP_SECURE`
|
|
75
|
+
|
|
76
|
+
- 类型:可选
|
|
77
|
+
- 描述:是否使用安全连接。端口 465(SSL)设置为 `true`,端口 587(TLS)设置为 `false`。
|
|
78
|
+
- 默认值:`false`
|
|
79
|
+
- 示例:`false`
|
|
80
|
+
|
|
81
|
+
#### `SMTP_USER`
|
|
82
|
+
|
|
83
|
+
- 类型:必选(用于邮件功能)
|
|
84
|
+
- 描述:SMTP 认证用户名,通常是您的邮箱地址。
|
|
85
|
+
- 默认值:`-`
|
|
86
|
+
- 示例:`your-email@example.com`
|
|
87
|
+
|
|
88
|
+
#### `SMTP_PASS`
|
|
89
|
+
|
|
90
|
+
- 类型:必选(用于邮件功能)
|
|
91
|
+
- 描述:SMTP 认证密码。Gmail 需使用应用专用密码。
|
|
92
|
+
- 默认值:`-`
|
|
93
|
+
- 示例:`your-app-specific-password`
|
|
94
|
+
|
|
95
|
+
### Google
|
|
96
|
+
|
|
97
|
+
#### `AUTH_GOOGLE_ID`
|
|
98
|
+
|
|
99
|
+
- 类型:必选
|
|
100
|
+
- 描述:Google OAuth 应用的 Client ID。在 [Google Cloud Console](https://console.cloud.google.com/apis/credentials) 获取。
|
|
101
|
+
- 默认值:`-`
|
|
102
|
+
- 示例:`123456789.apps.googleusercontent.com`
|
|
103
|
+
|
|
104
|
+
#### `AUTH_GOOGLE_SECRET`
|
|
105
|
+
|
|
106
|
+
- 类型:必选
|
|
107
|
+
- 描述:Google OAuth 应用的 Client Secret。
|
|
108
|
+
- 默认值:`-`
|
|
109
|
+
- 示例:`GOCSPX-xxxxxxxxxxxxxxxxxxxx`
|
|
110
|
+
|
|
111
|
+
### GitHub
|
|
112
|
+
|
|
113
|
+
#### `AUTH_GITHUB_ID`
|
|
114
|
+
|
|
115
|
+
- 类型:必选
|
|
116
|
+
- 描述:GitHub OAuth 应用的 Client ID。在 [GitHub Developer Settings](https://github.com/settings/developers) 获取。
|
|
117
|
+
- 默认值:`-`
|
|
118
|
+
- 示例:`Ov23xxxxxxxxxxxxx`
|
|
119
|
+
|
|
120
|
+
#### `AUTH_GITHUB_SECRET`
|
|
121
|
+
|
|
122
|
+
- 类型:必选
|
|
123
|
+
- 描述:GitHub OAuth 应用的 Client Secret。
|
|
124
|
+
- 默认值:`-`
|
|
125
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
126
|
+
|
|
127
|
+
### Microsoft
|
|
128
|
+
|
|
129
|
+
#### `AUTH_MICROSOFT_ID`
|
|
130
|
+
|
|
131
|
+
- 类型:必选
|
|
132
|
+
- 描述:Microsoft Entra ID(Azure AD)应用的 Client ID。在 [Azure 门户](https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade) 获取。
|
|
133
|
+
- 默认值:`-`
|
|
134
|
+
- 示例:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
|
|
135
|
+
|
|
136
|
+
#### `AUTH_MICROSOFT_SECRET`
|
|
137
|
+
|
|
138
|
+
- 类型:必选
|
|
139
|
+
- 描述:Microsoft Entra ID 应用的 Client Secret。
|
|
140
|
+
- 默认值:`-`
|
|
141
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
142
|
+
|
|
143
|
+
### AWS Cognito
|
|
144
|
+
|
|
145
|
+
#### `AUTH_COGNITO_ID`
|
|
146
|
+
|
|
147
|
+
- 类型:必选
|
|
148
|
+
- 描述:AWS Cognito 用户池应用客户端的 Client ID。在 [AWS Cognito 控制台](https://console.aws.amazon.com/cognito) 获取。
|
|
149
|
+
- 默认值:`-`
|
|
150
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxx`
|
|
151
|
+
|
|
152
|
+
#### `AUTH_COGNITO_SECRET`
|
|
153
|
+
|
|
154
|
+
- 类型:必选
|
|
155
|
+
- 描述:AWS Cognito 应用客户端的 Client Secret。
|
|
156
|
+
- 默认值:`-`
|
|
157
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
158
|
+
|
|
159
|
+
#### `AUTH_COGNITO_ISSUER`
|
|
160
|
+
|
|
161
|
+
- 类型:必选
|
|
162
|
+
- 描述:Cognito 用户池的颁发者 URL。格式:`https://cognito-idp.{region}.amazonaws.com/{userPoolId}`
|
|
163
|
+
- 默认值:`-`
|
|
164
|
+
- 示例:`https://cognito-idp.us-east-1.amazonaws.com/us-east-1_xxxxxxxxx`
|
|
165
|
+
|
|
166
|
+
### 飞书
|
|
167
|
+
|
|
168
|
+
#### `AUTH_FEISHU_APP_ID`
|
|
169
|
+
|
|
170
|
+
- 类型:必选
|
|
171
|
+
- 描述:飞书应用的 App ID。在 [飞书开放平台](https://open.feishu.cn/app) 获取。
|
|
172
|
+
- 默认值:`-`
|
|
173
|
+
- 示例:`cli_xxxxxxxxxxxxxxxx`
|
|
174
|
+
|
|
175
|
+
#### `AUTH_FEISHU_APP_SECRET`
|
|
176
|
+
|
|
177
|
+
- 类型:必选
|
|
178
|
+
- 描述:飞书应用的 App Secret。
|
|
179
|
+
- 默认值:`-`
|
|
180
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
181
|
+
|
|
182
|
+
### 微信
|
|
183
|
+
|
|
184
|
+
#### `AUTH_WECHAT_ID`
|
|
185
|
+
|
|
186
|
+
- 类型:必选
|
|
187
|
+
- 描述:微信开放平台应用的 App ID。在 [微信开放平台](https://open.weixin.qq.com/) 获取。
|
|
188
|
+
- 默认值:`-`
|
|
189
|
+
- 示例:`wxxxxxxxxxxxxxxxxxxx`
|
|
190
|
+
|
|
191
|
+
#### `AUTH_WECHAT_SECRET`
|
|
192
|
+
|
|
193
|
+
- 类型:必选
|
|
194
|
+
- 描述:微信应用的 App Secret。
|
|
195
|
+
- 默认值:`-`
|
|
196
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
197
|
+
|
|
198
|
+
<Callout type={'info'}>
|
|
199
|
+
其他基于 OIDC 的提供商(Auth0、Authelia、Authentik、Casdoor、Cloudflare Zero Trust、Keycloak、Logto、Okta、ZITADEL、Generic OIDC)的环境变量配置与 Next Auth 相同。详情请参阅下方的 [Next Auth 章节](#next-auth)。
|
|
200
|
+
</Callout>
|
|
201
|
+
|
|
16
202
|
## Next Auth
|
|
17
203
|
|
|
18
204
|
### 通用设置
|
package/locales/en-US/auth.json
CHANGED
|
@@ -52,6 +52,84 @@
|
|
|
52
52
|
"required": "This field cannot be empty"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
+
"betterAuth": {
|
|
56
|
+
"errors": {
|
|
57
|
+
"emailInvalid": "Please enter a valid email address",
|
|
58
|
+
"emailNotRegistered": "This email is not registered",
|
|
59
|
+
"emailNotVerified": "Email not verified, please verify your email first",
|
|
60
|
+
"emailRequired": "Please enter your email address",
|
|
61
|
+
"firstNameRequired": "Please enter your first name",
|
|
62
|
+
"lastNameRequired": "Please enter your last name",
|
|
63
|
+
"loginFailed": "Login failed, please check your email and password",
|
|
64
|
+
"passwordFormat": "Password must contain both letters and numbers",
|
|
65
|
+
"passwordMaxLength": "Password must not exceed 64 characters",
|
|
66
|
+
"passwordMinLength": "Password must be at least 8 characters",
|
|
67
|
+
"passwordRequired": "Please enter your password",
|
|
68
|
+
"usernameRequired": "Please enter your username"
|
|
69
|
+
},
|
|
70
|
+
"signin": {
|
|
71
|
+
"backToEmail": "Back to change email",
|
|
72
|
+
"continueWithCognito": "Continue with AWS Cognito",
|
|
73
|
+
"continueWithGithub": "Continue with GitHub",
|
|
74
|
+
"continueWithGoogle": "Continue with Google",
|
|
75
|
+
"continueWithMicrosoft": "Continue with Microsoft",
|
|
76
|
+
"emailPlaceholder": "Enter your email address",
|
|
77
|
+
"emailStep": {
|
|
78
|
+
"subtitle": "Enter your email address to continue",
|
|
79
|
+
"title": "Sign In"
|
|
80
|
+
},
|
|
81
|
+
"error": "Sign in failed, please check your email and password",
|
|
82
|
+
"forgotPassword": "Forgot password?",
|
|
83
|
+
"forgotPasswordError": "Failed to send password reset link",
|
|
84
|
+
"forgotPasswordSent": "Password reset link sent, please check your email",
|
|
85
|
+
"nextStep": "Next",
|
|
86
|
+
"noAccount": "Don't have an account?",
|
|
87
|
+
"orContinueWith": "OR",
|
|
88
|
+
"passwordPlaceholder": "Enter your password",
|
|
89
|
+
"passwordStep": {
|
|
90
|
+
"subtitle": "Enter your password to continue"
|
|
91
|
+
},
|
|
92
|
+
"signupLink": "Sign up now",
|
|
93
|
+
"socialError": "Social sign in failed, please try again",
|
|
94
|
+
"magicLinkButton": "Send sign-in link",
|
|
95
|
+
"magicLinkSent": "Sign-in link sent, please check your email",
|
|
96
|
+
"magicLinkError": "Failed to send sign-in link, please try again later",
|
|
97
|
+
"submit": "Sign In"
|
|
98
|
+
},
|
|
99
|
+
"signup": {
|
|
100
|
+
"emailPlaceholder": "Enter your email address",
|
|
101
|
+
"error": "Sign up failed, please try again",
|
|
102
|
+
"firstNamePlaceholder": "First Name",
|
|
103
|
+
"hasAccount": "Already have an account?",
|
|
104
|
+
"lastNamePlaceholder": "Last Name",
|
|
105
|
+
"passwordPlaceholder": "Enter your password",
|
|
106
|
+
"signinLink": "Sign in now",
|
|
107
|
+
"submit": "Sign Up",
|
|
108
|
+
"success": "Sign up successful! Please check your email for verification",
|
|
109
|
+
"subtitle": "Join LobeChat Community",
|
|
110
|
+
"title": "Create Account",
|
|
111
|
+
"usernamePlaceholder": "Enter your username"
|
|
112
|
+
},
|
|
113
|
+
"verifyEmail": {
|
|
114
|
+
"backToSignIn": "Back to Sign In",
|
|
115
|
+
"checkSpam": "If you don't receive the email, please check your spam folder",
|
|
116
|
+
"description": "We've sent a verification email to {{email}}",
|
|
117
|
+
"title": "Verify Your Email"
|
|
118
|
+
},
|
|
119
|
+
"resetPassword": {
|
|
120
|
+
"backToSignIn": "Back to Sign In",
|
|
121
|
+
"confirmPasswordPlaceholder": "Confirm new password",
|
|
122
|
+
"confirmPasswordRequired": "Please confirm your new password",
|
|
123
|
+
"description": "Please enter your new password",
|
|
124
|
+
"error": "Failed to reset password, please try again",
|
|
125
|
+
"invalidToken": "Invalid or expired reset link",
|
|
126
|
+
"newPasswordPlaceholder": "Enter new password",
|
|
127
|
+
"passwordMismatch": "Passwords do not match",
|
|
128
|
+
"submit": "Reset Password",
|
|
129
|
+
"success": "Password reset successful, please sign in with your new password",
|
|
130
|
+
"title": "Reset Password"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
55
133
|
"date": {
|
|
56
134
|
"prevMonth": "Last Month",
|
|
57
135
|
"recent30Days": "Last 30 Days"
|
|
@@ -86,8 +164,23 @@
|
|
|
86
164
|
"loginOrSignup": "Log In / Sign Up",
|
|
87
165
|
"profile": {
|
|
88
166
|
"avatar": "Avatar",
|
|
167
|
+
"cancel": "Cancel",
|
|
168
|
+
"changePassword": "Reset password",
|
|
89
169
|
"email": "Email Address",
|
|
170
|
+
"fullName": "Fullname",
|
|
171
|
+
"fullNameInputHint": "Please enter your new fullname",
|
|
172
|
+
"password": "Password",
|
|
173
|
+
"resetPasswordError": "Failed to send password reset link",
|
|
174
|
+
"resetPasswordSent": "Password reset link sent, please check your email",
|
|
175
|
+
"save": "Save",
|
|
176
|
+
"title": "Profile Details",
|
|
177
|
+
"updateAvatar": "Update avatar",
|
|
178
|
+
"updateFullName": "Update fullname",
|
|
90
179
|
"sso": {
|
|
180
|
+
"link": {
|
|
181
|
+
"button": "Connect Account",
|
|
182
|
+
"success": "Account linked successfully"
|
|
183
|
+
},
|
|
91
184
|
"loading": "Loading linked third-party accounts",
|
|
92
185
|
"providers": "Connected Accounts",
|
|
93
186
|
"unlink": {
|
package/locales/zh-CN/auth.json
CHANGED
|
@@ -52,6 +52,97 @@
|
|
|
52
52
|
"required": "内容不得为空"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
+
"betterAuth": {
|
|
56
|
+
"errors": {
|
|
57
|
+
"emailInvalid": "请输入有效的邮箱地址",
|
|
58
|
+
"emailNotRegistered": "该邮箱尚未注册",
|
|
59
|
+
"emailNotVerified": "邮箱尚未验证,请先验证邮箱",
|
|
60
|
+
"emailRequired": "请输入邮箱地址",
|
|
61
|
+
"firstNameRequired": "请输入名字",
|
|
62
|
+
"lastNameRequired": "请输入姓氏",
|
|
63
|
+
"loginFailed": "登录失败,请检查邮箱和密码",
|
|
64
|
+
"passwordFormat": "密码必须同时包含字母和数字",
|
|
65
|
+
"passwordMaxLength": "密码最多不超过 64 个字符",
|
|
66
|
+
"passwordMinLength": "密码至少需要 8 个字符",
|
|
67
|
+
"passwordRequired": "请输入密码",
|
|
68
|
+
"usernameRequired": "请输入用户名"
|
|
69
|
+
},
|
|
70
|
+
"signin": {
|
|
71
|
+
"backToEmail": "返回修改邮箱",
|
|
72
|
+
"continueWithCognito": "使用 AWS Cognito 登录",
|
|
73
|
+
"continueWithGithub": "使用 GitHub 登录",
|
|
74
|
+
"continueWithGoogle": "使用 Google 登录",
|
|
75
|
+
"continueWithMicrosoft": "使用 Microsoft 登录",
|
|
76
|
+
"continueWithAuth0": "使用 Auth0 登录",
|
|
77
|
+
"continueWithAuthelia": "使用 Authelia 登录",
|
|
78
|
+
"continueWithAuthentik": "使用 Authentik 登录",
|
|
79
|
+
"continueWithCasdoor": "使用 Casdoor 登录",
|
|
80
|
+
"continueWithCloudflareZeroTrust": "使用 Cloudflare Zero Trust 登录",
|
|
81
|
+
"continueWithOIDC": "使用 OIDC 登录",
|
|
82
|
+
"continueWithKeycloak": "使用 Keycloak 登录",
|
|
83
|
+
"continueWithLogto": "使用 Logto 登录",
|
|
84
|
+
"continueWithOkta": "使用 Okta 登录",
|
|
85
|
+
"continueWithZitadel": "使用 Zitadel 登录",
|
|
86
|
+
"continueWithFeishu": "使用飞书登录",
|
|
87
|
+
"continueWithWechat": "使用微信登录",
|
|
88
|
+
"emailPlaceholder": "请输入邮箱地址",
|
|
89
|
+
"emailStep": {
|
|
90
|
+
"subtitle": "请输入您的邮箱地址以继续",
|
|
91
|
+
"title": "登录"
|
|
92
|
+
},
|
|
93
|
+
"error": "登录失败,请检查邮箱和密码",
|
|
94
|
+
"forgotPassword": "忘记密码?",
|
|
95
|
+
"forgotPasswordError": "发送重置密码链接失败",
|
|
96
|
+
"forgotPasswordSent": "重置密码链接已发送,请检查邮箱",
|
|
97
|
+
"nextStep": "下一步",
|
|
98
|
+
"noAccount": "还没有账号?",
|
|
99
|
+
"orContinueWith": "或",
|
|
100
|
+
"passwordPlaceholder": "请输入密码",
|
|
101
|
+
"passwordStep": {
|
|
102
|
+
"subtitle": "请输入密码以继续"
|
|
103
|
+
},
|
|
104
|
+
"signupLink": "立即注册",
|
|
105
|
+
"socialError": "社交登录失败,请重试",
|
|
106
|
+
"socialOnlyHint": "该邮箱使用社交账号注册,请使用社交账号登录",
|
|
107
|
+
"magicLinkButton": "发送登录链接",
|
|
108
|
+
"magicLinkSent": "登录链接已发送,请检查邮箱",
|
|
109
|
+
"magicLinkError": "发送登录链接失败,请稍后再试",
|
|
110
|
+
"submit": "登录"
|
|
111
|
+
},
|
|
112
|
+
"signup": {
|
|
113
|
+
"emailPlaceholder": "请输入邮箱地址",
|
|
114
|
+
"error": "注册失败,请重试",
|
|
115
|
+
"firstNamePlaceholder": "名字",
|
|
116
|
+
"hasAccount": "已有账号?",
|
|
117
|
+
"lastNamePlaceholder": "姓氏",
|
|
118
|
+
"passwordPlaceholder": "请输入密码",
|
|
119
|
+
"signinLink": "立即登录",
|
|
120
|
+
"submit": "注册",
|
|
121
|
+
"success": "注册成功!请检查您的邮箱验证邮件",
|
|
122
|
+
"subtitle": "加入 LobeChat 社区",
|
|
123
|
+
"title": "创建账号",
|
|
124
|
+
"usernamePlaceholder": "请输入用户名"
|
|
125
|
+
},
|
|
126
|
+
"verifyEmail": {
|
|
127
|
+
"backToSignIn": "返回登录",
|
|
128
|
+
"checkSpam": "如果没有收到邮件,请检查垃圾邮件文件夹",
|
|
129
|
+
"description": "我们已向 {{email}} 发送了验证邮件",
|
|
130
|
+
"title": "验证您的邮箱"
|
|
131
|
+
},
|
|
132
|
+
"resetPassword": {
|
|
133
|
+
"backToSignIn": "返回登录",
|
|
134
|
+
"confirmPasswordPlaceholder": "确认新密码",
|
|
135
|
+
"confirmPasswordRequired": "请确认新密码",
|
|
136
|
+
"description": "请输入您的新密码",
|
|
137
|
+
"error": "重置密码失败,请重试",
|
|
138
|
+
"invalidToken": "无效或已过期的重置链接",
|
|
139
|
+
"newPasswordPlaceholder": "输入新密码",
|
|
140
|
+
"passwordMismatch": "两次输入的密码不一致",
|
|
141
|
+
"submit": "重置密码",
|
|
142
|
+
"success": "密码重置成功,请使用新密码登录",
|
|
143
|
+
"title": "重置密码"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
55
146
|
"date": {
|
|
56
147
|
"prevMonth": "上个月",
|
|
57
148
|
"recent30Days": "最近30天"
|
|
@@ -86,12 +177,27 @@
|
|
|
86
177
|
"loginOrSignup": "登录 / 注册",
|
|
87
178
|
"profile": {
|
|
88
179
|
"avatar": "头像",
|
|
180
|
+
"cancel": "取消",
|
|
181
|
+
"changePassword": "重置密码",
|
|
89
182
|
"email": "电子邮件地址",
|
|
183
|
+
"fullName": "全名",
|
|
184
|
+
"fullNameInputHint": "请输入新的全名",
|
|
185
|
+
"password": "密码",
|
|
186
|
+
"resetPasswordError": "发送密码重置链接失败",
|
|
187
|
+
"resetPasswordSent": "密码重置链接已发送,请检查邮箱",
|
|
188
|
+
"save": "保存",
|
|
189
|
+
"title": "个人资料详情",
|
|
190
|
+
"updateAvatar": "更新头像",
|
|
191
|
+
"updateFullName": "更新全名",
|
|
90
192
|
"sso": {
|
|
193
|
+
"link": {
|
|
194
|
+
"button": "连接帐户",
|
|
195
|
+
"success": "账户关联成功"
|
|
196
|
+
},
|
|
91
197
|
"loading": "正在加载已绑定的第三方账户",
|
|
92
198
|
"providers": "连接的帐户",
|
|
93
199
|
"unlink": {
|
|
94
|
-
"description": "解绑后,您将无法使用 {{provider}}
|
|
200
|
+
"description": "解绑后,您将无法使用 {{provider}} 账户 「{{providerAccountId}}」 登录。如果您需要重新绑定 {{provider}} 账户到当前账户,请确保 {{provider}} 账户的邮件地址为 {{email}} ,我们会在登陆时为你自动绑定到当前登录账户。",
|
|
95
201
|
"forbidden": "您至少需要保留一个第三方账户绑定。",
|
|
96
202
|
"title": "是否解绑该第三方账户 {{provider}} ?"
|
|
97
203
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.125",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"prepare": "husky",
|
|
72
72
|
"prettier": "prettier -c --write \"**/**\"",
|
|
73
73
|
"pull": "git pull",
|
|
74
|
-
"reinstall": "rm -rf
|
|
74
|
+
"reinstall": "rm -rf .next && rm -rf node_modules && pnpm -r exec rm -rf node_modules && pnpm install",
|
|
75
75
|
"reinstall:desktop": "rm -rf pnpm-lock.yaml && rm -rf node_modules && pnpm -r exec rm -rf node_modules && pnpm install --node-linker=hoisted",
|
|
76
76
|
"release": "semantic-release",
|
|
77
77
|
"self-hosting:docker": "docker build -t lobehub:local .",
|
|
@@ -199,6 +199,7 @@
|
|
|
199
199
|
"ahooks": "^3.9.6",
|
|
200
200
|
"antd": "^5.28.1",
|
|
201
201
|
"antd-style": "^3.7.1",
|
|
202
|
+
"better-auth": "^1.4.1",
|
|
202
203
|
"brotli-wasm": "^3.0.1",
|
|
203
204
|
"chroma-js": "^3.1.2",
|
|
204
205
|
"cmdk": "^1.1.1",
|
|
@@ -240,6 +241,7 @@
|
|
|
240
241
|
"next-mdx-remote": "^5.0.0",
|
|
241
242
|
"nextjs-toploader": "^3.9.17",
|
|
242
243
|
"node-machine-id": "^1.1.12",
|
|
244
|
+
"nodemailer": "^7.0.10",
|
|
243
245
|
"numeral": "^2.0.6",
|
|
244
246
|
"nuqs": "^2.7.3",
|
|
245
247
|
"officeparser": "5.1.1",
|
|
@@ -334,6 +336,7 @@
|
|
|
334
336
|
"@types/lodash": "^4.17.20",
|
|
335
337
|
"@types/lodash-es": "^4.17.12",
|
|
336
338
|
"@types/node": "^24.10.1",
|
|
339
|
+
"@types/nodemailer": "^7.0.3",
|
|
337
340
|
"@types/numeral": "^2.0.5",
|
|
338
341
|
"@types/oidc-provider": "^9.5.0",
|
|
339
342
|
"@types/pdfkit": "^0.17.3",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const enableClerk = !!process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY;
|
|
2
|
+
export const enableBetterAuth = process.env.NEXT_PUBLIC_ENABLE_BETTER_AUTH === '1';
|
|
2
3
|
export const enableNextAuth = process.env.NEXT_PUBLIC_ENABLE_NEXT_AUTH === '1';
|
|
3
|
-
export const enableAuth = enableClerk || enableNextAuth || false;
|
|
4
|
+
export const enableAuth = enableClerk || enableBetterAuth || enableNextAuth || false;
|
|
4
5
|
|
|
5
6
|
export const LOBE_CHAT_AUTH_HEADER = 'X-lobe-chat-auth';
|
|
6
7
|
export const LOBE_CHAT_OIDC_AUTH_HEADER = 'Oidc-Auth';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "agents" ADD COLUMN IF NOT EXISTS "editor_data" jsonb;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "accounts" (
|
|
2
|
+
"access_token" text,
|
|
3
|
+
"access_token_expires_at" timestamp,
|
|
4
|
+
"account_id" text NOT NULL,
|
|
5
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
6
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
7
|
+
"id_token" text,
|
|
8
|
+
"password" text,
|
|
9
|
+
"provider_id" text NOT NULL,
|
|
10
|
+
"refresh_token" text,
|
|
11
|
+
"refresh_token_expires_at" timestamp,
|
|
12
|
+
"scope" text,
|
|
13
|
+
"updated_at" timestamp NOT NULL,
|
|
14
|
+
"user_id" text NOT NULL
|
|
15
|
+
);
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
CREATE TABLE IF NOT EXISTS "auth_sessions" (
|
|
18
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
19
|
+
"expires_at" timestamp NOT NULL,
|
|
20
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
21
|
+
"ip_address" text,
|
|
22
|
+
"token" text NOT NULL,
|
|
23
|
+
"updated_at" timestamp NOT NULL,
|
|
24
|
+
"user_agent" text,
|
|
25
|
+
"user_id" text NOT NULL,
|
|
26
|
+
CONSTRAINT "auth_sessions_token_unique" UNIQUE("token")
|
|
27
|
+
);
|
|
28
|
+
--> statement-breakpoint
|
|
29
|
+
CREATE TABLE IF NOT EXISTS "verifications" (
|
|
30
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
31
|
+
"expires_at" timestamp NOT NULL,
|
|
32
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
33
|
+
"identifier" text NOT NULL,
|
|
34
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
35
|
+
"value" text NOT NULL
|
|
36
|
+
);
|
|
37
|
+
--> statement-breakpoint
|
|
38
|
+
ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "email_verified" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
|
39
|
+
DO $$ BEGIN
|
|
40
|
+
ALTER TABLE "accounts" ADD CONSTRAINT "accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
|
41
|
+
EXCEPTION
|
|
42
|
+
WHEN duplicate_object THEN null;
|
|
43
|
+
END $$;
|
|
44
|
+
--> statement-breakpoint
|
|
45
|
+
DO $$ BEGIN
|
|
46
|
+
ALTER TABLE "auth_sessions" ADD CONSTRAINT "auth_sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
|
47
|
+
EXCEPTION
|
|
48
|
+
WHEN duplicate_object THEN null;
|
|
49
|
+
END $$;
|