@electerm/electerm-react 2.7.6 → 2.7.9
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.
|
@@ -82,16 +82,27 @@ export default class RdpSession extends PureComponent {
|
|
|
82
82
|
})
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
buildWsUrl = (port, type = 'rdp', extra = '') => {
|
|
86
|
+
const { host, tokenElecterm } = this.props.config
|
|
87
|
+
const { id } = this.props.tab
|
|
88
|
+
if (window.et.buildWsUrl) {
|
|
89
|
+
return window.et.buildWsUrl(
|
|
90
|
+
host,
|
|
91
|
+
port,
|
|
92
|
+
tokenElecterm,
|
|
93
|
+
id,
|
|
94
|
+
type,
|
|
95
|
+
extra
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
return `ws://${host}:${port}/${type}/${id}?token=${tokenElecterm}${extra}`
|
|
99
|
+
}
|
|
100
|
+
|
|
85
101
|
remoteInit = async () => {
|
|
86
102
|
this.setState({
|
|
87
103
|
loading: true
|
|
88
104
|
})
|
|
89
105
|
const { config } = this.props
|
|
90
|
-
const {
|
|
91
|
-
host,
|
|
92
|
-
tokenElecterm,
|
|
93
|
-
server = ''
|
|
94
|
-
} = config
|
|
95
106
|
const { id } = this.props
|
|
96
107
|
const tab = window.store.applyProfile(deepCopy(this.props.tab || {}))
|
|
97
108
|
const {
|
|
@@ -127,16 +138,10 @@ export default class RdpSession extends PureComponent {
|
|
|
127
138
|
console.debug('[RDP-CLIENT] Term created, pid=', pid, 'port=', port)
|
|
128
139
|
|
|
129
140
|
// Build the WebSocket proxy address for IronRDP WASM
|
|
130
|
-
const hs = server
|
|
131
|
-
? server.replace(/https?:\/\//, '')
|
|
132
|
-
: `${host}:${port}`
|
|
133
|
-
const pre = server.startsWith('https') ? 'wss' : 'ws'
|
|
134
141
|
const { width, height } = this.state
|
|
135
142
|
// IronRDP connects to the proxy address, which then proxies via RDCleanPath
|
|
136
|
-
|
|
137
|
-
const proxyAddress =
|
|
138
|
-
console.debug('[RDP-CLIENT] Proxy address:', proxyAddress)
|
|
139
|
-
|
|
143
|
+
const extra = `&width=${width}&height=${height}`
|
|
144
|
+
const proxyAddress = this.buildWsUrl(port, 'rdp', extra)
|
|
140
145
|
// Load WASM module if not already loaded
|
|
141
146
|
try {
|
|
142
147
|
await loadWasmModule()
|
|
@@ -67,11 +67,6 @@ export default class VncSession extends RdpSession {
|
|
|
67
67
|
loading: true
|
|
68
68
|
})
|
|
69
69
|
const { config } = this.props
|
|
70
|
-
const {
|
|
71
|
-
host,
|
|
72
|
-
tokenElecterm,
|
|
73
|
-
server = ''
|
|
74
|
-
} = config
|
|
75
70
|
const { id } = this.props
|
|
76
71
|
const tab = window.store.applyProfile(deepCopy(this.props.tab || {}))
|
|
77
72
|
const {
|
|
@@ -107,12 +102,8 @@ export default class VncSession extends RdpSession {
|
|
|
107
102
|
const { pid, port } = r
|
|
108
103
|
this.pid = pid
|
|
109
104
|
this.port = port
|
|
110
|
-
const hs = server
|
|
111
|
-
? server.replace(/https?:\/\//, '')
|
|
112
|
-
: `${host}:${port}`
|
|
113
|
-
const pre = server.startsWith('https') ? 'wss' : 'ws'
|
|
114
105
|
const { width, height } = this.state
|
|
115
|
-
const wsUrl =
|
|
106
|
+
const wsUrl = this.buildWsUrl(port, 'vnc', `&width=${width}&height=${height}`)
|
|
116
107
|
const vncOpts = {
|
|
117
108
|
clipViewport,
|
|
118
109
|
scaleViewport,
|