@gricha/perry 0.1.1 → 0.1.2
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.
- package/dist/client/ws-shell.js +5 -1
- package/package.json +1 -1
package/dist/client/ws-shell.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import WebSocket from 'ws';
|
|
2
2
|
import { spawn } from 'child_process';
|
|
3
|
+
import { DEFAULT_AGENT_PORT } from '../shared/constants';
|
|
3
4
|
export function isLocalWorker(worker) {
|
|
4
5
|
const host = worker
|
|
5
6
|
.replace(/^https?:\/\//, '')
|
|
@@ -125,6 +126,9 @@ export function getTerminalWSUrl(worker, workspaceName) {
|
|
|
125
126
|
base = `http://${base}`;
|
|
126
127
|
}
|
|
127
128
|
const wsProtocol = base.startsWith('https://') ? 'wss://' : 'ws://';
|
|
128
|
-
|
|
129
|
+
let host = base.replace(/^https?:\/\//, '');
|
|
130
|
+
if (!host.includes(':')) {
|
|
131
|
+
host = `${host}:${DEFAULT_AGENT_PORT}`;
|
|
132
|
+
}
|
|
129
133
|
return `${wsProtocol}${host}/rpc/terminal/${encodeURIComponent(workspaceName)}`;
|
|
130
134
|
}
|