4 <link rel="stylesheet" href="styles.css" type="text/css">
5 <style type="text/css">
10 <script type="text/javascript"><!--
12 // We would like to hide overflowing lines as this can lead to
13 // visually jarring results if the browser substitutes oversized
14 // Unicode characters from different fonts. Unfortunately, a bug
15 // in Firefox prevents it from allowing multi-line text
16 // selections whenever we change the "overflow" style. So, only
17 // do so for non-Netscape browsers.
18 if (typeof navigator.appName == 'undefined' ||
19 navigator.appName != 'Netscape') {
20 document.write('<style type="text/css">' +
21 '#vt100 #console div, #vt100 #alt_console div {' +
22 ' overflow: hidden;' +
28 function login(username, token) {
29 const urlParams = new URLSearchParams(window.location.search);
30 var sh = new ShellInABox(urlParams.get('host'));
32 var findText = function(txt) {
33 var a = document.querySelectorAll("span.ansi0");
34 for (var i = 0; i < a.length; i++) {
35 if (a[i].textContent.indexOf(txt) > -1) {
42 var trySendToken = function() {
43 var token = urlParams.get('token');
45 history.replaceState(null, "", `/webshell/?host=${encodeURIComponent(urlParams.get('host'))}&login=${encodeURIComponent(urlParams.get('login'))}`)
46 } else if (localStorage.getItem('apiToken')) {
47 token = localStorage.getItem('apiToken');
51 // change this text when PAM is reconfigured to present a
52 // password prompt that we can wait for.
53 if (findText("assword:")) {
54 sh.keysPressed(token + "\n");
55 sh.vt100('(sent authentication token)\n');
58 setTimeout(trySendToken, 200);
62 var trySendLogin = function() {
63 var login = urlParams.get('login');
64 if (findText("login:")) {
65 sh.keysPressed(login + "\n");
66 // Make this wait shorter when PAM is reconfigured to
67 // present a password prompt that we can wait for.
68 setTimeout(trySendToken, 200);
70 setTimeout(trySendLogin, 200);
78 <script type="text/javascript" src="shell_in_a_box.js"></script>
80 <!-- Load ShellInABox from a timer as Konqueror sometimes fails to
81 correctly deal with the enclosing frameset (if any), if we do not
84 <body onload="setTimeout(login, 1000)"
85 scroll="no"><noscript>JavaScript must be enabled for ShellInABox</noscript>