@lobehub/lobehub 2.0.0-next.124 → 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 +25 -0
- package/Dockerfile +6 -6
- package/GEMINI.md +63 -0
- package/changelog/v1.json +9 -0
- package/docs/development/database-schema.dbml +37 -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/0049_better_auth.sql +49 -0
- package/packages/database/migrations/meta/0048_snapshot.json +312 -932
- package/packages/database/migrations/meta/0049_snapshot.json +8151 -0
- package/packages/database/migrations/meta/_journal.json +8 -1
- package/packages/database/src/core/migrations.json +13 -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/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)/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/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/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/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
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,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 $$;
|