From 0539ce351d19927e2bdebe078d7fa90260c6f350 Mon Sep 17 00:00:00 2001 From: dushixiang <798148596@qq.com> Date: Sun, 14 Feb 2021 03:47:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BD=BF=E7=94=A8go?= =?UTF-8?q?lang=20ssh=E5=BA=93=E6=8E=A5=E5=85=A5=E8=AE=BF=E9=97=AESSH?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=B5=84=E4=BA=A7=E7=9A=84=E9=80=89=E9=A1=B9?= =?UTF-8?q?=20close=20#58?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/api/routes.go | 1 + pkg/model/asset-attribute.go | 2 +- pkg/model/property.go | 4 + web/src/components/access/Term.js | 44 ++++++++- web/src/components/asset/Asset.js | 16 +-- web/src/components/asset/AssetModal.js | 131 +++++++++++++++---------- 6 files changed, 136 insertions(+), 62 deletions(-) diff --git a/pkg/api/routes.go b/pkg/api/routes.go index 1936864..c4c2c43 100644 --- a/pkg/api/routes.go +++ b/pkg/api/routes.go @@ -76,6 +76,7 @@ func SetupRoutes() *echo.Echo { assets.PUT("/:id", AssetUpdateEndpoint) assets.DELETE("/:id", AssetDeleteEndpoint) assets.GET("/:id", AssetGetEndpoint) + assets.GET("/:id/attributes", AssetGetAttributeEndpoint) assets.POST("/:id/change-owner", Admin(AssetChangeOwnerEndpoint)) } diff --git a/pkg/model/asset-attribute.go b/pkg/model/asset-attribute.go index cde6091..eeaf1af 100644 --- a/pkg/model/asset-attribute.go +++ b/pkg/model/asset-attribute.go @@ -20,7 +20,7 @@ func (r *AssetAttribute) TableName() string { return "asset_attributes" } -var SSHParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType} +var SSHParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, SshMode} var RDPParameterNames = []string{guacd.EnableWallpaper, guacd.EnableTheming, guacd.EnableFontSmoothing, guacd.EnableFullWindowDrag, guacd.EnableDesktopComposition, guacd.EnableMenuAnimations, guacd.DisableBitmapCaching, guacd.DisableOffscreenCaching, guacd.DisableGlyphCaching} var VNCParameterNames = []string{guacd.ColorDepth, guacd.Cursor, guacd.SwapRedBlue, guacd.DestHost, guacd.DestPort} var TelnetParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, guacd.UsernameRegex, guacd.PasswordRegex, guacd.LoginSuccessRegex, guacd.LoginFailureRegex} diff --git a/pkg/model/property.go b/pkg/model/property.go index 6c84a73..6cb749c 100644 --- a/pkg/model/property.go +++ b/pkg/model/property.go @@ -5,6 +5,10 @@ import ( "next-terminal/pkg/guacd" ) +const ( + SshMode = "ssh-mode" +) + type Property struct { Name string `gorm:"primary_key" json:"name"` Value string `json:"value"` diff --git a/web/src/components/access/Term.js b/web/src/components/access/Term.js index 6ece5f6..a63022f 100644 --- a/web/src/components/access/Term.js +++ b/web/src/components/access/Term.js @@ -7,7 +7,10 @@ import {getToken, isEmpty} from "../../utils/utils"; import {FitAddon} from 'xterm-addon-fit'; import "./Access.css" import request from "../../common/request"; -import {message} from "antd"; +import {Affix, Button, Col, Drawer, message, Row} from "antd"; +import {AppstoreTwoTone} from "@ant-design/icons"; +import Draggable from "react-draggable"; +import FileSystem from "./FileSystem"; class Term extends Component { @@ -16,7 +19,8 @@ class Term extends Component { height: window.innerHeight, term: undefined, webSocket: undefined, - fitAddon: undefined + fitAddon: undefined, + sessionId: undefined }; componentDidMount = async () => { @@ -123,7 +127,8 @@ class Term extends Component { this.setState({ term: term, webSocket: webSocket, - fitAddon: fitAddon + fitAddon: fitAddon, + sessionId: sessionId }); window.addEventListener('resize', this.onWindowResize); @@ -190,6 +195,39 @@ class Term extends Component { overflowX: 'hidden', overflowY: 'hidden', }}/> + + + +