X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/157497ea3a28fdbd4c1e6fa69d93f4dee5ae8c11..71f76a45195266c2d25a42c13b1419b000d60ffb:/apps/workbench/app/controllers/virtual_machines_controller.rb diff --git a/apps/workbench/app/controllers/virtual_machines_controller.rb b/apps/workbench/app/controllers/virtual_machines_controller.rb index a62ba81b09..764571c4c5 100644 --- a/apps/workbench/app/controllers/virtual_machines_controller.rb +++ b/apps/workbench/app/controllers/virtual_machines_controller.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class VirtualMachinesController < ApplicationController def index @objects ||= model_class.all @@ -19,4 +23,17 @@ class VirtualMachinesController < ApplicationController end super end + + def webshell + return render_not_found if Rails.configuration.Workbench.ShellInABoxURL == URI("") + webshell_url = URI(Rails.configuration.Workbench.ShellInABoxURL) + if webshell_url.host.index("*") != nil + webshell_url.host = webshell_url.host.sub("*", @object.hostname) + else + webshell_url.path = "/#{@object.hostname}" + end + @webshell_url = webshell_url.to_s + render layout: false + end + end