@lobehub/chat 1.2.11 โ†’ 1.2.12

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,32 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.2.12](https://github.com/lobehub/lobe-chat/compare/v1.2.11...v1.2.12)
6
+
7
+ <sup>Released on **2024-07-07**</sup>
8
+
9
+ #### ๐Ÿ› Bug Fixes
10
+
11
+ - **misc**: Fixed mobile web page navigation issue with inbox assistant, support to disable clerk signup with feature flag.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fixed mobile web page navigation issue with inbox assistant, closes [#2693](https://github.com/lobehub/lobe-chat/issues/2693) ([4476a5e](https://github.com/lobehub/lobe-chat/commit/4476a5e))
21
+ - **misc**: Support to disable clerk signup with feature flag, closes [#3126](https://github.com/lobehub/lobe-chat/issues/3126) ([4ead315](https://github.com/lobehub/lobe-chat/commit/4ead315))
22
+
23
+ </details>
24
+
25
+ <div align="right">
26
+
27
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
28
+
29
+ </div>
30
+
5
31
  ### [Version 1.2.11](https://github.com/lobehub/lobe-chat/compare/v1.2.10...v1.2.11)
6
32
 
7
33
  <sup>Released on **2024-07-07**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
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",
@@ -1,5 +1,7 @@
1
1
  import { SignUp } from '@clerk/nextjs';
2
+ import { redirect } from 'next/navigation';
2
3
 
4
+ import { serverFeatureFlags } from '@/config/featureFlags';
3
5
  import { metadataModule } from '@/server/metadata';
4
6
  import { translation } from '@/server/translation';
5
7
 
@@ -13,6 +15,12 @@ export const generateMetadata = async () => {
13
15
  };
14
16
 
15
17
  const Page = () => {
18
+ const enableClerkSignUp = serverFeatureFlags().enableClerkSignUp;
19
+
20
+ if (!enableClerkSignUp) {
21
+ redirect('/login');
22
+ }
23
+
16
24
  return <SignUp path="/signup" />;
17
25
  };
18
26
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { MobileNavBar, MobileNavBarTitle } from '@lobehub/ui';
4
4
  import { Tag } from 'antd';
5
- import { useRouter } from 'next/navigation';
5
+ import { useRouter, useSearchParams } from 'next/navigation';
6
6
  import { memo } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { Flexbox } from 'react-layout-kit';
@@ -16,7 +16,17 @@ const Header = memo(() => {
16
16
  const { t } = useTranslation('setting');
17
17
 
18
18
  const router = useRouter();
19
+ const searchParams = useSearchParams();
19
20
  const activeSettingsKey = useActiveSettingsKey();
21
+
22
+ const handleBackClick = () => {
23
+ if (searchParams.has('session') && searchParams.has('showMobileWorkspace')) {
24
+ router.push(`/chat?${searchParams.toString()}`);
25
+ } else {
26
+ router.push(enableAuth ? '/me/settings' : '/me');
27
+ }
28
+ };
29
+
20
30
  return (
21
31
  <MobileNavBar
22
32
  center={
@@ -33,7 +43,7 @@ const Header = memo(() => {
33
43
  }
34
44
  />
35
45
  }
36
- onBackClick={() => router.push(enableAuth ? '/me/settings' : '/me')}
46
+ onBackClick={handleBackClick}
37
47
  showBackButton
38
48
  style={mobileHeaderSticky}
39
49
  />
@@ -16,6 +16,8 @@ export const FeatureFlagsSchema = z.object({
16
16
 
17
17
  check_updates: z.boolean().optional(),
18
18
  welcome_suggest: z.boolean().optional(),
19
+
20
+ clerk_sign_up: z.boolean().optional(),
19
21
  });
20
22
 
21
23
  // TypeScript ็ฑปๅž‹๏ผŒไปŽ Zod schema ็”Ÿๆˆ
@@ -36,6 +38,8 @@ export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
36
38
 
37
39
  check_updates: true,
38
40
  welcome_suggest: true,
41
+
42
+ clerk_sign_up: true,
39
43
  };
40
44
 
41
45
  export const mapFeatureFlagsEnvToState = (config: IFeatureFlags) => {
@@ -53,5 +57,7 @@ export const mapFeatureFlagsEnvToState = (config: IFeatureFlags) => {
53
57
 
54
58
  enableCheckUpdates: config.check_updates,
55
59
  showWelcomeSuggest: config.welcome_suggest,
60
+
61
+ enableClerkSignUp: config.clerk_sign_up,
56
62
  };
57
63
  };
@@ -4,10 +4,13 @@ import { ClerkProvider } from '@clerk/nextjs';
4
4
  import { PropsWithChildren, memo, useEffect, useMemo, useState, useTransition } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
+ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
8
+
7
9
  import UserUpdater from './UserUpdater';
8
10
  import { useAppearance } from './useAppearance';
9
11
 
10
12
  const Clerk = memo(({ children }: PropsWithChildren) => {
13
+ const { enableClerkSignUp } = useServerConfigStore(featureFlagsSelectors);
11
14
  const appearance = useAppearance();
12
15
  const {
13
16
  i18n: { language, getResourceBundle },
@@ -27,8 +30,23 @@ const Clerk = memo(({ children }: PropsWithChildren) => {
27
30
  });
28
31
  }, [count, setCount, isPending, startTransition]);
29
32
 
33
+ const updatedAppearance = useMemo(
34
+ () => ({
35
+ ...appearance,
36
+ elements: {
37
+ ...appearance.elements,
38
+ ...(!enableClerkSignUp ? { footerAction: { display: 'none' } } : {}),
39
+ },
40
+ }),
41
+ [appearance, enableClerkSignUp],
42
+ );
43
+
30
44
  return (
31
- <ClerkProvider appearance={appearance} localization={localization}>
45
+ <ClerkProvider
46
+ appearance={updatedAppearance}
47
+ localization={localization}
48
+ signUpUrl={!enableClerkSignUp ? '/login' : '/signup'} // Redirect sign-up to sign-in if disabled
49
+ >
32
50
  {children}
33
51
  <UserUpdater />
34
52
  </ClerkProvider>
@@ -26,6 +26,7 @@ describe('featureFlagsSelectors', () => {
26
26
  showOpenAIProxyUrl: true,
27
27
  enableCheckUpdates: true,
28
28
  showWelcomeSuggest: true,
29
+ enableClerkSignUp: true,
29
30
  });
30
31
  });
31
32
  });