+
slot-0
{
),
- code: `// @huolala-tech/page-spy-wechat v1.6.x or upper version. \nimport PageSpy from '@huolala-tech/page-spy-wechat';\n\nnew PageSpy({
+ code: `import PageSpy from '@huolala-tech/page-spy-wechat';\n\nnew PageSpy({
+ api: '${deployPath}',
+})`,
+ lang: 'js',
+ },
+ ],
+ 'mp-uniapp': [
+ {
+ title: t('inject.mp-uniapp.install-sdk'),
+ code: `yarn add @huolala-tech/page-spy-uniapp@latest`,
+ lang: 'bash',
+ },
+ {
+ title: t('inject.mp-wechat.request-host'),
+ code: `https://${window.location.host}\nwss://${window.location.host}`,
+ },
+ {
+ title: (
+
+ slot-0
+
+ slot-1
+
+
+ ),
+ code: `import PageSpy from '@huolala-tech/page-spy-uniapp';\n\nnew PageSpy({
api: '${deployPath}',
})`,
lang: 'js',
diff --git a/src/pages/Devtools/ConsolePanel/index.tsx b/src/pages/Devtools/ConsolePanel/index.tsx
index 9c16ab3f..913306fe 100644
--- a/src/pages/Devtools/ConsolePanel/index.tsx
+++ b/src/pages/Devtools/ConsolePanel/index.tsx
@@ -13,7 +13,7 @@ const ConsolePanel = () => {
- {systemInfo?.browserName !== 'MPWeChat' && }
+ {!systemInfo?.browserName?.startsWith('mp-') && }
diff --git a/src/pages/Devtools/index.tsx b/src/pages/Devtools/index.tsx
index 72c3b57d..772097be 100644
--- a/src/pages/Devtools/index.tsx
+++ b/src/pages/Devtools/index.tsx
@@ -23,7 +23,12 @@ import './index.less';
import { StoragePanel } from './StoragePanel';
import useSearch from '@/utils/useSearch';
import { useEventListener } from '@/utils/useEventListener';
-import { parseDeviceInfo, useClientInfo } from '@/utils/brand';
+import {
+ getBrowserName,
+ getOSName,
+ parseDeviceInfo,
+ useClientInfo,
+} from '@/utils/brand';
import { useTranslation } from 'react-i18next';
import { ConnectStatus } from './ConnectStatus';
import { useSocketMessageStore } from '@/store/socket-message';
@@ -53,7 +58,7 @@ const MENU_COMPONENTS: Record<
Page: {
component: PagePanel,
visible: (params) => {
- return params.browser !== 'MPWeChat';
+ return !params.browser?.startsWith('mp-');
},
},
Storage: {
@@ -62,7 +67,7 @@ const MENU_COMPONENTS: Record<
System: {
component: SystemPanel,
visible: (params) => {
- return params.browser !== 'MPWeChat';
+ return !params.browser?.startsWith('mp-');
},
},
};
@@ -239,7 +244,7 @@ const ClientInfo = memo(() => {
title={
<>
- {t('system')}: {clientInfo?.osName}
+ {t('system')}: {getOSName(clientInfo?.osName || '')}
@@ -257,7 +262,7 @@ const ClientInfo = memo(() => {
title={
<>
- {t('browser')}: {clientInfo?.browserName}
+ {t('browser')}: {getBrowserName(clientInfo?.browserName || '')}
diff --git a/src/pages/RoomList/index.tsx b/src/pages/RoomList/index.tsx
index c98bc5a6..9012e37d 100644
--- a/src/pages/RoomList/index.tsx
+++ b/src/pages/RoomList/index.tsx
@@ -1,5 +1,11 @@
import { getSpyRoom } from '@/apis';
-import { BROWSER_LOGO, OS_LOGO, parseDeviceInfo } from '@/utils/brand';
+import {
+ OS_CONFIG,
+ getBrowserLogo,
+ getBrowserName,
+ getOSName,
+ parseDeviceInfo,
+} from '@/utils/brand';
import { useRequest } from 'ahooks';
import {
Typography,
@@ -19,6 +25,7 @@ import { PropsWithChildren, useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import './index.less';
import { Link } from 'react-router-dom';
+import { SpyDevice } from '@huolala-tech/page-spy-types';
const { Title } = Typography;
const { Option } = Select;
@@ -71,6 +78,42 @@ export const RoomList = () => {
const [form] = Form.useForm();
const { t } = useTranslation();
+ const BrowserOptions = useMemo(() => {
+ const browsers: SpyDevice.Browser[] = [
+ 'chrome',
+ 'firefox',
+ 'safari',
+ 'edge',
+ 'qq',
+ 'wechat',
+ 'uc',
+ 'baidu',
+ ];
+ const mpTypes: SpyDevice.Browser[] = ['mp-wechat', 'mp-alipay'];
+ return [
+ {
+ groupName: 'Web',
+ options: browsers.map((name) => {
+ return {
+ name,
+ label: getBrowserName(name),
+ logo: getBrowserLogo(name),
+ };
+ }),
+ },
+ {
+ groupName: t('common.miniprogram'),
+ options: mpTypes.map((name) => {
+ return {
+ name,
+ label: getBrowserName(name),
+ logo: getBrowserLogo(name),
+ };
+ }),
+ },
+ ];
+ }, []);
+
const {
data: connectionList = [],
error,
@@ -164,14 +207,18 @@ export const RoomList = () => {
-
+
-
+
@@ -244,12 +291,12 @@ export const RoomList = () => {