From c960f8859d012251aa8c83602c877ca91b6eaf30 Mon Sep 17 00:00:00 2001 From: v1ll4n Date: Tue, 25 Jan 2022 15:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E7=BB=9C=E5=B7=AE?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E7=9A=84=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=BC=95=E5=AF=BC=20/=20=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=20mitm=20=E6=8F=92=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main/handlers/mitm.js | 20 +++++----- .../src/main/src/components/YakUpgrade.tsx | 40 +++++++++++++++++-- .../src/main/src/pages/mitm/MITMPage.tsx | 2 +- 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/app/main/handlers/mitm.js b/app/main/handlers/mitm.js index d48e846a40..d68134c068 100644 --- a/app/main/handlers/mitm.js +++ b/app/main/handlers/mitm.js @@ -2,16 +2,16 @@ const {ipcMain} = require("electron"); const DNS = require("dns"); -module.exports = (win, originGetClient) => { - let mitmClient = undefined; - - function getClient() { - if (!mitmClient) { - mitmClient = originGetClient(true) - return mitmClient - } - return mitmClient - } +// module.exports = (win, originGetClient) => { +module.exports = (win, getClient) => { + // let mitmClient = undefined; + // function getClient() { + // if (!mitmClient) { + // mitmClient = originGetClient(true) + // return mitmClient + // } + // return mitmClient + // } let stream; let currentPort; diff --git a/app/renderer/src/main/src/components/YakUpgrade.tsx b/app/renderer/src/main/src/components/YakUpgrade.tsx index a267eccc9c..1b84169a73 100644 --- a/app/renderer/src/main/src/components/YakUpgrade.tsx +++ b/app/renderer/src/main/src/components/YakUpgrade.tsx @@ -2,6 +2,7 @@ import React, {useEffect, useState} from "react"; import {Alert, Button, Card, Modal, Popconfirm, Popover, Progress, Space, Spin, Tag, Typography} from "antd"; import {failed, info, success} from "../utils/notification"; import {yakProcess} from "../protected/YakLocalProcess"; +import {showModal} from "../utils/showModal"; const {ipcRenderer} = window.require("electron"); @@ -40,6 +41,8 @@ export const YakUpgrade: React.FC = (props) => { const [winPath, setWinPath] = useState(""); const [platformArch, setPlatformArch] = useState(""); + const latestVersionWithoutV = latestVersion.startsWith("v") ? latestVersion.slice(1) : latestVersion; + const queryLatestVersion = () => { setLatestLoading(true) ipcRenderer.invoke("query-latest-yak-version").then((data: string) => { @@ -158,9 +161,11 @@ export const YakUpgrade: React.FC = (props) => { - 当前最新的 Yak 引擎版本为 - {latestVersion} + message={ + + 当前最新的 Yak 引擎版本为 + {latestVersion} + }/> @@ -189,6 +194,35 @@ export const YakUpgrade: React.FC = (props) => { + {downloadProgress && = (props) => { failed("MITM 劫持服务器异常或被关闭") Modal.error({ mask: true, title: "启动 MITM 服务器 ERROR!", - content: <>{error} + content: <>{msg} }) } ipcRenderer.invoke("mitm-stop-call")