mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-23 12:59:54 +00:00
x11
This commit is contained in:
parent
a01d693eec
commit
d265b5f8ab
@ -16,7 +16,7 @@ import { SSHKnownHostsService } from '../services/sshKnownHosts.service'
|
|||||||
import { SFTPSession } from './sftp'
|
import { SFTPSession } from './sftp'
|
||||||
import { SSHAlgorithmType, SSHProfile, SSHProxyStream, AutoPrivateKeyLocator } from '../api'
|
import { SSHAlgorithmType, SSHProfile, SSHProxyStream, AutoPrivateKeyLocator } from '../api'
|
||||||
import { ForwardedPort } from './forwards'
|
import { ForwardedPort } from './forwards'
|
||||||
// import { X11Socket } from './x11'
|
import { X11Socket } from './x11'
|
||||||
import { supportedAlgorithms } from '../algorithms'
|
import { supportedAlgorithms } from '../algorithms'
|
||||||
import * as russh from 'russh'
|
import * as russh from 'russh'
|
||||||
|
|
||||||
@ -381,36 +381,40 @@ export class SSHSession {
|
|||||||
// })
|
// })
|
||||||
// })
|
// })
|
||||||
|
|
||||||
// this.ssh.on('x11', async (details, accept, reject) => {
|
this.ssh.x11ChannelOpen$.subscribe(async event => {
|
||||||
// this.logger.info(`Incoming X11 connection from ${details.srcIP}:${details.srcPort}`)
|
this.logger.info(`Incoming X11 connection from ${event.clientAddress}:${event.clientPort}`)
|
||||||
// const displaySpec = (this.config.store.ssh.x11Display || process.env.DISPLAY) ?? 'localhost:0'
|
const displaySpec = (this.config.store.ssh.x11Display || process.env.DISPLAY) ?? 'localhost:0'
|
||||||
// this.logger.debug(`Trying display ${displaySpec}`)
|
this.logger.debug(`Trying display ${displaySpec}`)
|
||||||
|
|
||||||
// const socket = new X11Socket()
|
const socket = new X11Socket()
|
||||||
// try {
|
try {
|
||||||
// const x11Stream = await socket.connect(displaySpec)
|
const x11Stream = await socket.connect(displaySpec)
|
||||||
// this.logger.info('Connection forwarded')
|
this.logger.info('Connection forwarded')
|
||||||
// const stream = accept()
|
|
||||||
// stream.pipe(x11Stream)
|
event.channel.data$.subscribe(data => {
|
||||||
// x11Stream.pipe(stream)
|
x11Stream.write(data)
|
||||||
// stream.on('close', () => {
|
})
|
||||||
// socket.destroy()
|
x11Stream.on('data', data => {
|
||||||
// })
|
event.channel.write(Uint8Array.from(data))
|
||||||
// x11Stream.on('close', () => {
|
})
|
||||||
// stream.close()
|
event.channel.closed$.subscribe(() => {
|
||||||
// })
|
socket.destroy()
|
||||||
// } catch (e) {
|
})
|
||||||
// // eslint-disable-next-line @typescript-eslint/no-base-to-string
|
x11Stream.on('close', () => {
|
||||||
// this.emitServiceMessage(colors.bgRed.black(' X ') + ` Could not connect to the X server: ${e}`)
|
event.channel.close()
|
||||||
// this.emitServiceMessage(` Tabby tried to connect to ${JSON.stringify(X11Socket.resolveDisplaySpec(displaySpec))} based on the DISPLAY environment var (${displaySpec})`)
|
})
|
||||||
// if (process.platform === 'win32') {
|
} catch (e) {
|
||||||
// this.emitServiceMessage(' To use X forwarding, you need a local X server, e.g.:')
|
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
// this.emitServiceMessage(' * VcXsrv: https://sourceforge.net/projects/vcxsrv/')
|
this.emitServiceMessage(colors.bgRed.black(' X ') + ` Could not connect to the X server: ${e}`)
|
||||||
// this.emitServiceMessage(' * Xming: https://sourceforge.net/projects/xming/')
|
this.emitServiceMessage(` Tabby tried to connect to ${JSON.stringify(X11Socket.resolveDisplaySpec(displaySpec))} based on the DISPLAY environment var (${displaySpec})`)
|
||||||
// }
|
if (process.platform === 'win32') {
|
||||||
// reject()
|
this.emitServiceMessage(' To use X forwarding, you need a local X server, e.g.:')
|
||||||
// }
|
this.emitServiceMessage(' * VcXsrv: https://sourceforge.net/projects/vcxsrv/')
|
||||||
// })
|
this.emitServiceMessage(' * Xming: https://sourceforge.net/projects/xming/')
|
||||||
|
}
|
||||||
|
event.channel.close()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private async verifyHostKey (key: russh.SshPublicKey): Promise<boolean> {
|
private async verifyHostKey (key: russh.SshPublicKey): Promise<boolean> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user