Commit 6dc8fd65 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

wip(screen): display x2go and spice screens

issue #1043
parent b209481c
...@@ -231,6 +231,11 @@ sub _get_controller_screen_type($self, $type) { ...@@ -231,6 +231,11 @@ sub _get_controller_screen_type($self, $type) {
$info->{driver} = $type; $info->{driver} = $type;
$info->{name} = $info->{driver}; $info->{name} = $info->{driver};
$info->{file_extension} = $type; $info->{file_extension} = $type;
my $content_type = "application/x-$type";
$content_type = "application/x-x2goclient" if $type eq 'x2go';
$info->{content_type} = $content_type;
lock_hash(%$info); lock_hash(%$info);
return ($info); return ($info);
......
...@@ -123,6 +123,7 @@ sub _get_controller_screen_spice($self) { ...@@ -123,6 +123,7 @@ sub _get_controller_screen_spice($self) {
,ip => $address ,ip => $address
,display => $display ,display => $display
,tls_port => $tls_port ,tls_port => $tls_port
,content_type => 'application/x-virt-viewer'
,file_extension => 'vv' ,file_extension => 'vv'
); );
......
...@@ -679,13 +679,28 @@ get '/machine/display/(:type)/(:id).(:ext)' => sub { ...@@ -679,13 +679,28 @@ get '/machine/display/(:type)/(:id).(:ext)' => sub {
if $USER->id ne $domain->id_owner if $USER->id ne $domain->id_owner
&& !$USER->is_admin; && !$USER->is_admin;
# $c->res->headers->content_type('application/'.$c->stash('type'));
# $c->res->headers->content_disposition(
# "inline;filename=".$domain->id.".".$c->stash('ext'));
# return $c->render(data => $domain->display_file($USER,$c->stash('type'))); # return $c->render(data => $domain->display_file($USER,$c->stash('type')));
my $type = $c->stash('type'); my $type = $c->stash('type');
return $c->render(template => 'templates/display/'.$type); $type =~ s/-tls$//;
warn $type;
my $info = $domain->info($USER);
my ($screen) = grep {$_->{driver} eq $type } @{$info->{hardware}->{screen}};
# $c->res->headers->content_type('application/x-virt-viewer');
$c->res->headers->content_type($screen->{content_type});
$c->res->headers->content_disposition(
"inline;filename=".$domain->id.".".$c->stash('ext'));
my $tls_port;
$tls_port = $screen->{tls_port} if exists $screen->{tls_port};
return $c->render(template => '/display/'.$type
,format => $c->stash('ext')
,ip => $screen->{ip}
,port => $screen->{port}
,tls_port=> $tls_port
,name => $domain->name
);
}; };
get '/machine/display/(:id).vv' => sub { get '/machine/display/(:id).vv' => sub {
......
[blablabla]
speed=3
pack=2m-jpeg
quality=8
fullscreen=true
multidisp=false
display=1
maxdim=false
width=800
height=600
dpi=96
setdpi=true
xinerama=false
clipboard=both
usekbd=true
type=auto
sshport=5952
sound=true
soundsystem=pulse
startsoundsystem=true
soundtunnel=true
name=mint
host=10.1.36.68
user=
rootless=false
published=false
command=XFCE
usesshproxy=false
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment