Custom parameter support
Add support for custom remote-viewer paramters: https://www.mankier.com/1/remote-viewer
This commit is contained in:
		
							parent
							
								
									3f3323710e
								
							
						
					
					
						commit
						b11817a997
					
				@ -40,3 +40,12 @@ pve1.example.com = 8006
 | 
				
			|||||||
# 1. Use the inidebug and read the current proxy=pve1.example.com:3128
 | 
					# 1. Use the inidebug and read the current proxy=pve1.example.com:3128
 | 
				
			||||||
# 2. Add your proxmox ip to the right side e.g. 123.123.123.123:6000
 | 
					# 2. Add your proxmox ip to the right side e.g. 123.123.123.123:6000
 | 
				
			||||||
pve1.example.com:3128 = 123.123.123.123:6000
 | 
					pve1.example.com:3128 = 123.123.123.123:6000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[AdditionalParameters]
 | 
				
			||||||
 | 
					# If you wish to define additional parameters to pass to virt-viewer you may define them here
 | 
				
			||||||
 | 
					# More parameter definitions here: https://www.mankier.com/1/remote-viewer
 | 
				
			||||||
 | 
					# Some Examples:
 | 
				
			||||||
 | 
					# Enable USB passthrough
 | 
				
			||||||
 | 
					#enable-usbredir = true
 | 
				
			||||||
 | 
					# Enable auto USB device sharing
 | 
				
			||||||
 | 
					#enable-usb-autoshare = true
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								vdiclient.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								vdiclient.py
									
									
									
									
									
								
							@ -36,6 +36,7 @@ class G:
 | 
				
			|||||||
	verify_ssl = True
 | 
						verify_ssl = True
 | 
				
			||||||
	icon = None
 | 
						icon = None
 | 
				
			||||||
	inidebug = False
 | 
						inidebug = False
 | 
				
			||||||
 | 
						addl_params = None
 | 
				
			||||||
	theme = 'LightBlue'
 | 
						theme = 'LightBlue'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_dpi():
 | 
					def get_dpi():
 | 
				
			||||||
@ -140,6 +141,10 @@ def loadconfig(config_location = None):
 | 
				
			|||||||
	if 'SpiceProxyRedirect' in config:
 | 
						if 'SpiceProxyRedirect' in config:
 | 
				
			||||||
		for key in config['SpiceProxyRedirect']:
 | 
							for key in config['SpiceProxyRedirect']:
 | 
				
			||||||
			G.spiceproxy_conv[key] = config['SpiceProxyRedirect'][key]
 | 
								G.spiceproxy_conv[key] = config['SpiceProxyRedirect'][key]
 | 
				
			||||||
 | 
						if 'AdditionalParameters' in config:
 | 
				
			||||||
 | 
							G.addl_params = {}
 | 
				
			||||||
 | 
							for key in config['AdditionalParameters']:
 | 
				
			||||||
 | 
								G.addl_params[key] = config['AdditionalParameters'][key]
 | 
				
			||||||
	return True
 | 
						return True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def win_popup(message):
 | 
					def win_popup(message):
 | 
				
			||||||
@ -263,7 +268,7 @@ def vmaction(vmnode, vmid, vmtype):
 | 
				
			|||||||
		spiceconfig = G.proxmox.nodes(vmnode).lxc(str(vmid)).spiceproxy.post()
 | 
							spiceconfig = G.proxmox.nodes(vmnode).lxc(str(vmid)).spiceproxy.post()
 | 
				
			||||||
	confignode = ConfigParser()
 | 
						confignode = ConfigParser()
 | 
				
			||||||
	confignode['virt-viewer'] = {}
 | 
						confignode['virt-viewer'] = {}
 | 
				
			||||||
	for key,value in spiceconfig.items():
 | 
						for key, value in spiceconfig.items():
 | 
				
			||||||
		if key == 'proxy':
 | 
							if key == 'proxy':
 | 
				
			||||||
			val = value[7:].lower()
 | 
								val = value[7:].lower()
 | 
				
			||||||
			if val in G.spiceproxy_conv:
 | 
								if val in G.spiceproxy_conv:
 | 
				
			||||||
@ -272,6 +277,9 @@ def vmaction(vmnode, vmid, vmtype):
 | 
				
			|||||||
				confignode['virt-viewer'][key] = f'{value}'
 | 
									confignode['virt-viewer'][key] = f'{value}'
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			confignode['virt-viewer'][key] = f'{value}'
 | 
								confignode['virt-viewer'][key] = f'{value}'
 | 
				
			||||||
 | 
						if G.addl_params:
 | 
				
			||||||
 | 
							for key, value in G.addl_params.items():
 | 
				
			||||||
 | 
								confignode['virt-viewer'][key] = f'{value}'
 | 
				
			||||||
	inifile = StringIO('')
 | 
						inifile = StringIO('')
 | 
				
			||||||
	confignode.write(inifile)
 | 
						confignode.write(inifile)
 | 
				
			||||||
	inifile.seek(0)
 | 
						inifile.seek(0)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user