Skip to content

Commit 0924d98

Browse files
authored
♻️ refactor: remove webrtc sync feature flag (#9002)
* refactor to clean code * clean yjs * upgrade icons * Update package.json * fix tests * fix tests * fix tests
1 parent dac5a6f commit 0924d98

File tree

42 files changed

+22
-2134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+22
-2134
lines changed

docs/self-hosting/advanced/webrtc.mdx

Lines changed: 0 additions & 86 deletions
This file was deleted.

docs/self-hosting/advanced/webrtc.zh-CN.mdx

Lines changed: 0 additions & 80 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,7 @@
275275
"use-merge-value": "^1.2.0",
276276
"uuid": "^11.1.0",
277277
"ws": "^8.18.3",
278-
"y-protocols": "^1.0.6",
279-
"y-webrtc": "^10.3.0",
280278
"yaml": "^2.8.1",
281-
"yjs": "^13.6.27",
282279
"zod": "^3.25.76",
283280
"zustand": "5.0.4",
284281
"zustand-utils": "^2.1.0"

src/app/[variants]/(main)/(mobile)/me/settings/features/useCategory.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { Tag } from '@lobehub/ui';
2-
import { Bot, Brain, Cloudy, Info, Mic2, Settings2, Sparkles } from 'lucide-react';
1+
import { Bot, Brain, Info, Mic2, Settings2, Sparkles } from 'lucide-react';
32
import { useRouter } from 'next/navigation';
43
import { useTranslation } from 'react-i18next';
5-
import { Flexbox } from 'react-layout-kit';
64
import urlJoin from 'url-join';
75

86
import { CellProps } from '@/components/Cell';
@@ -13,7 +11,7 @@ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfi
1311
export const useCategory = () => {
1412
const router = useRouter();
1513
const { t } = useTranslation('setting');
16-
const { enableWebrtc, showLLM } = useServerConfigStore(featureFlagsSelectors);
14+
const { showLLM } = useServerConfigStore(featureFlagsSelectors);
1715

1816
const items: CellProps[] = [
1917
{
@@ -26,18 +24,6 @@ export const useCategory = () => {
2624
key: SettingsTabs.SystemAgent,
2725
label: t('tab.system-agent'),
2826
},
29-
enableWebrtc && {
30-
icon: Cloudy,
31-
key: SettingsTabs.Sync,
32-
label: (
33-
<Flexbox align={'center'} gap={8} horizontal>
34-
{t('tab.sync')}
35-
<Tag bordered={false} color={'warning'}>
36-
{t('tab.experiment')}
37-
</Tag>
38-
</Flexbox>
39-
),
40-
},
4127
showLLM &&
4228
(isDeprecatedEdition
4329
? {

src/app/[variants]/(main)/chat/@session/_layout/Desktop/SessionHeader.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Flexbox } from 'react-layout-kit';
99

1010
import { ProductLogo } from '@/components/Branding';
1111
import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
12-
import SyncStatusTag from '@/features/SyncStatusInspector';
1312
import { useActionSWR } from '@/libs/swr';
1413
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
1514
import { useSessionStore } from '@/store/session';
@@ -33,7 +32,7 @@ const Header = memo(() => {
3332
const { styles } = useStyles();
3433
const { t } = useTranslation('chat');
3534
const [createSession] = useSessionStore((s) => [s.createSession]);
36-
const { enableWebrtc, showCreateSession } = useServerConfigStore(featureFlagsSelectors);
35+
const { showCreateSession } = useServerConfigStore(featureFlagsSelectors);
3736

3837
const { mutate, isValidating } = useActionSWR('session.createSession', () => createSession());
3938

@@ -50,7 +49,6 @@ const Header = memo(() => {
5049
}}
5150
>
5251
<ProductLogo className={styles.logo} size={36} type={'text'} />
53-
{enableWebrtc && <SyncStatusTag />}
5452
</Flexbox>
5553
<Flexbox align={'center'} gap={4} horizontal>
5654
<TogglePanelButton />

src/app/[variants]/(main)/chat/@session/_layout/Mobile/SessionHeader.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Flexbox } from 'react-layout-kit';
99

1010
import { ProductLogo } from '@/components/Branding';
1111
import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
12-
import SyncStatusInspector from '@/features/SyncStatusInspector';
1312
import UserAvatar from '@/features/User/UserAvatar';
1413
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
1514
import { useSessionStore } from '@/store/session';
@@ -18,15 +17,14 @@ import { mobileHeaderSticky } from '@/styles/mobileHeader';
1817
const Header = memo(() => {
1918
const [createSession] = useSessionStore((s) => [s.createSession]);
2019
const router = useRouter();
21-
const { enableWebrtc, showCreateSession } = useServerConfigStore(featureFlagsSelectors);
20+
const { showCreateSession } = useServerConfigStore(featureFlagsSelectors);
2221

2322
return (
2423
<ChatHeader
2524
left={
2625
<Flexbox align={'center'} gap={8} horizontal style={{ marginLeft: 8 }}>
2726
<UserAvatar onClick={() => router.push('/me')} size={32} />
2827
<ProductLogo type={'text'} />
29-
{enableWebrtc && <SyncStatusInspector placement={'bottom'} />}
3028
</Flexbox>
3129
}
3230
right={

src/app/[variants]/(main)/settings/hooks/useCategory.tsx

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { Icon, Tag } from '@lobehub/ui';
1+
import { Icon } from '@lobehub/ui';
22
import {
33
Bot,
44
Brain,
5-
Cloudy,
65
Database,
76
EthernetPort,
87
Info,
@@ -14,7 +13,6 @@ import {
1413
import Link from 'next/link';
1514
import { useMemo } from 'react';
1615
import { useTranslation } from 'react-i18next';
17-
import { Flexbox } from 'react-layout-kit';
1816

1917
import type { MenuProps } from '@/components/Menu';
2018
import { isDeprecatedEdition, isDesktop } from '@/const/version';
@@ -24,8 +22,7 @@ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfi
2422
export const useCategory = () => {
2523
const { t } = useTranslation('setting');
2624
const mobile = useServerConfigStore((s) => s.isMobile);
27-
const { enableWebrtc, showLLM, enableSTT, hideDocs } =
28-
useServerConfigStore(featureFlagsSelectors);
25+
const { showLLM, enableSTT, hideDocs } = useServerConfigStore(featureFlagsSelectors);
2926

3027
const cateItems: MenuProps['items'] = useMemo(
3128
() =>
@@ -48,21 +45,6 @@ export const useCategory = () => {
4845
</Link>
4946
),
5047
},
51-
// TODO: remove in V2
52-
enableWebrtc && {
53-
icon: <Icon icon={Cloudy} />,
54-
key: SettingsTabs.Sync,
55-
label: (
56-
<Link href={'/settings/sync'} onClick={(e) => e.preventDefault()}>
57-
<Flexbox align={'center'} gap={8} horizontal>
58-
{t('tab.sync')}
59-
<Tag bordered={false} color={'warning'}>
60-
{t('tab.experiment')}
61-
</Tag>
62-
</Flexbox>
63-
</Link>
64-
),
65-
},
6648
!mobile && {
6749
icon: <Icon icon={KeyboardIcon} />,
6850
key: SettingsTabs.Hotkey,
@@ -146,7 +128,7 @@ export const useCategory = () => {
146128
),
147129
},
148130
].filter(Boolean) as MenuProps['items'],
149-
[t, enableWebrtc, showLLM],
131+
[t, showLLM],
150132
);
151133

152134
return cateItems;

src/app/[variants]/(main)/settings/sync/features/Alert.tsx

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)