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