From 2132491195ee95d2a414dd9575ddccf1ba1a7204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E8=85=BE?= Date: Sun, 6 Jun 2021 16:49:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/express.ts | 24 +----------------------- src/pages/terminal/index.tsx | 12 ++---------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/back/loaders/express.ts b/back/loaders/express.ts index f824ff55..7d827c94 100644 --- a/back/loaders/express.ts +++ b/back/loaders/express.ts @@ -7,7 +7,6 @@ import jwt from 'express-jwt'; import fs from 'fs'; import http from 'http'; import expressWs from 'express-ws'; -import Logger from './logger'; const excludePath = ['/api/login']; @@ -37,28 +36,7 @@ export default ({ app }: { app: Application }) => { return server.listen(...args); }; - const wsInstance = expressWs(app, server); - - // server.on('upgrade', function upgrade(request, socket, head) { - // const wss = wsInstance.getWss(); - // auth((req) => { - // const searchParams = new URLSearchParams( - // req.url.slice(req.url.indexOf('?')), - // ); - // return searchParams.get('token'); - // })(request, {} as any, (err) => { - // Logger.error(err); - // if (err) { - // socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n'); - // socket.destroy(); - // return; - // } - - // wss.handleUpgrade(request, socket, head, function done(ws) { - // wss.emit('connection', ws, request); - // }); - // }); - // }); + expressWs(app, server); app.enable('trust proxy'); app.use(cors()); diff --git a/src/pages/terminal/index.tsx b/src/pages/terminal/index.tsx index d66c1605..c683794a 100644 --- a/src/pages/terminal/index.tsx +++ b/src/pages/terminal/index.tsx @@ -1,11 +1,4 @@ -import { - useState, - useEffect, - useCallback, - Key, - useRef, - CSSProperties, -} from 'react'; +import { useState, useEffect, useRef } from 'react'; import config from '@/utils/config'; import { PageContainer } from '@ant-design/pro-layout'; import { request } from '@/utils/http'; @@ -19,7 +12,6 @@ const TerminalApp = () => { const [width, setWdith] = useState('100%'); const [marginLeft, setMarginLeft] = useState(0); const [marginTop, setMarginTop] = useState(-72); - const [style, setStyle] = useState(undefined); const ref = useRef(null); @@ -76,7 +68,7 @@ const TerminalApp = () => { }, }} > -
+
); };