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

@@ -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)