[pdm-devel] [PATCH pve-xtermjs 1/2] xtermjs: add support for remote node shells via PDM
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Nov 11 09:29:08 CET 2025
if a remote name and type is specified, adapt the API endpoint base url
accordingly, and do not send the authentication line, since there is no PDM
termproxy that handles it. instead, PDM will generate and inject the
authentication line when proxying the websocket connection to the termproxy on
the remote.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
Notes:
v1: adapt to nits/style
xterm.js/src/main.js | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/xterm.js/src/main.js b/xterm.js/src/main.js
index 902a1c3..01c7786 100644
--- a/xterm.js/src/main.js
+++ b/xterm.js/src/main.js
@@ -19,6 +19,8 @@ var term,
state = states.start,
starttime = new Date();
+const remote = getQueryParameter('remote');
+const remote_type = getQueryParameter('remote-type');
var type = getQueryParameter('console');
var vmid = getQueryParameter('vmid');
var vmname = getQueryParameter('vmname');
@@ -175,7 +177,11 @@ function createTerminal() {
protocol = (location.protocol === 'https:') ? 'wss://' : 'ws://';
var params = {};
- var url = '/nodes/' + nodename;
+ var url = '';
+ if (remote) {
+ url += `/${remote_type}/remotes/${remote}/`;
+ }
+ url += `/nodes/${nodename}`;
switch (type) {
case 'kvm':
url += '/qemu/' + vmid;
@@ -252,7 +258,10 @@ function runTerminal() {
}, 250);
});
- socket.send(PVE.UserName + ':' + ticket + "\n");
+ // for remote sessions, this line needs to be sent by PDM
+ if (!remote) {
+ socket.send(`${PVE.UserName}:${ticket}\n`);
+ }
}
function getLxcStatus(callback) {
--
2.47.3
More information about the pdm-devel
mailing list