1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00

Merge pull request #357 from catborise/master

fixes and getvvfile download option
This commit is contained in:
Anatoliy Guskov 2020-09-16 16:30:07 +03:00 committed by GitHub
commit 2fe1f1c73a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 2 deletions

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.14 on 2020-09-11 12:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('appsettings', '0004_auto_20200716_0637'),
]
operations = [
migrations.AlterField(
model_name='appsettings',
name='choices',
field=models.CharField(max_length=70, verbose_name='choices'),
),
]

View file

@ -9,5 +9,5 @@ class AppSettings(models.Model):
name = models.CharField(_('name'), max_length=25, null=False)
key = models.CharField(_('key'), db_index=True, max_length=50, unique=True)
value = models.CharField(_('value'), max_length=25)
choices = models.CharField(_('choices'), max_length=50)
choices = models.CharField(_('choices'), max_length=70)
description = models.CharField(_('description'), max_length=100, null=True)

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