@electerm/electerm-react 1.60.16 → 1.60.18
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.
|
@@ -1110,6 +1110,22 @@ clear\r`
|
|
|
1110
1110
|
this.bufferMode = buf.type
|
|
1111
1111
|
}
|
|
1112
1112
|
|
|
1113
|
+
buildWsUrl = () => {
|
|
1114
|
+
const { host, port, tokenElecterm } = this.props.config
|
|
1115
|
+
const { id } = this.props.tab
|
|
1116
|
+
if (window.et.buildWsUrl) {
|
|
1117
|
+
return window.et.buildWsUrl(
|
|
1118
|
+
host,
|
|
1119
|
+
port,
|
|
1120
|
+
tokenElecterm,
|
|
1121
|
+
id,
|
|
1122
|
+
this.props.sessionId
|
|
1123
|
+
)
|
|
1124
|
+
}
|
|
1125
|
+
const wsUrl = `ws://${host}:${port}/terminals/${id}?sessionId=${this.props.sessionId}&token=${tokenElecterm}`
|
|
1126
|
+
return wsUrl
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1113
1129
|
remoteInit = async (term = this.term) => {
|
|
1114
1130
|
this.setState({
|
|
1115
1131
|
loading: true
|
|
@@ -1117,11 +1133,7 @@ clear\r`
|
|
|
1117
1133
|
const { cols, rows } = term
|
|
1118
1134
|
const { config } = this.props
|
|
1119
1135
|
const {
|
|
1120
|
-
|
|
1121
|
-
port,
|
|
1122
|
-
tokenElecterm,
|
|
1123
|
-
keywords = [],
|
|
1124
|
-
server = ''
|
|
1136
|
+
keywords = []
|
|
1125
1137
|
} = config
|
|
1126
1138
|
const { sessionId, logName } = this.props
|
|
1127
1139
|
const tab = window.store.applyProfileToTabs(deepCopy(this.props.tab || {}))
|
|
@@ -1189,11 +1201,7 @@ clear\r`
|
|
|
1189
1201
|
this.setStatus(statusMap.success)
|
|
1190
1202
|
term.pid = id
|
|
1191
1203
|
this.pid = id
|
|
1192
|
-
const
|
|
1193
|
-
? server.replace(/https?:\/\//, '')
|
|
1194
|
-
: `${host}:${port}`
|
|
1195
|
-
const pre = server.startsWith('https') ? 'wss' : 'ws'
|
|
1196
|
-
const wsUrl = `${pre}://${hs}/terminals/${id}?sessionId=${sessionId}&token=${tokenElecterm}`
|
|
1204
|
+
const wsUrl = this.buildWsUrl()
|
|
1197
1205
|
const socket = new WebSocket(wsUrl)
|
|
1198
1206
|
socket.onclose = this.oncloseSocket
|
|
1199
1207
|
socket.onerror = this.onerrorSocket
|