@electerm/electerm-react 1.37.66 → 1.37.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,17 +7,13 @@ import postMessage from '../../common/post-msg'
|
|
|
7
7
|
import clone from '../../common/to-simple-obj'
|
|
8
8
|
import runIdle from '../../common/run-idle'
|
|
9
9
|
import {
|
|
10
|
-
CheckCircleOutlined,
|
|
11
10
|
ReloadOutlined
|
|
12
11
|
} from '@ant-design/icons'
|
|
13
12
|
import {
|
|
14
13
|
notification,
|
|
15
14
|
Spin,
|
|
16
|
-
|
|
17
|
-
Button,
|
|
18
|
-
Checkbox
|
|
15
|
+
Button
|
|
19
16
|
} from 'antd'
|
|
20
|
-
import Input from '../common/input-auto-focus'
|
|
21
17
|
import classnames from 'classnames'
|
|
22
18
|
import './terminal.styl'
|
|
23
19
|
import {
|
|
@@ -57,10 +53,6 @@ import { KeywordHighlighterAddon } from './highlight-addon.js'
|
|
|
57
53
|
const { prefix } = window
|
|
58
54
|
const e = prefix('ssh')
|
|
59
55
|
const m = prefix('menu')
|
|
60
|
-
const f = prefix('form')
|
|
61
|
-
const c = prefix('common')
|
|
62
|
-
const authFailMsg = 'All configured authentication methods failed'
|
|
63
|
-
const privateKeyMsg = 'no passphrase'
|
|
64
56
|
|
|
65
57
|
const computePos = (e) => {
|
|
66
58
|
return {
|
|
@@ -76,11 +68,8 @@ class Term extends Component {
|
|
|
76
68
|
pid: '',
|
|
77
69
|
id: props.id || 'id' + generate(),
|
|
78
70
|
loading: false,
|
|
79
|
-
promoteModalVisible: false,
|
|
80
|
-
savePassword: false,
|
|
81
71
|
saveTerminalLogToFile: !!this.props.config.saveTerminalLogToFile,
|
|
82
72
|
addTimeStampToTermLog: !!this.props.config.addTimeStampToTermLog,
|
|
83
|
-
tempPassword: '',
|
|
84
73
|
passType: 'password',
|
|
85
74
|
zmodemTransfer: null,
|
|
86
75
|
lines: []
|
|
@@ -1002,15 +991,7 @@ class Term extends Component {
|
|
|
1002
991
|
let pid = await createTerm(opts)
|
|
1003
992
|
.catch(err => {
|
|
1004
993
|
const text = err.message
|
|
1005
|
-
|
|
1006
|
-
this.setState(() => ({ passType: 'password' }))
|
|
1007
|
-
return 'fail'
|
|
1008
|
-
} else if (text.includes(privateKeyMsg)) {
|
|
1009
|
-
this.setState(() => ({ passType: 'passphrase' }))
|
|
1010
|
-
return 'fail-private'
|
|
1011
|
-
} else {
|
|
1012
|
-
handleErr({ message: text })
|
|
1013
|
-
}
|
|
994
|
+
handleErr({ message: text })
|
|
1014
995
|
})
|
|
1015
996
|
pid = pid || ''
|
|
1016
997
|
if (pid.includes('fail')) {
|
|
@@ -1159,75 +1140,11 @@ class Term extends Component {
|
|
|
1159
1140
|
resizeTerm(this.pid, this.props.sessionId, cols, rows)
|
|
1160
1141
|
}
|
|
1161
1142
|
|
|
1162
|
-
promote = () => {
|
|
1163
|
-
this.setState({
|
|
1164
|
-
promoteModalVisible: true,
|
|
1165
|
-
tempPassword: ''
|
|
1166
|
-
})
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
1143
|
handleCancel = () => {
|
|
1170
1144
|
const { id } = this.props.tab
|
|
1171
1145
|
this.props.delTab(id)
|
|
1172
1146
|
}
|
|
1173
1147
|
|
|
1174
|
-
handleToggleSavePass = () => {
|
|
1175
|
-
this.setState({
|
|
1176
|
-
savePassword: !this.state.savePassword
|
|
1177
|
-
})
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
renderPasswordForm = () => {
|
|
1181
|
-
const { tempPassword, savePassword, promoteModalVisible } = this.state
|
|
1182
|
-
const { type } = this.props.tab
|
|
1183
|
-
return (
|
|
1184
|
-
<div>
|
|
1185
|
-
<Input
|
|
1186
|
-
value={tempPassword}
|
|
1187
|
-
type='password'
|
|
1188
|
-
autofocustrigger={promoteModalVisible ? 1 : 2}
|
|
1189
|
-
selectall='yes'
|
|
1190
|
-
onChange={this.handleChangePass}
|
|
1191
|
-
onPressEnter={this.handleClickConfirmPass}
|
|
1192
|
-
/>
|
|
1193
|
-
{
|
|
1194
|
-
type !== terminalSshConfigType
|
|
1195
|
-
? (
|
|
1196
|
-
<div className='pd1t'>
|
|
1197
|
-
<Checkbox
|
|
1198
|
-
checked={savePassword}
|
|
1199
|
-
onChange={this.handleToggleSavePass}
|
|
1200
|
-
>{f('save')}
|
|
1201
|
-
</Checkbox>
|
|
1202
|
-
</div>
|
|
1203
|
-
)
|
|
1204
|
-
: null
|
|
1205
|
-
}
|
|
1206
|
-
</div>
|
|
1207
|
-
)
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
handleChangePass = e => {
|
|
1211
|
-
this.setState({
|
|
1212
|
-
tempPassword: e.target.value
|
|
1213
|
-
})
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
handleClickConfirmPass = () => {
|
|
1217
|
-
const {
|
|
1218
|
-
tempPassword,
|
|
1219
|
-
passType
|
|
1220
|
-
} = this.state
|
|
1221
|
-
this.props.setSessionState(old => {
|
|
1222
|
-
const sessionOptions = deepCopy(old.sessionOptions) || {}
|
|
1223
|
-
sessionOptions[passType] = tempPassword
|
|
1224
|
-
return { sessionOptions }
|
|
1225
|
-
})
|
|
1226
|
-
this.setState({
|
|
1227
|
-
promoteModalVisible: false
|
|
1228
|
-
}, this.remoteInit)
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
1148
|
handleShowInfo = () => {
|
|
1232
1149
|
const { id, sessionId, logName } = this.props
|
|
1233
1150
|
const { pid } = this.state
|
|
@@ -1256,54 +1173,6 @@ class Term extends Component {
|
|
|
1256
1173
|
// return result ? result[0].trim() : ''
|
|
1257
1174
|
// }
|
|
1258
1175
|
|
|
1259
|
-
renderPromoteModal = () => {
|
|
1260
|
-
if (!this.isActiveTerminal()) {
|
|
1261
|
-
return null
|
|
1262
|
-
}
|
|
1263
|
-
const {
|
|
1264
|
-
passType = 'password'
|
|
1265
|
-
} = this.state
|
|
1266
|
-
const props = {
|
|
1267
|
-
title: f(passType) + '?',
|
|
1268
|
-
content: this.renderPasswordForm(),
|
|
1269
|
-
onCancel: this.handleCancel,
|
|
1270
|
-
show: this.state.promoteModalVisible,
|
|
1271
|
-
footer: this.renderModalFooter(),
|
|
1272
|
-
cancelText: c('cancel')
|
|
1273
|
-
}
|
|
1274
|
-
return (
|
|
1275
|
-
<Modal
|
|
1276
|
-
{...props}
|
|
1277
|
-
>
|
|
1278
|
-
{this.renderPasswordForm()}
|
|
1279
|
-
</Modal>
|
|
1280
|
-
)
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
renderModalFooter = () => {
|
|
1284
|
-
const disabled = !this.state.tempPassword
|
|
1285
|
-
return (
|
|
1286
|
-
<div className='alignright pd1'>
|
|
1287
|
-
<Button
|
|
1288
|
-
type='primary'
|
|
1289
|
-
icon={<CheckCircleOutlined />}
|
|
1290
|
-
disabled={disabled}
|
|
1291
|
-
onClick={this.handleClickConfirmPass}
|
|
1292
|
-
className='mg1r'
|
|
1293
|
-
>
|
|
1294
|
-
{c('ok')}
|
|
1295
|
-
</Button>
|
|
1296
|
-
<Button
|
|
1297
|
-
type='dashed'
|
|
1298
|
-
className='mg1r'
|
|
1299
|
-
onClick={this.handleCancel}
|
|
1300
|
-
>
|
|
1301
|
-
{c('cancel')}
|
|
1302
|
-
</Button>
|
|
1303
|
-
</div>
|
|
1304
|
-
)
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
1176
|
switchEncoding = encode => {
|
|
1308
1177
|
this.decode = new TextDecoder(encode)
|
|
1309
1178
|
this.attachAddon.decoder = this.decode
|
|
@@ -1357,7 +1226,6 @@ class Term extends Component {
|
|
|
1357
1226
|
<div
|
|
1358
1227
|
{...prps1}
|
|
1359
1228
|
>
|
|
1360
|
-
{this.renderPromoteModal()}
|
|
1361
1229
|
<div
|
|
1362
1230
|
{...prps2}
|
|
1363
1231
|
>
|