* M #~: fix guacamole configurations VNC/RDP

This commit is contained in:
Jorge Miguel Lobo Escalona authored and GitHub committed 2025-04-25 15:14:17 +02:00
1 parent f27070368e
commit 466cde8a35
5 files changed
+42 -35

No files matched your search

@@ -55,12 +55,13 @@ const {
* @param {RefObject} options.display - Session display. Only exists if display plugins is enabled
* @param {string} options.zone - zone id
* @param {boolean} options.externalZone - is a external zone
* @param {string} options.type - connection type
* @returns {GuacamoleClientType} Guacamole client props
*/
const GuacamoleClient = ({ id, display, zone, externalZone }) => {
const GuacamoleClient = ({ id, display, zone, externalZone, type }) => {
const { oneConfig } = useSystemData()
let rangeports
if (oneConfig?.VNC_PORTS) {
if (oneConfig?.VNC_PORTS && type === 'vnc') {
const lastPort = oneConfig.VNC_PORTS.RESERVED
? oneConfig.VNC_PORTS.RESERVED.split(':')[1]
: '65535'
@@ -94,6 +94,7 @@ export const Guacamole = () => {
const guacamoleOption = useMemo(
() => ({
type,
vmID: id,
id: `${id}-${type}`,
container: containerRef.current,
+6 -2
View File
@@ -55,10 +55,14 @@ export const getConnectString = (options = {}) => {
const optimalDpi = dpi || pixelDensity * 96
const displayWidth =
width || (isWindow(display) ? display?.innerWidth : display?.offsetWidth)
width ||
(isWindow(display) ? display?.innerWidth : display?.offsetWidth) ||
'1024'
const displayHeight =
height || (isWindow(display) ? display?.innerHeight : display?.offsetHeight)
height ||
(isWindow(display) ? display?.innerHeight : display?.offsetHeight) ||
'768'
const urlOptions = [
`token=${encodeURIComponent(token)}`,
@@ -311,7 +311,7 @@ const getRdpSettings = (vmInfo) => {
if (!config.hostname) {
return { error: 'Wrong configuration. Cannot find a NIC with RDP' }
}
config.security = vmInfo.TEMPLATE?.CONTEXT?.RDP_SECURITY ?? 'rdp'
config.port = vmInfo.TEMPLATE?.CONTEXT?.RDP_PORT ?? '3389'
config.username = vmInfo.TEMPLATE?.CONTEXT?.USERNAME
config.password = vmInfo.TEMPLATE?.CONTEXT?.PASSWORD
@@ -340,8 +340,6 @@ const getRdpSettings = (vmInfo) => {
config['disable-glyph-caching'] =
nicWithRdp?.RDP_DISABLE_GLYPH_CACHING?.toLowerCase() === 'yes'
if (config.username && config.password) config.security = 'rdp'
return config
}
@@ -87,36 +87,39 @@ const clientCallbacks = {
let rangePorts = [5900, 65536]
if (settings?.connection?.rangeports) {
rangePorts = settings?.connection?.rangeports.split(':').map(Number)
await create(
{
vmPort: settings?.connection?.port,
hostAddr: settings?.connection?.hostname,
settings,
rangePorts,
},
{
connect: (pidTunnel) => {
if (connections && id) {
const dataConnection = connections?.get?.(id)
dataConnection
? (dataConnection.pidTunnel = pidTunnel)
: connections.set(id, { pidTunnel })
writeInLogger([pidTunnel, id], {
format:
'Tunnel SSH created with PID: %1$s to connection: %2$s ',
level: 2,
})
}
},
error: (err) => {
writeInLogger(err, {
format: formatError,
})
},
}
)
}
await create(
{
vmPort: settings?.connection?.port,
hostAddr: settings?.connection?.hostname,
settings,
rangePorts,
},
{
connect: (pidTunnel) => {
if (connections && id) {
const dataConnection = connections?.get?.(id)
dataConnection
? (dataConnection.pidTunnel = pidTunnel)
: connections.set(id, { pidTunnel })
writeInLogger([pidTunnel, id], {
format: 'Tunnel SSH created with PID: %1$s to connection: %2$s ',
level: 2,
})
}
},
error: (err) => {
writeInLogger(err, {
format: formatError,
})
},
}
)
console.log('-->', settings)
return callback(null, settings)
},