@lobehub/chat 1.0.4 → 1.0.5

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.0.5](https://github.com/lobehub/lobe-chat/compare/v1.0.4...v1.0.5)
6
+
7
+ <sup>Released on **2024-06-17**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix onboard and auth for community version.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix onboard and auth for community version, closes [#2908](https://github.com/lobehub/lobe-chat/issues/2908) ([b02020d](https://github.com/lobehub/lobe-chat/commit/b02020d))
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.0.4](https://github.com/lobehub/lobe-chat/compare/v1.0.3...v1.0.4)
6
31
 
7
32
  <sup>Released on **2024-06-17**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
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",
package/src/middleware.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { clerkMiddleware } from '@clerk/nextjs/server';
1
+ import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server';
2
2
  import { NextResponse } from 'next/server';
3
3
 
4
4
  import { authEnv } from '@/config/auth';
@@ -13,6 +13,7 @@ export const config = {
13
13
  // include the /
14
14
  '/',
15
15
  '/chat(.*)',
16
+ '/settings(.*)',
16
17
  // ↓ cloud ↓
17
18
  ],
18
19
  };
@@ -42,8 +43,18 @@ const nextAuthMiddleware = auth((req) => {
42
43
  });
43
44
  });
44
45
 
46
+ const isProtectedRoute = createRouteMatcher([
47
+ '/settings(.*)',
48
+ // ↓ cloud ↓
49
+ ]);
50
+
45
51
  export default authEnv.NEXT_PUBLIC_ENABLE_CLERK_AUTH
46
- ? clerkMiddleware()
52
+ ? clerkMiddleware(
53
+ (auth, req) => {
54
+ if (isProtectedRoute(req)) auth().protect();
55
+ },
56
+ { signInUrl: '/login', signUpUrl: '/signup' },
57
+ )
47
58
  : authEnv.NEXT_PUBLIC_ENABLE_NEXT_AUTH
48
59
  ? nextAuthMiddleware
49
60
  : defaultMiddleware;
@@ -28,7 +28,8 @@ export const userRouter = router({
28
28
  // 有消息,或者创建过助手,则认为有 conversation
29
29
  hasConversation: messageCount > 0 || sessionCount > 1,
30
30
 
31
- isOnboard: state.isOnboarded || false,
31
+ // always return true for community version
32
+ isOnboard: state.isOnboarded || true,
32
33
  preference: state.preference as UserPreference,
33
34
  settings: state.settings,
34
35
  userId: ctx.userId,