@lobehub/chat 1.19.18 → 1.19.20

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 1.19.20](https://github.com/lobehub/lobe-chat/compare/v1.19.19...v1.19.20)
6
+
7
+ <sup>Released on **2024-09-21**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix Content-Security-Policy.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix Content-Security-Policy, closes [#4056](https://github.com/lobehub/lobe-chat/issues/4056) ([d186062](https://github.com/lobehub/lobe-chat/commit/d186062))
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 1.19.19](https://github.com/lobehub/lobe-chat/compare/v1.19.18...v1.19.19)
31
+
32
+ <sup>Released on **2024-09-21**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Casdoor webhooks providerAccountId not found.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Casdoor webhooks providerAccountId not found, closes [#4055](https://github.com/lobehub/lobe-chat/issues/4055) ([b832289](https://github.com/lobehub/lobe-chat/commit/b832289))
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 1.19.18](https://github.com/lobehub/lobe-chat/compare/v1.19.17...v1.19.18)
6
56
 
7
57
  <sup>Released on **2024-09-21**</sup>
package/next.config.mjs CHANGED
@@ -101,19 +101,6 @@ const nextConfig = {
101
101
  ],
102
102
  source: '/apple-touch-icon.png',
103
103
  },
104
- {
105
- headers: [
106
- {
107
- key: 'Content-Type',
108
- value: 'application/javascript; charset=utf-8',
109
- },
110
- {
111
- key: 'Content-Security-Policy',
112
- value: "default-src 'self'; script-src 'self'",
113
- },
114
- ],
115
- source: '/sw.js',
116
- },
117
104
  ];
118
105
  },
119
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.19.18",
3
+ "version": "1.19.20",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot 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",
@@ -23,11 +23,17 @@ export const POST = async (req: Request): Promise<NextResponse> => {
23
23
  const nextAuthUserService = new NextAuthUserService();
24
24
  switch (action) {
25
25
  case 'update-user': {
26
- return nextAuthUserService.safeUpdateUser(extendedUser.id, {
27
- avatar: extendedUser?.avatar,
28
- email: extendedUser?.email,
29
- fullName: extendedUser.displayName,
30
- });
26
+ return nextAuthUserService.safeUpdateUser(
27
+ {
28
+ provider: 'casdoor',
29
+ providerAccountId: extendedUser.id,
30
+ },
31
+ {
32
+ avatar: extendedUser?.avatar,
33
+ email: extendedUser?.email,
34
+ fullName: extendedUser.displayName,
35
+ },
36
+ );
31
37
  }
32
38
 
33
39
  default: {
@@ -23,11 +23,17 @@ export const POST = async (req: Request): Promise<NextResponse> => {
23
23
  const nextAuthUserService = new NextAuthUserService();
24
24
  switch (event) {
25
25
  case 'User.Data.Updated': {
26
- return nextAuthUserService.safeUpdateUser(data.id, {
27
- avatar: data?.avatar,
28
- email: data?.primaryEmail,
29
- fullName: data?.name,
30
- });
26
+ return nextAuthUserService.safeUpdateUser(
27
+ {
28
+ provider: 'logto',
29
+ providerAccountId: data.id,
30
+ },
31
+ {
32
+ avatar: data?.avatar,
33
+ email: data?.primaryEmail,
34
+ fullName: data?.name,
35
+ },
36
+ );
31
37
  }
32
38
 
33
39
  default: {
@@ -15,12 +15,15 @@ export class NextAuthUserService {
15
15
  this.adapter = LobeNextAuthDbAdapter(serverDB);
16
16
  }
17
17
 
18
- safeUpdateUser = async (providerAccountId: string, data: Partial<UserItem>) => {
18
+ safeUpdateUser = async (
19
+ { providerAccountId, provider }: { provider: string; providerAccountId: string },
20
+ data: Partial<UserItem>,
21
+ ) => {
19
22
  pino.info('updating user due to webhook');
20
23
  // 1. Find User by account
21
24
  // @ts-expect-error: Already impl in `LobeNextauthDbAdapter`
22
25
  const user = await this.adapter.getUserByAccount({
23
- provider: 'logto',
26
+ provider,
24
27
  providerAccountId,
25
28
  });
26
29
 
@@ -34,7 +37,7 @@ export class NextAuthUserService {
34
37
  });
35
38
  } else {
36
39
  pino.warn(
37
- `[logto]: Webhooks handler user update for "${JSON.stringify(data)}", but no user was found by the providerAccountId.`,
40
+ `[${provider}]: Webhooks handler user update for "${JSON.stringify(data)}", but no user was found by the providerAccountId.`,
38
41
  );
39
42
  }
40
43
  return NextResponse.json({ message: 'user updated', success: true }, { status: 200 });