1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

add getvvfile for desktop viewers.(virt-viewer)

This commit is contained in:
catborise 2020-09-11 15:56:11 +03:00
parent 82f5fbf159
commit 45e3b00180
2 changed files with 7 additions and 1 deletions

View file

@ -156,6 +156,9 @@
<a href="#" class="btn btn-success" id="vdi_url">{% trans "VDI" %}</a>
</span>
</div>
<p>{% trans "To download console.vv file for virt-viewer." %}</p>
<a href="{% url 'instances:getvvfile' instance.id %}" class="btn btn-lg btn-success float-right">{% trans "Get console.vv" %}</a>
<div class="clearfix"></div>
</div>
{% endif %}

View file

@ -1164,7 +1164,10 @@ def getvvfile(request, pk):
response = HttpResponse(content='', content_type='application/x-virt-viewer', status=200, reason=None, charset='utf-8')
response.writelines('[virt-viewer]\n')
response.writelines('type=' + conn.graphics_type(instance.name) + '\n')
response.writelines('host=' + conn.graphics_listen(instance.name) + '\n')
if conn.graphics_listen(instance.name) == '0.0.0.0':
response.writelines('host=' + conn.host + '\n')
else:
response.writelines('host=' + conn.graphics_listen(instance.name) + '\n')
response.writelines('port=' + conn.graphics_port(instance.name) + '\n')
response.writelines('title=' + conn.domain_name(instance.name) + '\n')
response.writelines('password=' + conn.graphics_passwd(instance.name) + '\n')