@lobehub/chat 1.19.18 → 1.19.19

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,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.19.19](https://github.com/lobehub/lobe-chat/compare/v1.19.18...v1.19.19)
6
+
7
+ <sup>Released on **2024-09-21**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Casdoor webhooks providerAccountId not found.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **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))
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
+
5
30
  ### [Version 1.19.18](https://github.com/lobehub/lobe-chat/compare/v1.19.17...v1.19.18)
6
31
 
7
32
  <sup>Released on **2024-09-21**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.19.18",
3
+ "version": "1.19.19",
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 });