diff --git a/src/App.tsx b/src/App.tsx
index 795418f..e47f96f 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -3,7 +3,6 @@ import "./App.css";
import {ConfigProvider} from "antd";
import {Contro} from "@components/Contro";
import {Proxifier} from "@components/Proxifier";
-import {Controller} from "./components/Controller";
import {Eval} from "@components/Eval";
import {EvalInTab} from "@components/EvalInTab";
@@ -22,7 +21,6 @@ function App() {
- {/* */}
);
diff --git a/src/components/Controller.tsx b/src/components/Controller.tsx
deleted file mode 100644
index bdb6415..0000000
--- a/src/components/Controller.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import React, {useEffect} from "react";
-import {Alert, Button, Card, Form, InputNumber} from "antd";
-import {wsc} from "../network/chrome";
-import {useGetState} from "ahooks";
-
-export interface ControllerProp {
-
-}
-
-export const Controller: React.FC = (props) => {
- const [findingPort, setFindingPort] = React.useState(false)
- const [autoFindFailedReason, setAutoFindFailedReason] = React.useState("")
- const [port, setPort] = React.useState()
-
- const [connected, setConnected, getConnected] = useGetState(false);
- const [init, setInit] = React.useState(false)
-
- useEffect(() => {
- // control status
- const updateStatus = () => {
- wsc.updateWSCStatus()
- }
- updateStatus()
- const id = setInterval(updateStatus, 500)
-
- wsc.onWSCMessage((req: { connected: boolean }) => {
- if (req['connected'] === undefined) {
- return
- }
-
- setConnected(req.connected)
- setTimeout(() => {
- setInit(true)
- }, 500)
- })
- return () => {
- clearInterval(id)
- }
- }, [])
-
- useEffect(() => {
- if (!init || connected) {
- return
- }
-
- const findPort = (port: number, max: number) => {
- const ws = new WebSocket(`ws://127.0.0.1:${port}`)
- ws.onclose = (e: CloseEvent) => {
- if (e.reason !== `FoundYakitWebSocketController` && (port + 1 <= max)) {
- setTimeout(() => findPort(port + 1, max), 300)
- }
-
- if (port + 1 > max) {
- setFindingPort(false)
- setAutoFindFailedReason("Cannot found Yakit or Yakit WebSocket Controller Port is not right")
- }
- }
- ws.onopen = () => {
- setFindingPort(false)
- setPort(port)
- ws.close(1000, "FoundYakitWebSocketController")
- }
- }
- findPort(11212, 11222)
- }, [connected, init])
-
- const freeze = findingPort || (!init);
- const safeConnected = connected && init;
-
- return {
- wsc.disconnect()
- }}>
- Disconnect
- : undefined}>
- {connected && init ?
- :
- }
-
-};
\ No newline at end of file