1 <%# Copyright (C) The Arvados Authors. All rights reserved.
3 SPDX-License-Identifier: AGPL-3.0 %>
7 <title><%= @object.hostname %> / <%= Rails.configuration.Workbench.SiteName %></title>
8 <link rel="stylesheet" href="<%= asset_path 'webshell/styles.css' %>" type="text/css">
9 <style type="text/css">
14 <script type="text/javascript"><!--
16 // We would like to hide overflowing lines as this can lead to
17 // visually jarring results if the browser substitutes oversized
18 // Unicode characters from different fonts. Unfortunately, a bug
19 // in Firefox prevents it from allowing multi-line text
20 // selections whenever we change the "overflow" style. So, only
21 // do so for non-Netscape browsers.
22 if (typeof navigator.appName == 'undefined' ||
23 navigator.appName != 'Netscape') {
24 document.write('<style type="text/css">' +
25 '#vt100 #console div, #vt100 #alt_console div {' +
26 ' overflow: hidden;' +
32 function login(username, token) {
33 var sh = new ShellInABox("<%= j @webshell_url %>");
35 var findText = function(txt) {
36 var a = document.querySelectorAll("span.ansi0");
37 for (var i = 0; i < a.length; i++) {
38 if (a[i].textContent.indexOf(txt) > -1) {
45 var trySendToken = function() {
46 // change this text when PAM is reconfigured to present a
47 // password prompt that we can wait for.
48 if (findText("assword:")) {
49 sh.keysPressed("<%= j Thread.current[:arvados_api_token] %>\n");
50 sh.vt100('(sent authentication token)\n');
52 setTimeout(trySendToken, 200);
56 var trySendLogin = function() {
57 if (findText("login:")) {
58 sh.keysPressed("<%= j params[:login] %>\n");
59 // Make this wait shorter when PAM is reconfigured to
60 // present a password prompt that we can wait for.
61 setTimeout(trySendToken, 200);
63 setTimeout(trySendLogin, 200);
71 <script type="text/javascript" src="<%= asset_path 'webshell/shell_in_a_box.js' %>"></script>
73 <!-- Load ShellInABox from a timer as Konqueror sometimes fails to
74 correctly deal with the enclosing frameset (if any), if we do not
77 <body onload="setTimeout(login, 1000)"
78 scroll="no"><noscript>JavaScript must be enabled for ShellInABox</noscript>