Custom parameter support

Add support for custom remote-viewer paramters: https://www.mankier.com/1/remote-viewer
This commit is contained in:
jpattWPC 2022-08-19 21:12:03 -05:00
parent 3f3323710e
commit b11817a997
2 changed files with 18 additions and 1 deletions

View file

@ -40,3 +40,12 @@ pve1.example.com = 8006
# 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
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

View file

@ -36,6 +36,7 @@ class G:
verify_ssl = True
icon = None
inidebug = False
addl_params = None
theme = 'LightBlue'
def get_dpi():
@ -140,6 +141,10 @@ def loadconfig(config_location = None):
if 'SpiceProxyRedirect' in config:
for key in config['SpiceProxyRedirect']:
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
def win_popup(message):
@ -263,7 +268,7 @@ def vmaction(vmnode, vmid, vmtype):
spiceconfig = G.proxmox.nodes(vmnode).lxc(str(vmid)).spiceproxy.post()
confignode = ConfigParser()
confignode['virt-viewer'] = {}
for key,value in spiceconfig.items():
for key, value in spiceconfig.items():
if key == 'proxy':
val = value[7:].lower()
if val in G.spiceproxy_conv:
@ -272,6 +277,9 @@ def vmaction(vmnode, vmid, vmtype):
confignode['virt-viewer'][key] = f'{value}'
else:
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('')
confignode.write(inifile)
inifile.seek(0)