From: Dominik Csapak <d.csapak@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-xtermjs 1/1] xtermjs: add support for remote node shells via PDM
Date: Thu, 6 Nov 2025 13:39:39 +0100 [thread overview]
Message-ID: <7dc1eaa5-e717-476e-a04a-9fe9a84e312d@proxmox.com> (raw)
In-Reply-To: <20251105141335.1230493-2-f.gruenbichler@proxmox.com>
some nits inline, no hard feelings for any of them
On 11/5/25 3:13 PM, Fabian Grünbichler wrote:
> 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@proxmox.com>
> ---
> 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..897540f 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();
>
> +var remote = getQueryParameter('remote');
> +var remote_type = getQueryParameter('remote-type');
nit: we probably should const/let here instead of var
(does not make a difference but it's a nicer behavior
in js)
> 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 !== undefined && remote !== "") {
nit: this would probably be more correct and shorter by doing
if (remote) {
(e.g. remote === null would be valid here)
if we *really* want to be safe about the contents it should be
if (typeof remote === 'string' && remote)
> + url += '/' + remote_type + '/remotes/' + remote;
nit: i'd prefer interpolated strings in new code
url += `/${remote_type}/remotes/${remote}`;
> + }
> + url += '/nodes/' + nodename;
same here
> 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 === undefined || remote === "") {
same hint as above should probably be
if (!remote) {
or
if (typeof remote !== 'string' || !remote) {
> + socket.send(PVE.UserName + ':' + ticket + "\n");
> + }
> }
>
> function getLxcStatus(callback) {
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-11-06 12:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 14:13 [pve-devel] [RFC access-control/manager/proxmox{, -yew-comp, -datacenter-manager}/xtermjs 00/11] add remote node shell Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH pve-xtermjs 1/1] xtermjs: add support for remote node shells via PDM Fabian Grünbichler
2025-11-06 12:39 ` Dominik Csapak [this message]
2025-11-05 14:13 ` [pve-devel] [PATCH access-control 1/1] api: ticket: allow token-owned VNC ticket verification Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH manager 1/2] api: termproxy/vncwebsocket: allow tokens Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH manager 2/2] api: termproxy: add description to return schema Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox 1/2] pve-api-types: add termproxy call and types Fabian Grünbichler
2025-11-06 18:48 ` [pve-devel] applied: " Thomas Lamprecht
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox 2/2] http: websocket: add proxy helper Fabian Grünbichler
2025-11-06 12:21 ` Dominik Csapak
2025-11-06 18:48 ` [pve-devel] applied: " Thomas Lamprecht
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox-yew-comp 1/1] xtermjs: add remote support Fabian Grünbichler
2025-11-06 12:33 ` Dominik Csapak
2025-11-06 12:51 ` Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox-datacenter-manager 1/4] connection: add access to "raw" client Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox-datacenter-manager 2/4] api: pve: add termproxy endpoint Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox-datacenter-manager 3/4] api: pve: add vncwebsocket endpoint Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox-datacenter-manager 4/4] ui: pve: node: add shell tab Fabian Grünbichler
2025-11-06 7:46 ` [pve-devel] [RFC access-control/manager/proxmox{, -yew-comp, -datacenter-manager}/xtermjs 00/11] add remote node shell Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7dc1eaa5-e717-476e-a04a-9fe9a84e312d@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox