Merge branch 'KLuka-master'

This commit is contained in:
KLuka 2015-03-11 13:48:15 +01:00
commit 596776756d
24 changed files with 142 additions and 126 deletions

View file

@ -234,4 +234,3 @@ an Autoconf bug. Until the bug is fixed you can use this workaround:
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View file

@ -29,4 +29,3 @@ some tips on getting things working:
Make sure you assign the correct SELinux labels to this file when copying
it into "/etc/pam.d":
cp -Z system_u:object_r:etc_t:s0 etc-pam.d-shellinabox-example /etc/pam.d/

1
TODO
View file

@ -1,4 +1,3 @@
- Check if there is any way that we could fall back on gnutls if openssl is
unavailable
- Package for distributions other than Debian

View file

@ -8,7 +8,7 @@
# Short-Description: Shell In A Box Daemon
# Description: Daemon for publishing a login shell at
# http://localhost:SHELLINABOX_PORT
# where default port number is 4200.
# where default port number is 4200.
### END INIT INFO
# Authors: Markus Gutschke <markus@shellinabox.com>, Marc Singer <elf@buici.com>

View file

@ -1 +0,0 @@

View file

@ -6,23 +6,23 @@
<!--
ShellInABox - Make command line applications available as AJAX web applications
Copyright (C) 2008-2010 Markus Gutschke markus@shellinabox.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
In addition to these license terms, the author grants the following
additional rights:
If you modify this program, or any covered work, by linking or
combining it with the OpenSSL project's OpenSSL library (or a
modified version of that library), containing parts covered by the
@ -31,20 +31,20 @@
Corresponding Source for a non-source form of such a combination
shall include the source code for the parts of OpenSSL used as well
as that of the covered work.
You may at your option choose to remove this additional permission from
the work, or from any part of it.
It is possible to build this program in a way that it loads OpenSSL
libraries at run-time. If doing so, the following notices are required
by the OpenSSL and SSLeay licenses:
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. (http://www.openssl.org/)
This product includes cryptographic software written by Eric Young
(eay@cryptsoft.com)
The most up-to-date version of this program is always available from
http://shellinabox.com
-->

View file

@ -880,7 +880,7 @@ Demo.prototype.intrinsic = function() {
}
v = arg1.val().substr(arg1.val().length - v);
value = new this.Value(TYPE_STRING, v, v);
break;
break;
case 'STR$':
value = new this.Value(TYPE_STRING, arg1.toString(),
arg1.toString());
@ -909,7 +909,7 @@ Demo.prototype.intrinsic = function() {
v = String.fromCharCode(arg1.val());
value = new this.Value(TYPE_STRING, v, v);
break;
case 'SPC':
case 'SPC':
if (arg1.val() < 0) {
return this.error('Range error');
}
@ -1183,4 +1183,3 @@ Demo.prototype.Value.prototype.val = function() {
Demo.prototype.Value.prototype.toString = function() {
return this.s;
};

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="ShellInABox Demo" />
<Content type="url" href="http://shellinabox.googlecode.com/git/demo/demo.html" />

View file

@ -28,7 +28,7 @@
margin: 0px;
}
#print {
#print {
margin: 0px;
}

View file

@ -1,9 +1,9 @@
#vt100 a {
#vt100 a {
text-decoration: none;
color: inherit;
}
#vt100 a:hover {
#vt100 a:hover {
text-decoration: underline;
}
@ -12,7 +12,7 @@
z-index: 2;
}
#vt100 #reconnect input {
#vt100 #reconnect input {
padding: 1ex;
font-weight: bold;
font-size: x-large;
@ -29,7 +29,7 @@
z-index: 2;
}
#vt100 pre {
#vt100 pre {
margin: 0px;
}
@ -44,11 +44,11 @@
padding: 1px;
}
#vt100 #console, #vt100 #alt_console, #vt100 #cursor, #vt100 #lineheight, #vt100 .hidden pre {
#vt100 #console, #vt100 #alt_console, #vt100 #cursor, #vt100 #lineheight, #vt100 .hidden pre {
font-family: "DejaVu Sans Mono", "Everson Mono", FreeMono, "Andale Mono", monospace;
}
#vt100 #lineheight {
#vt100 #lineheight {
position: absolute;
visibility: hidden;
}
@ -75,7 +75,7 @@
margin: -1px;
}
#vt100 #padding {
#vt100 #padding {
visibility: hidden;
width: 1px;
height: 0px;
@ -90,7 +90,7 @@
height: 0px;
}
#vt100 #menu {
#vt100 #menu {
overflow: visible;
position: absolute;
z-index: 3;
@ -103,14 +103,14 @@
position: absolute;
}
#vt100 #menu .popup ul {
#vt100 #menu .popup ul {
list-style-type: none;
padding: 0px;
margin: 0px;
min-width: 10em;
}
#vt100 #menu .popup li {
#vt100 #menu .popup li {
padding: 3px 0.5ex 3px 0.5ex;
}
@ -123,11 +123,11 @@
color: #AAAAAA;
}
#vt100 #menu .popup hr {
#vt100 #menu .popup hr {
margin: 0.5ex 0px 0.5ex 0px;
}
#vt100 #menu img {
#vt100 #menu img {
margin-right: 0.5ex;
width: 1ex;
height: 1ex;
@ -136,7 +136,7 @@
#vt100 #scrollable.inverted { color: #ffffff;
background-color: #000000; }
#vt100 #kbd_button {
#vt100 #kbd_button {
float: left;
position: fixed;
z-index: 0;
@ -198,7 +198,7 @@
visibility: hidden;
}
#vt100 #keyboard .shifted {
#vt100 #keyboard .shifted {
display: none;
}
@ -218,15 +218,15 @@
display: none;
}
#vt100 #reconnect, #vt100 #cursor, #vt100 #menu, #vt100 #kbd_button, #vt100 #keyboard {
#vt100 #reconnect, #vt100 #cursor, #vt100 #menu, #vt100 #kbd_button, #vt100 #keyboard {
visibility: hidden;
}
#vt100 #scrollable {
#vt100 #scrollable {
overflow: hidden;
}
#vt100 #console, #vt100 #alt_console {
#vt100 #console, #vt100 #alt_console {
overflow: hidden;
width: 1000000ex;
}

View file

@ -1637,7 +1637,7 @@ int httpHandleConnection(struct ServerConnection *connection, void *http_,
}
}
}
// If the callback only provided partial data, refill the outgoing
// buffer whenever it runs low.
if (http->isPartialReply && (!http->msg || http->msgLength <= 0)) {
@ -1664,7 +1664,7 @@ int httpHandleConnection(struct ServerConnection *connection, void *http_,
http->msg = NULL;
http->msgLength = 0;
}
if ((!(*events || http->isSuspended) || timedOut) && http->sslHndl) {
*events = 0;
serverSetTimeout(connection, 1);

View file

@ -115,7 +115,7 @@ struct HttpHandler {
int (*websocketHandler)(struct HttpConnection *, void *, int,
const char *, int);
void *arg, *streamingArg;
};
struct HttpConnection *newHttpConnection(struct Server *server, int fd,

View file

@ -181,7 +181,7 @@ static int serverCollectFullPayload(struct HttpConnection *http,
free(payload);
}
return rc;
}
static int serverCollectHandler(struct HttpConnection *http, void *handler_) {

View file

@ -191,4 +191,3 @@ char *stringPrintfUnchecked(char *buf, const char *fmt, ...)
return s;
}
#endif

View file

@ -6,23 +6,23 @@
<!--
ShellInABox - Make command line applications available as AJAX web applications
Copyright (C) 2008-2009 Markus Gutschke markus@shellinabox.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
In addition to these license terms, the author grants the following
additional rights:
If you modify this program, or any covered work, by linking or
combining it with the OpenSSL project's OpenSSL library (or a
modified version of that library), containing parts covered by the
@ -31,20 +31,20 @@
Corresponding Source for a non-source form of such a combination
shall include the source code for the parts of OpenSSL used as well
as that of the covered work.
You may at your option choose to remove this additional permission from
the work, or from any part of it.
It is possible to build this program in a way that it loads OpenSSL
libraries at run-time. If doing so, the following notices are required
by the OpenSSL and SSLeay licenses:
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. (http://www.openssl.org/)
This product includes cryptographic software written by Eric Young
(eay@cryptsoft.com)
(eay@cryptsoft.com)
The most up-to-date version of this program is always available from
http://shellinabox.com
-->
@ -70,7 +70,7 @@
'<frame src="' + url + '#' +
encodeURIComponent(document.location.href) +
',%s' + '">\n' +
'</frameset>');
'</frameset>');
})();
--></script>
</head>

View file

@ -75,7 +75,7 @@ static int externalFileHttpHandler(HttpConnection *http, void *arg,
while (*pathInfo == '/') {
pathInfo++;
}
// Compute file name of external file
char *fn;
int s_size = strlen((char *)arg) +
@ -91,7 +91,7 @@ static int externalFileHttpHandler(HttpConnection *http, void *arg,
ptr++;
}
strncat(fn, ptr, s_size);
// Any files/directories starting with a dot are inaccessible to us
do {
if (*ptr == '.') {
@ -103,7 +103,7 @@ static int externalFileHttpHandler(HttpConnection *http, void *arg,
ptr = strchr(ptr + 1, '/');
} while (ptr);
}
// Open file for reading
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
@ -147,7 +147,7 @@ static int externalFileHttpHandler(HttpConnection *http, void *arg,
httpSendReply(http, 404, "File not found", NO_MSG);
return HTTP_DONE;
}
// We only serve regular files, and restrict the file size to 100MB.
// As a special-case, we also allow access to /dev/null.
struct stat sb = { 0 };
@ -161,7 +161,7 @@ static int externalFileHttpHandler(HttpConnection *http, void *arg,
return HTTP_DONE;
}
free(fn);
// Set up response header
char *response = stringPrintf(NULL,
"HTTP/1.1 200 OK\r\n"
@ -180,7 +180,7 @@ static int externalFileHttpHandler(HttpConnection *http, void *arg,
}
check(response = realloc(response, respLen + dataLen + 1));
bytes = NOINTR(read(fd, response + respLen, dataLen));
if (bytes < 0) {
free(response);
NOINTR(close(fd));
@ -188,7 +188,7 @@ static int externalFileHttpHandler(HttpConnection *http, void *arg,
return HTTP_DONE;
}
}
if (bytes < 0 || bytes == sb.st_size) {
// Read entire file. Transmit it in one go.
httpTransfer(http, response,
@ -199,7 +199,7 @@ static int externalFileHttpHandler(HttpConnection *http, void *arg,
// Transmit partial reply and store state for future calls into the
// handler.
httpTransferPartialReply(http, response, respLen + bytes);
check(state = malloc(sizeof(struct ExternalFileState)));
state->fd = fd;
state->totalSize = sb.st_size;

View file

@ -676,7 +676,7 @@ void destroyUtmp(struct Utmp *utmp) {
updwtmpx("/var/log/wtmp", &utmp->utmpx);
}
#endif
// Switch back to the lower privileges
check(!setresgid(r_gid, e_gid, s_gid));
check(!setresuid(r_uid, e_uid, s_uid));
@ -1576,7 +1576,7 @@ static void childProcess(struct Service *service, int width, int height,
// Change user and group ids
check(!setresgid(service->gid, service->gid, service->gid));
check(!setresuid(service->uid, service->uid, service->uid));
// Change working directory
if (service->useHomeDir) {
check(!service->useLogin);

View file

@ -28,7 +28,7 @@
margin: 0px;
}
#print {
#print {
margin: 0px;
}

View file

@ -6,23 +6,23 @@
<!--
ShellInABox - Make command line applications available as AJAX web applications
Copyright (C) 2008-2010 Markus Gutschke markus@shellinabox.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
In addition to these license terms, the author grants the following
additional rights:
If you modify this program, or any covered work, by linking or
combining it with the OpenSSL project's OpenSSL library (or a
modified version of that library), containing parts covered by the
@ -31,20 +31,20 @@
Corresponding Source for a non-source form of such a combination
shall include the source code for the parts of OpenSSL used as well
as that of the covered work.
You may at your option choose to remove this additional permission from
the work, or from any part of it.
It is possible to build this program in a way that it loads OpenSSL
libraries at run-time. If doing so, the following notices are required
by the OpenSSL and SSLeay licenses:
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. (http://www.openssl.org/)
This product includes cryptographic software written by Eric Young
(eay@cryptsoft.com)
(eay@cryptsoft.com)
The most up-to-date version of this program is always available from
http://shellinabox.com
-->

View file

@ -357,7 +357,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
}
}
}
};
ShellInABox.prototype.about = function() {
@ -373,4 +373,3 @@ ShellInABox.prototype.about = function() {
"Eric Young\n(eay@cryptsoft.com)" :
""));
};

View file

@ -243,7 +243,7 @@ static int completePendingRequest(struct Session *session,
data = jsonEscape(buf, len);
}
}
char *json = stringPrintf(NULL, "{"
"\"session\":\"%s\","
"\"data\":\"%s\""

View file

@ -199,7 +199,7 @@ In order to be useful as a CGI script, the
.B shellinaboxd
binary probably will have to be made
.BR setuid-root .
This is currently a discouraged configuration. Use with care.
This is currently a discouraged configuration. Use with care.
.TP
\fB-d\fP\ |\ \fB--debug\fP
Enables debugging mode, resulting in lots of log messages on
@ -292,7 +292,7 @@ mode, anything that looks like a hostname, URL or e-mail address is
recognized, even if not preceded by a protocol.
.TP
\fB--localhost-only\fP
Normally,
Normally,
.B shellinaboxd
listens on all available network interfaces. When operating behind a
reverse-proxy that is not always desirable. This command line option
@ -756,7 +756,7 @@ the daemon with \fBsudo service shellinabox restart\fP.
.TP
.I /etc/shellinabox
This directory contains style sheets that will be used for the
.B --user-css
.B --user-css
command line option, when running
.B shellinaboxd
as a system-wide service.

View file

@ -1,9 +1,9 @@
#vt100 a {
#vt100 a {
text-decoration: none;
color: inherit;
}
#vt100 a:hover {
#vt100 a:hover {
text-decoration: underline;
}
@ -12,7 +12,7 @@
z-index: 2;
}
#vt100 #reconnect input {
#vt100 #reconnect input {
padding: 1ex;
font-weight: bold;
font-size: x-large;
@ -29,7 +29,7 @@
z-index: 2;
}
#vt100 pre {
#vt100 pre {
margin: 0px;
}
@ -44,11 +44,11 @@
padding: 1px;
}
#vt100 #console, #vt100 #alt_console, #vt100 #cursor, #vt100 #lineheight, #vt100 .hidden pre {
#vt100 #console, #vt100 #alt_console, #vt100 #cursor, #vt100 #lineheight, #vt100 .hidden pre {
font-family: "DejaVu Sans Mono", "Everson Mono", FreeMono, "Andale Mono", monospace;
}
#vt100 #lineheight {
#vt100 #lineheight {
position: absolute;
visibility: hidden;
}
@ -75,7 +75,7 @@
margin: -1px;
}
#vt100 #padding {
#vt100 #padding {
visibility: hidden;
width: 1px;
height: 0px;
@ -90,7 +90,7 @@
height: 0px;
}
#vt100 #menu {
#vt100 #menu {
overflow: visible;
position: absolute;
z-index: 3;
@ -103,14 +103,14 @@
position: absolute;
}
#vt100 #menu .popup ul {
#vt100 #menu .popup ul {
list-style-type: none;
padding: 0px;
margin: 0px;
min-width: 10em;
}
#vt100 #menu .popup li {
#vt100 #menu .popup li {
padding: 3px 0.5ex 3px 0.5ex;
}
@ -123,11 +123,11 @@
color: #AAAAAA;
}
#vt100 #menu .popup hr {
#vt100 #menu .popup hr {
margin: 0.5ex 0px 0.5ex 0px;
}
#vt100 #menu img {
#vt100 #menu img {
margin-right: 0.5ex;
width: 1ex;
height: 1ex;
@ -136,7 +136,7 @@
#vt100 #scrollable.inverted { color: #ffffff;
background-color: #000000; }
#vt100 #kbd_button {
#vt100 #kbd_button {
float: left;
position: fixed;
z-index: 0;
@ -198,7 +198,7 @@
visibility: hidden;
}
#vt100 #keyboard .shifted {
#vt100 #keyboard .shifted {
display: none;
}
@ -257,15 +257,15 @@
display: none;
}
#vt100 #reconnect, #vt100 #cursor, #vt100 #menu, #vt100 #kbd_button, #vt100 #keyboard {
#vt100 #reconnect, #vt100 #cursor, #vt100 #menu, #vt100 #kbd_button, #vt100 #keyboard {
visibility: hidden;
}
#vt100 #scrollable {
#vt100 #scrollable {
overflow: hidden;
}
#vt100 #console, #vt100 #alt_console {
#vt100 #console, #vt100 #alt_console {
overflow: hidden;
width: 1000000ex;
}

View file

@ -285,6 +285,12 @@ VT100.prototype.getUserSettings = function() {
this.autoprint = true;
this.softKeyboard = false;
this.blinkingCursor = true;
this.disableAlt = false;
if (navigator.platform.indexOf("Mac") != -1) {
this.disableAlt = true;
}
if (this.visualBell) {
this.signature = Math.floor(16807*this.signature + 1) %
((1 << 31) - 1);
@ -309,13 +315,14 @@ VT100.prototype.getUserSettings = function() {
if (settings >= 0) {
settings = document.cookie.substr(settings + key.length).
replace(/([0-1]*).*/, "$1");
if (settings.length == 5 + (typeof userCSSList == 'undefined' ?
if (settings.length == 6 + (typeof userCSSList == 'undefined' ?
0 : userCSSList.length)) {
this.utfPreferred = settings.charAt(0) != '0';
this.visualBell = settings.charAt(1) != '0';
this.autoprint = settings.charAt(2) != '0';
this.softKeyboard = settings.charAt(3) != '0';
this.blinkingCursor = settings.charAt(4) != '0';
this.disableAlt = settings.charAt(5) != '0';
if (typeof userCSSList != 'undefined') {
for (var i = 0; i < userCSSList.length; ++i) {
userCSSList[i][2] = settings.charAt(i + 5) != '0';
@ -332,7 +339,8 @@ VT100.prototype.storeUserSettings = function() {
(this.visualBell ? '1' : '0') +
(this.autoprint ? '1' : '0') +
(this.softKeyboard ? '1' : '0') +
(this.blinkingCursor ? '1' : '0');
(this.blinkingCursor ? '1' : '0') +
(this.disableAlt ? '1' : '0');
if (typeof userCSSList != 'undefined') {
for (var i = 0; i < userCSSList.length; ++i) {
settings += userCSSList[i][2] ? '1' : '0';
@ -355,7 +363,7 @@ VT100.prototype.initializeUserCSSStyles = function() {
var label = userCSSList[i][0];
var newGroup = userCSSList[i][1];
var enabled = userCSSList[i][2];
// Add user style sheet to document
var style = document.createElement('link');
var id = document.createAttribute('id');
@ -373,7 +381,7 @@ VT100.prototype.initializeUserCSSStyles = function() {
document.getElementsByTagName('head')[0].appendChild(style);
style.disabled = !enabled;
}
// Add entry to menu
if (newGroup || i == userCSSList.length) {
if (beginOfGroup != 0 && (i - beginOfGroup > 1 || !wasSingleSel)) {
@ -580,7 +588,7 @@ VT100.prototype.addKeyBinding = function(elem, ch, key, CH, KEY) {
this.addListener(elem, 'mousedown',
function(vt100, elem, key) { return function(e) {
if ((e.which || e.button) == 1) {
if (vt100.lastSelectedKey) {
if (vt100.lastSelectedKey) {
vt100.lastSelectedKey.className= '';
}
// Highlight the key while the mouse button is held down.
@ -981,7 +989,7 @@ VT100.prototype.initializeElements = function(container) {
vt100.indicateSize = true;
};
}(this), 100);
this.addListener(window, 'resize',
this.addListener(window, 'resize',
function(vt100) {
return function() {
vt100.hideContextMenu();
@ -989,7 +997,7 @@ VT100.prototype.initializeElements = function(container) {
vt100.showCurrentSize();
}
}(this));
// Hide extra scrollbars attached to window
document.body.style.margin = '0px';
try { document.body.style.overflow ='hidden'; } catch (e) { }
@ -1676,7 +1684,7 @@ VT100.prototype.putString = function(x, y, text, color, style) {
this.insertBlankLine(yIdx);
}
line = console.childNodes[yIdx];
// If necessary, promote blank '\n' line to a <div> tag
if (line.tagName != 'DIV') {
var div = document.createElement('div');
@ -1720,7 +1728,7 @@ VT100.prototype.putString = function(x, y, text, color, style) {
s += ' ';
} while (xPos + s.length < x);
}
// If styles do not match, create a new <span>
var del = text.length - s.length + x - xPos;
if (oldColor != color ||
@ -1779,7 +1787,7 @@ VT100.prototype.putString = function(x, y, text, color, style) {
}
this.setTextContent(span, s);
// Delete all subsequent <span>'s that have just been overwritten
sibling = span.nextSibling;
while (del > 0 && sibling) {
@ -1794,7 +1802,7 @@ VT100.prototype.putString = function(x, y, text, color, style) {
break;
}
}
// Merge <span> with next sibling, if styles are identical
if (sibling && span.className == sibling.className &&
span.style.cssText == sibling.style.cssText) {
@ -1875,7 +1883,7 @@ VT100.prototype.putString = function(x, y, text, color, style) {
this.getTextContent(span));
line.removeChild(sibling);
}
// Prune white space from the end of the current line
span = line.lastChild;
while (span &&
@ -1956,7 +1964,7 @@ VT100.prototype.enableAlternateScreen = function(state) {
this.resizer();
return;
}
// We save the full state of the normal screen, when we switch away from it.
// But for the alternate screen, no saving is necessary. We always reset
// it when we switch to it.
@ -2202,7 +2210,7 @@ VT100.prototype.scrollRegion = function(x, y, w, h, incX, incY,
while (console.childNodes.length < this.terminalHeight) {
this.insertBlankLine(this.terminalHeight);
}
// Add new lines at bottom in order to force scrolling
for (var i = 0; i < y; i++) {
this.insertBlankLine(console.childNodes.length, color, style);
@ -2367,6 +2375,10 @@ VT100.prototype.toggleSoftKeyboard = function() {
this.keyboardImage.style.visibility = this.softKeyboard ? 'visible' : '';
};
VT100.prototype.toggleDisableAlt = function() {
this.disableAlt = !this.disableAlt;
};
VT100.prototype.deselectKeys = function(elem) {
if (elem && elem.className == 'selected') {
elem.className = '';
@ -2468,6 +2480,9 @@ VT100.prototype.showContextMenu = function(x, y) {
'<li>' +
(this.softKeyboard ? '<img src="enabled.gif" />' : '') +
'Onscreen Keyboard</li>' +
'<li>' +
(this.disableAlt ? '<img src="enabled.gif" />' : '') +
'Disable Alt Key</li>' +
'<li id="endconfig">' +
(this.blinkingCursor ? '<img src="enabled.gif" />' : '') +
'Blinking Cursor</li>'+
@ -2500,6 +2515,7 @@ VT100.prototype.showContextMenu = function(x, y) {
var actions = [ this.copyLast, p, this.pasteBrowserFnc, this.reset,
this.toggleUTF, this.toggleBell,
this.toggleSoftKeyboard,
this.toggleDisableAlt,
this.toggleCursorBlinking ];
// Actions for user CSS styles (if any)
@ -2561,7 +2577,7 @@ VT100.prototype.showContextMenu = function(x, y) {
this.menu.style.height = this.container.offsetHeight + 'px';
popup.style.left = '0px';
popup.style.top = '0px';
var margin = 2;
if (x + popup.clientWidth >= this.container.offsetWidth - margin) {
x = this.container.offsetWidth-popup.clientWidth - margin - 1;
@ -2649,7 +2665,7 @@ VT100.prototype.handleKey = function(event) {
ch = this.applyModifiers(ch, event);
// By this point, "ch" is either defined and contains the character code, or
// it is undefined and "key" defines the code of a function key
// it is undefined and "key" defines the code of a function key
if (ch != undefined) {
this.scrollable.scrollTop = this.numScrollbackLines *
this.cursorHeight + 1;
@ -2736,19 +2752,21 @@ VT100.prototype.handleKey = function(event) {
case 144: /* Num Lock */ return;
case 145: /* Scroll Lock */ return;
case 186: /* ; */ ch = this.applyModifiers(59, event); break;
case 187: /* = */ ch = this.applyModifiers(61, event); break;
// Conflicts with dead keys ` on Danish keyboard
// ¸ on Slovenian keyboard
// case 187: /* = */ ch = this.applyModifiers(61, event); break;
case 188: /* , */ ch = this.applyModifiers(44, event); break;
case 189: /* - */ ch = this.applyModifiers(45, event); break;
case 190: /* . */ ch = this.applyModifiers(46, event); break;
case 191: /* / */ ch = this.applyModifiers(47, event); break;
// Conflicts with dead key " on Swiss keyboards
//case 192: /* ` */ ch = this.applyModifiers(96, event); break;
// case 192: /* ` */ ch = this.applyModifiers(96, event); break;
// Conflicts with dead key " on Swiss keyboards
//case 219: /* [ */ ch = this.applyModifiers(91, event); break;
// case 219: /* [ */ ch = this.applyModifiers(91, event); break;
case 220: /* \ */ ch = this.applyModifiers(92, event); break;
// Conflicts with dead key ^ and ` on Swiss keaboards
// ^ and " on French keyboards
//case 221: /* ] */ ch = this.applyModifiers(93, event); break;
// case 221: /* ] */ ch = this.applyModifiers(93, event); break;
case 222: /* ' */ ch = this.applyModifiers(39, event); break;
default: return;
}
@ -2781,7 +2799,8 @@ VT100.prototype.handleKey = function(event) {
(event.altKey|event.metaKey ? 2 : 0) +
(event.ctrlKey ? 4 : 0)) +
part2;
} else if (ch.length == 1 && (event.altKey || event.metaKey)) {
} else if (ch.length == 1 && (event.altKey || event.metaKey)
&& !this.disableAlt) {
ch = '\u001B' + ch;
}
}
@ -2872,7 +2891,7 @@ VT100.prototype.fixEvent = function(event) {
case 61: /* = -> + */ u = 61; s = 43; break;
case 91: /* [ -> { */ u = 91; s = 123; break;
case 92: /* \ -> | */ u = 92; s = 124; break;
case 93: /* ] -> } */ u = 93; s = 125; break;
case 93: /* ] -> } */ u = 93; s = 125; break;
case 96: /* ` -> ~ */ u = 96; s = 126; break;
case 109: /* - -> _ */ u = 45; s = 95; break;
@ -2887,7 +2906,7 @@ VT100.prototype.fixEvent = function(event) {
case 192: /* ` -> ~ */ u = 96; s = 126; break;
case 219: /* [ -> { */ u = 91; s = 123; break;
case 220: /* \ -> | */ u = 92; s = 124; break;
case 221: /* ] -> } */ u = 93; s = 125; break;
case 221: /* ] -> } */ u = 93; s = 125; break;
case 222: /* ' -> " */ u = 39; s = 34; break;
default: break;
}
@ -2949,6 +2968,7 @@ VT100.prototype.keyDown = function(event) {
event.keyCode >= 160 && event.keyCode <= 185 || /* FF15 patch */
event.keyCode >= 186 && event.keyCode <= 191 ||
event.keyCode == 222 ||
event.keyCode == 229 ||
event.keyCode == 252;
try {
if (navigator.appName == 'Konqueror') {
@ -2957,6 +2977,10 @@ VT100.prototype.keyDown = function(event) {
} catch (e) {
}
if (this.disableAlt && normalKey) {
return true;
}
// We normally prefer to look at keypress events, as they perform the
// translation from keyCode to charCode. This is important, as the
// translation is locale-dependent.
@ -3602,7 +3626,7 @@ VT100.prototype.sendControlToPrinter = function(ch) {
break;
}
// Fall through
case ESgetpars:
case ESgetpars:
if (ch == 0x3B /*;*/) {
this.npar++;
break;
@ -3964,7 +3988,7 @@ VT100.prototype.doControl = function(ch) {
}
// Fall through
case ESdeviceattr:
case ESgetpars:
case ESgetpars:
/*;*/ if (ch == 0x3B) {
this.npar++;
break;
@ -4239,7 +4263,7 @@ VT100.prototype.vt100 = function(s) {
this.utfEnabled && ch >= 128 ||
!(this.dispCtrl ? this.ctrlAlways : this.ctrlAction)[ch & 0x1F]) &&
(ch != 0x7F || this.dispCtrl);
if (isNormalCharacter && this.isEsc == ESnormal) {
if (ch < 256) {
ch = this.translate[this.toggleMeta ? (ch | 0x80) : ch];
@ -4444,4 +4468,3 @@ VT100.prototype.ctrlAlways = [
false, false, false, false, false, false, false, false,
false, false, false, true, false, false, false, false
];