@lobehub/lobehub 2.0.0-next.154 โ†’ 2.0.0-next.156

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/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 2.0.0-next.156](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.155...v2.0.0-next.156)
6
+
7
+ <sup>Released on **2025-12-04**</sup>
8
+
9
+ #### ๐Ÿ› Bug Fixes
10
+
11
+ - **misc**: Fix React CVE issue.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix React CVE issue, closes [#10593](https://github.com/lobehub/lobe-chat/issues/10593) ([abd850f](https://github.com/lobehub/lobe-chat/commit/abd850f))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ## [Version 2.0.0-next.155](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.154...v2.0.0-next.155)
31
+
32
+ <sup>Released on **2025-12-03**</sup>
33
+
34
+ #### ๐Ÿ› Bug Fixes
35
+
36
+ - **misc**: Missing init user after user creation.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Missing init user after user creation, closes [#10587](https://github.com/lobehub/lobe-chat/issues/10587) ([0e97a42](https://github.com/lobehub/lobe-chat/commit/0e97a42))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ## [Version 2.0.0-next.154](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.153...v2.0.0-next.154)
6
56
 
7
57
  <sup>Released on **2025-12-03**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix React CVE issue."
6
+ ]
7
+ },
8
+ "date": "2025-12-04",
9
+ "version": "2.0.0-next.156"
10
+ },
11
+ {
12
+ "children": {
13
+ "fixes": [
14
+ "Missing init user after user creation."
15
+ ]
16
+ },
17
+ "date": "2025-12-03",
18
+ "version": "2.0.0-next.155"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "fixes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.0.0-next.154",
3
+ "version": "2.0.0-next.156",
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",
@@ -239,7 +239,7 @@
239
239
  "mdast-util-to-markdown": "^2.1.2",
240
240
  "model-bank": "workspace:*",
241
241
  "nanoid": "^5.1.6",
242
- "next": "16.0.5",
242
+ "next": "^16.0.7",
243
243
  "next-auth": "5.0.0-beta.30",
244
244
  "next-mdx-remote": "^5.0.0",
245
245
  "nextjs-toploader": "^3.9.17",
@@ -267,10 +267,10 @@
267
267
  "query-string": "^9.3.1",
268
268
  "random-words": "^2.0.1",
269
269
  "rc-util": "^5.44.4",
270
- "react": "19.2.0",
270
+ "react": "^19.2.1",
271
271
  "react-confetti": "^6.4.0",
272
272
  "react-diff-view": "^3.3.2",
273
- "react-dom": "19.2.0",
273
+ "react-dom": "^19.2.1",
274
274
  "react-fast-marquee": "^1.6.5",
275
275
  "react-hotkeys-hook": "^5.2.1",
276
276
  "react-i18next": "^15.7.4",
@@ -4,9 +4,9 @@ export interface PythonOptions {
4
4
  */
5
5
  pyodideIndexUrl?: string;
6
6
  /**
7
- * PyPI ็ดขๅผ• URL๏ผŒ่ฆๆฑ‚ๆ”ฏๆŒ [JSON API](https://warehouse.pypa.io/api-reference/json.html)
7
+ * PyPI index URL, must support [JSON API](https://warehouse.pypa.io/api-reference/json.html)
8
8
  *
9
- * ้ป˜่ฎคๅ€ผ๏ผš`https://pypi.org/pypi/{package_name}/json`
9
+ * Default value: `https://pypi.org/pypi/{package_name}/json`
10
10
  */
11
11
  pypiIndexUrl?: string;
12
12
  }
@@ -1,4 +1,5 @@
1
1
  import * as dotenv from 'dotenv';
2
+ import dotenvExpand from 'dotenv-expand';
2
3
  import { migrate as neonMigrate } from 'drizzle-orm/neon-serverless/migrator';
3
4
  import { migrate as nodeMigrate } from 'drizzle-orm/node-postgres/migrator';
4
5
  import { join } from 'node:path';
@@ -6,9 +7,15 @@ import { join } from 'node:path';
6
7
  // @ts-ignore tsgo handle esm import cjs and compatibility issues
7
8
  import { DB_FAIL_INIT_HINT, DUPLICATE_EMAIL_HINT, PGVECTOR_HINT } from './errorHint';
8
9
 
9
- // Read the `.env` file if it exists, or a file specified by the
10
- // dotenv_config_path parameter that's passed to Node.js
11
- dotenv.config();
10
+ // Load environment variables in priority order:
11
+ // 1. .env (lowest priority)
12
+ // 2. .env.[env] (medium priority, overrides .env)
13
+ // 3. .env.[env].local (highest priority, overrides previous)
14
+ // Use dotenv-expand to support ${var} variable expansion
15
+ const env = process.env.NODE_ENV || 'development';
16
+ dotenvExpand.expand(dotenv.config()); // Load .env
17
+ dotenvExpand.expand(dotenv.config({ override: true, path: `.env.${env}` })); // Load .env.[env] and override
18
+ dotenvExpand.expand(dotenv.config({ override: true, path: `.env.${env}.local` })); // Load .env.[env].local and override
12
19
 
13
20
  const migrationsFolder = join(__dirname, '../../packages/database/migrations');
14
21
 
package/src/auth.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  import { initBetterAuthSSOProviders } from '@/libs/better-auth/sso';
14
14
  import { parseSSOProviders } from '@/libs/better-auth/utils/server';
15
15
  import { EmailService } from '@/server/services/email';
16
+ import { UserService } from '@/server/services/user';
16
17
 
17
18
  // Email verification link expiration time (in seconds)
18
19
  // Default is 1 hour (3600 seconds) as per Better Auth documentation
@@ -120,6 +121,26 @@ export const auth = betterAuth({
120
121
  database: drizzleAdapter(serverDB, {
121
122
  provider: 'pg',
122
123
  }),
124
+ /**
125
+ * Run user bootstrap for every newly created account (email, magic link, OAuth/social, etc.).
126
+ * Using Better Auth database hooks ensures we catch social flows that bypass /sign-up/* routes.
127
+ * Ref: https://www.better-auth.com/docs/reference/options#databasehooks
128
+ */
129
+ databaseHooks: {
130
+ user: {
131
+ create: {
132
+ after: async (user) => {
133
+ const userService = new UserService(serverDB);
134
+ await userService.initUser({
135
+ email: user.email,
136
+ id: user.id,
137
+ username: user.username as string | null,
138
+ // TODO: if add phone plugin, we should fill phone here
139
+ });
140
+ },
141
+ },
142
+ },
143
+ },
123
144
  user: {
124
145
  additionalFields: {
125
146
  username: {
@@ -8,6 +8,15 @@ import { KeyVaultsGateKeeper } from '@/server/modules/KeyVaultsEncrypt';
8
8
  import { S3 } from '@/server/modules/S3';
9
9
  import { AgentService } from '@/server/services/agent';
10
10
 
11
+ type CreatedUser = {
12
+ email?: string | null;
13
+ firstName?: string | null;
14
+ id: string;
15
+ lastName?: string | null;
16
+ phone?: string | null;
17
+ username?: string | null;
18
+ };
19
+
11
20
  export class UserService {
12
21
  private db: LobeChatDatabase;
13
22
 
@@ -15,6 +24,30 @@ export class UserService {
15
24
  this.db = db;
16
25
  }
17
26
 
27
+ async initUser(user: CreatedUser) {
28
+ const agentService = new AgentService(this.db, user.id);
29
+ await agentService.createInbox();
30
+
31
+ /* โ†“ cloud slot โ†“ */
32
+ /* โ†‘ cloud slot โ†‘ */
33
+
34
+ const analytics = await initializeServerAnalytics();
35
+ analytics?.identify(user.id, {
36
+ email: user.email ?? undefined,
37
+ firstName: user.firstName ?? undefined,
38
+ lastName: user.lastName ?? undefined,
39
+ phone: user.phone ?? undefined,
40
+ username: user.username ?? undefined,
41
+ });
42
+ analytics?.track({
43
+ name: 'user_register_completed',
44
+ properties: {
45
+ spm: 'user_service.init_user.user_created',
46
+ },
47
+ userId: user.id,
48
+ });
49
+ }
50
+
18
51
  createUser = async (id: string, params: UserJSON) => {
19
52
  // Check if user already exists
20
53
  const res = await UserModel.findById(this.db, id);
@@ -34,10 +67,6 @@ export class UserService {
34
67
  return index === 0;
35
68
  });
36
69
 
37
- /* โ†“ cloud slot โ†“ */
38
-
39
- /* โ†‘ cloud slot โ†‘ */
40
-
41
70
  // 2. create user in database
42
71
  await UserModel.createUser(this.db, {
43
72
  avatar: params.image_url,
@@ -50,30 +79,14 @@ export class UserService {
50
79
  username: params.username,
51
80
  });
52
81
 
53
- // 3. Create an inbox session for the user
54
- const agentService = new AgentService(this.db, id);
55
- await agentService.createInbox();
56
-
57
- /* โ†“ cloud slot โ†“ */
58
-
59
- /* โ†‘ cloud slot โ†‘ */
60
-
61
- //analytics
62
- const analytics = await initializeServerAnalytics();
63
- analytics?.identify(id, {
82
+ await this.initUser({
64
83
  email: email?.email_address,
65
84
  firstName: params.first_name,
85
+ id,
66
86
  lastName: params.last_name,
67
87
  phone: phone?.phone_number,
68
88
  username: params.username,
69
89
  });
70
- analytics?.track({
71
- name: 'user_register_completed',
72
- properties: {
73
- spm: 'user_service.create_user.user_created',
74
- },
75
- userId: id,
76
- });
77
90
 
78
91
  return { message: 'user created', success: true };
79
92
  };