Skip to content

Let's use AI to Earn!

feat: 解决下载的问题

gaoSirecb47e7dba4e
diff --git a/electron/main/account/BrowserWindow/BrowserWindowItem.ts b/electron/main/account/BrowserWindow/BrowserWindowItem.ts
index c17e8028..add572c7 100644
--- a/electron/main/account/BrowserWindow/BrowserWindowItem.ts
+++ b/electron/main/account/BrowserWindow/BrowserWindowItem.ts
@@ -18,6 +18,13 @@ export default class BrowserWindowItem {
if (!this.webview)
return console.error(`无法找到id为 ‘${this.webViewId}’ 的webview`);
+ // this.webview.openDevTools();
+ // this.webview.setWindowOpenHandler((data) => {
+ // console.log(data.url);
+ // return {
+ // action: 'deny',
+ // };
+ // });
if (data.cookieParams) {
await this.setCookies(data.cookieParams);
}
diff --git a/src/assets/svgs/aiTool/videoParse.svg b/src/assets/svgs/aiTool/videoParse.svg
new file mode 100644
index 00000000..9002bb0c
--- /dev/null
+++ b/src/assets/svgs/aiTool/videoParse.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1744962772785" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5767" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="300"><path d="M400.2 259.7c-26.6 0-53.1 19-53.1 61.6v202.5c0 42.7 26.6 61.6 53.1 61.6 11.9 0 23.7-3.3 35.6-10.4l175.4-101.5c21.3-12.3 33.7-30.8 33.7-51.2 0-19.9-12.3-38.9-33.7-51.2L435.8 269.7c-11.9-6.7-23.7-10-35.6-10z m-8 61.6c0-6.2 0.9-17.1 8.5-17.1 1.9 0 6.6 0.5 13.3 4.3L589.4 410c8.1 4.7 11.9 9.5 11.9 12.8 0 2.8-3.8 8.1-11.9 12.8L414 537.1c-6.6 3.8-11.4 4.3-13.3 4.3-7.1 0-8.5-10.9-8.5-17.1v-203z m338.5-146v68.8c0 2.8 1.9 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.2 11.6-3.8 16-17.7 35.5-23.3 57.6-15.9 5.8 2 9.7 1.3 14.3-2.9 20.9-18.8 42-37.2 63.2-55.5 4.1-3.6 5.7-7.1 5.1-12.8-3-32.2 19.7-60.6 50.5-63.8 28.7-3 56.9 21.1 59.7 51.1 3.2 34.1-17.7 63.5-48.3 66.4-8.3 0.8-16.9-1.9-25.3-2.4-3.6-0.2-8.3-0.1-10.9 2.1-21.8 18.5-43.4 37.4-64.6 56.7-3 2.7-5.3 8.3-5.2 12.5 0.6 31.3-16.4 55.9-44.1 62.7-25.5 6.2-51.5-8.7-63.2-35.6-1.3-3.1-4.8-6.3-7.9-7-15-3.7-30.1-7-45.3-9.6-3.3-0.5-8 1.2-10.6 3.6-16.5 15.3-34.9 20.4-56.2 14.1-3.3-1-8.3 0-11 2.2-22.3 18.3-44.3 37.2-66.5 55.6-4.2 3.5-5.6 7.2-5.3 12.8 2.4 47.6-40.3 77.8-80.7 57.5-2.8-1.4-7.6-1.1-10.3 0.5-19.4 11.6-38.7 23.5-57.6 35.8-2.7 1.8-5.1 6.6-5.3 10.1-1.8 30.7-21.9 55.4-48.1 58.3-29.9 3.3-54.7-14-61.8-44.4-5.3-23.1 0.7-43.4 17.7-59 17.7-16.1 37.9-18.6 59-9 5.1 2.3 8.5 2 13-0.8 18.9-12 37.8-23.8 56.9-35.3 4.7-2.8 6.5-6 6.7-11.8 1.7-39.5 37-65.4 72.4-53.3 5.5 1.9 9.2 1.3 13.6-2.6 19.3-16.7 38.8-33.3 58.6-49.4 7.6-5.9 14-11.5 10.3-21.2z m0 0" fill="" p-id="5768"></path><path d="M141.6 900.3h51v-51.2h-51c-14.7 0-26.6-11.9-26.6-26.6V141.6c0-14.7 11.9-26.6 26.6-26.6h680.9c14.7 0 26.6 11.9 26.6 26.6v331.1h51.2V141.6c0-42.7-35.1-77.8-77.8-77.8H141.6c-42.2 0-76.9 34.4-77.6 76.4v683.6c0.8 42.1 35.4 76.5 77.6 76.5z" fill="" p-id="5769"></path></svg>
\ No newline at end of file
diff --git a/src/components/WebView/index.tsx b/src/components/WebView/index.tsx
index b05dd8c8..2a0cad05 100644
--- a/src/components/WebView/index.tsx
+++ b/src/components/WebView/index.tsx
@@ -21,12 +21,13 @@ export interface IWebViewProps {
// 是否开启沙盒化模式
partition?: boolean;
account?: AccountInfo;
+ allowpopups?: boolean;
}
const WebView = memo(
forwardRef(
(
- { url, cookieParams, partition, account }: IWebViewProps,
+ { url, cookieParams, partition, account, allowpopups }: IWebViewProps,
ref: ForwardedRef<IWebViewRef>,
) => {
const webviewRef = useRef<HTMLWebViewElement>(null);
@@ -83,7 +84,11 @@ const WebView = memo(
<div className={styles.webview}>
<Spin spinning={loading} tip="加载中...">
<webview
+ // @ts-ignore
+ disablewebsecurity={'true'}
ref={webviewRef}
+ // @ts-ignore
+ allowpopups={allowpopups ? 'true' : undefined}
webpreferences="sandbox"
src={loading ? 'about:blank' : url}
style={{ width: '100%', height: '100%' }}
diff --git a/src/router/index.tsx b/src/router/index.tsx
index e50def10..76399564 100644
--- a/src/router/index.tsx
+++ b/src/router/index.tsx
@@ -44,8 +44,7 @@ import Replyother from '@/views/replyother/replyother';
import ErrorBoundary from '../components/ErrorBoundary/ErrorBoundary';
import AiTool from '@/views/aiTool/index';
import AiRanking from '../views/aiTool/children/aiRanking/index';
-import DigitalHuman from '../views/aiTool/children/digitalHuman/index';
-import ChatAiDraw from '../views/aiTool/children/chatAiDraw';
+import AiToolWebview from '../views/aiTool/children/aiToolWebview';
interface IRouterMeta {
// 路由名称
@@ -127,12 +126,8 @@ export const router: CustomRouteObject[] = [
element: <AiRanking />,
},
{
- path: '/aiTool/digitalHuman',
- element: <DigitalHuman />,
- },
- {
- path: '/aiTool/chatAiDraw',
- element: <ChatAiDraw />,
+ path: '/aiTool/aiToolWebview',
+ element: <AiToolWebview />,
},
],
},
diff --git a/src/views/aiTool/children/aiToolWebview/index.tsx b/src/views/aiTool/children/aiToolWebview/index.tsx
new file mode 100644
index 00000000..560a0b90
--- /dev/null
+++ b/src/views/aiTool/children/aiToolWebview/index.tsx
@@ -0,0 +1,20 @@
+import styles from '../../aiTool.module.scss';
+import WebView from '../../../../components/WebView';
+import { useLocation, useSearchParams } from 'react-router-dom';
+import { useEffect, useState } from 'react';
+
+export default function Page() {
+ const location = useLocation();
+ const searchParams = useSearchParams();
+ const [webviewUrl, setWebviewUrl] = useState('');
+
+ useEffect(() => {
+ setWebviewUrl(searchParams[0].get('webviewUrl') || '');
+ }, [location]);
+
+ return (
+ <div className={styles['aiTool-webview']}>
+ <WebView url={webviewUrl} key={webviewUrl} allowpopups />
+ </div>
+ );
+}
diff --git a/src/views/aiTool/children/chatAiDraw/index.tsx b/src/views/aiTool/children/chatAiDraw/index.tsx
deleted file mode 100644
index 33c10f63..00000000
--- a/src/views/aiTool/children/chatAiDraw/index.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import styles from '../../aiTool.module.scss';
-import WebView from '../../../../components/WebView';
-
-export default function Page() {
- return (
- <div className={styles['aiTool-webview']}>
- <WebView url="https://www.yikart.cn/chat?isHideNav=true" />
- </div>
- );
-}
diff --git a/src/views/aiTool/children/digitalHuman/digitalHuman.module.scss b/src/views/aiTool/children/digitalHuman/digitalHuman.module.scss
deleted file mode 100644
index 3095fbcf..00000000
--- a/src/views/aiTool/children/digitalHuman/digitalHuman.module.scss
+++ /dev/null
@@ -1,2 +0,0 @@
-.digitalHuman {
-}
\ No newline at end of file
diff --git a/src/views/aiTool/children/digitalHuman/index.tsx b/src/views/aiTool/children/digitalHuman/index.tsx
deleted file mode 100644
index e599a0eb..00000000
--- a/src/views/aiTool/children/digitalHuman/index.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import styles from './digitalHuman.module.scss';
-
-export default function Page() {
- return <div className={styles.digitalHuman}>数字人</div>;
-}
diff --git a/src/views/aiTool/index.tsx b/src/views/aiTool/index.tsx
index a358aea1..86e0e86d 100644
--- a/src/views/aiTool/index.tsx
+++ b/src/views/aiTool/index.tsx
@@ -2,7 +2,8 @@ import { Menu, MenuProps } from 'antd';
import styles from './aiTool.module.scss';
import Ranking from '@/assets/svgs/aiTool/ranking.svg?react';
import AiDraw from '@/assets/svgs/aiTool/aiDraw.svg?react';
-// import DigitalHuman from '@/assets/svgs/aiTool/digitalHuman.svg?react';
+import DigitalHuman from '@/assets/svgs/aiTool/digitalHuman.svg?react';
+import VideoParse from '@/assets/svgs/aiTool/videoParse.svg?react';
import Icon from '@ant-design/icons';
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
import { useEffect, useState } from 'react';
@@ -16,15 +17,20 @@ const items: MenuItem[] = [
icon: <Icon component={Ranking} />,
},
{
- key: '/aiTool/chatAiDraw',
+ key: '/aiTool/aiToolWebview?webviewUrl=https://www.yikart.cn/chat?isHideNav=true',
label: 'Chat Ai绘图',
icon: <Icon component={AiDraw} />,
},
- // {
- // key: '/aiTool/digitalHuman',
- // label: '数字人制作',
- // icon: <Icon component={DigitalHuman} />,
- // },
+ {
+ key: '/aiTool/aiToolWebview?webviewUrl=http://39.100.101.239:6006',
+ label: 'MuseTalk',
+ icon: <Icon component={DigitalHuman} />,
+ },
+ {
+ key: '/aiTool/aiToolWebview?webviewUrl=http://39.100.101.239:5043',
+ label: '在线短视频解析',
+ icon: <Icon component={VideoParse} />,
+ },
];
export default function Page() {
@@ -33,14 +39,14 @@ export default function Page() {
const [currChooseRoute, setCurrChooseRoute] = useState<string>();
useEffect(() => {
- setCurrChooseRoute(location.pathname);
+ setCurrChooseRoute(location.pathname + location.search);
}, [location]);
return (
<div className={styles.aiTool}>
<Menu
selectedKeys={[currChooseRoute || '']}
- style={{ width: 160 }}
+ style={{ width: 180 }}
inlineIndent={15}
mode="inline"
items={items}