From 2e60251ee11dd73ccc7571ef017032d4bbebbd0e Mon Sep 17 00:00:00 2001 From: Stefano Alberto Russo <stefano.russo@gmail.com> Date: Fri, 5 Nov 2021 17:31:50 +0100 Subject: [PATCH] Fixes. --- .../core_app/management/commands/core_app_populate.py | 4 ++-- .../code/rosetta/core_app/templates/task_connect.html | 8 +++++--- services/webapp/code/rosetta/core_app/views.py | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/services/webapp/code/rosetta/core_app/management/commands/core_app_populate.py b/services/webapp/code/rosetta/core_app/management/commands/core_app_populate.py index 984295b..6b83541 100644 --- a/services/webapp/code/rosetta/core_app/management/commands/core_app_populate.py +++ b/services/webapp/code/rosetta/core_app/management/commands/core_app_populate.py @@ -126,7 +126,7 @@ class Command(BaseCommand): supports_custom_interface_port = True, supports_interface_auth = True) - # Jupyter Notebook + # SSH server Container.objects.create(user = None, name = 'SSH server', description = 'A SSH server supporting X forwarding as well.', @@ -136,7 +136,7 @@ class Command(BaseCommand): arch = 'x86_64', os = 'linux', interface_port = '22', - interface_protocol = 'http', + interface_protocol = 'ssh', interface_transport = 'tcp/ip', supports_custom_interface_port = True, supports_interface_auth = True) diff --git a/services/webapp/code/rosetta/core_app/templates/task_connect.html b/services/webapp/code/rosetta/core_app/templates/task_connect.html index b4cbda0..3c517f2 100644 --- a/services/webapp/code/rosetta/core_app/templates/task_connect.html +++ b/services/webapp/code/rosetta/core_app/templates/task_connect.html @@ -52,9 +52,11 @@ {% if data.task.container.interface_protocol == 'http' or data.task.container.interface_protocol == 'https' %} <input type='submit' style="width:110px" class="btn btn-lg btn-success btn-block" value='Log in' /> {% else %} - To connect, open the program suitable for this task interface protocol ({{data.task.container.interface_protocol}}) with:<br /> - IP: <code>{{ data.task.tcp_tunnel_host}}</code><br /> - Port: <code>{{ data.task.tcp_tunnel_port}}</code> + To connect, use a program suitable for this task interface protocol ({{data.task.container.interface_protocol}}) with:<br /> + <p style="margin-top:5px; line-height:1.8em"> + <b>Host:</b> <code>{{ data.task.tcp_tunnel_host}}</code><br /> + <b>Port:</b> <code>{{ data.task.tcp_tunnel_port}}</code> + </p> {% endif %} diff --git a/services/webapp/code/rosetta/core_app/views.py b/services/webapp/code/rosetta/core_app/views.py index 298c86d..685b60c 100644 --- a/services/webapp/code/rosetta/core_app/views.py +++ b/services/webapp/code/rosetta/core_app/views.py @@ -994,12 +994,14 @@ def task_connect(request): # Get the task - #task = Task.objects.get(uuid__startswith=short_uuid) task = Task.objects.get(uuid=task_uuid) if task.user != request.user: raise ErrorMessage('You do not have access to this task.') - + + # Ensure that the tunnel and proxy are set up + setup_tunnel_and_proxy(task) + data ={} data['task'] = task @@ -1020,7 +1022,7 @@ def direct_connection_handler(request, uuid): if task.user != request.user: raise ErrorMessage('You do not have access to this task.') - # First ensure that the tunnel and proxy are set up + # Ensure that the tunnel and proxy are set up setup_tunnel_and_proxy(task) # Get task and tunnel proxy host -- GitLab