fixed X11 display spec parsing - fixes #5073, fixes #4978

This commit is contained in:
Eugene Pankov 2021-12-08 20:25:37 +01:00
parent bbb02f4e64
commit b2b91f0cfd
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
2 changed files with 2 additions and 2 deletions

View File

@ -371,7 +371,7 @@ export class SSHSession extends BaseSession {
this.ssh.on('x11', async (details, accept, reject) => {
this.logger.info(`Incoming X11 connection from ${details.srcIP}:${details.srcPort}`)
const displaySpec = process.env.DISPLAY ?? 'localhost:0'
const displaySpec = (this.config.store.ssh.x11Display || process.env.DISPLAY) ?? 'localhost:0'
this.logger.debug(`Trying display ${displaySpec}`)
const socket = new X11Socket()

View File

@ -7,7 +7,7 @@ export class X11Socket {
static resolveDisplaySpec (spec?: string|null): SocketConnectOpts {
// eslint-disable-next-line prefer-const
let [xHost, xDisplay] = /^(.+):(\d+)(?:.(\d+))$/.exec(spec ?? process.env.DISPLAY ?? 'localhost:0') ?? []
let [_, xHost, xDisplay] = /^(.+):(\d+)(?:.(\d+))$/.exec(spec ?? process.env.DISPLAY ?? 'localhost:0') ?? []
if (process.platform === 'win32') {
xHost ??= 'localhost'
} else {