18947: Remove errant uses of runsu.sh.
[arvados.git] / apps / workbench / app / views / virtual_machines / webshell.html.erb
1 <%# Copyright (C) The Arvados Authors. All rights reserved.
2
3 SPDX-License-Identifier: AGPL-3.0 %>
4
5 <html>
6     <title><%= @object.hostname %> / <%= Rails.configuration.Workbench.SiteName %></title>
7     <link rel="stylesheet" href="<%= asset_path 'webshell/styles.css' %>" type="text/css">
8     <style type="text/css">
9       body {
10         margin: 0px;
11       }
12     </style>
13     <script type="text/javascript"><!--
14       (function() {
15         // We would like to hide overflowing lines as this can lead to
16         // visually jarring results if the browser substitutes oversized
17         // Unicode characters from different fonts. Unfortunately, a bug
18         // in Firefox prevents it from allowing multi-line text
19         // selections whenever we change the "overflow" style. So, only
20         // do so for non-Netscape browsers.
21         if (typeof navigator.appName == 'undefined' ||
22             navigator.appName != 'Netscape') {
23           document.write('<style type="text/css">' +
24                          '#vt100 #console div, #vt100 #alt_console div {' +
25                          '  overflow: hidden;' +
26                          '}' +
27                          '</style>');
28         }
29       })();
30
31       function login(username, token) {
32         var sh = new ShellInABox("<%= j @webshell_url %>");
33
34         var findText = function(txt) {
35           var a = document.querySelectorAll("span.ansi0");
36           for (var i = 0; i < a.length; i++) {
37             if (a[i].textContent.indexOf(txt) > -1) {
38               return true;
39             }
40           }
41           return false;
42         }
43
44         var trySendToken = function() {
45           // change this text when PAM is reconfigured to present a
46           // password prompt that we can wait for.
47           if (findText("assword:")) {
48              sh.keysPressed("<%= j Thread.current[:arvados_api_token] %>\n");
49              sh.vt100('(sent authentication token)\n');
50           } else {
51             setTimeout(trySendToken, 200);
52           }
53         };
54
55         var trySendLogin = function() {
56           if (findText("login:")) {
57             sh.keysPressed("<%= j params[:login] %>\n");
58             // Make this wait shorter when PAM is reconfigured to
59             // present a password prompt that we can wait for.
60             setTimeout(trySendToken, 200);
61           } else {
62             setTimeout(trySendLogin, 200);
63           }
64         };
65
66         trySendLogin();
67       }
68     // -->
69 </script>
70     <script type="text/javascript" src="<%= asset_path 'webshell/shell_in_a_box.js' %>"></script>
71   </head>
72   <!-- Load ShellInABox from a timer as Konqueror sometimes fails to
73        correctly deal with the enclosing frameset (if any), if we do not
74        do this
75    -->
76 <body onload="setTimeout(login, 1000)"
77     scroll="no"><noscript>JavaScript must be enabled for ShellInABox</noscript>
78 </body>
79 </html>