Renamed the JavaScript source files to *.jspp and the pre-processed files
to *.js. Checked both versions of the file into SVN, so that users can directly access the preprocessed files, if they don't want to rebuild them. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@89 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
parent
ff6ffe7400
commit
2f6b0934ee
9 changed files with 3670 additions and 170 deletions
40
Makefile.am
40
Makefile.am
|
@ -16,6 +16,8 @@ dist_doc_DATA = AUTHORS \
|
||||||
README \
|
README \
|
||||||
TODO
|
TODO
|
||||||
EXTRA_DIST = shellinabox/shellinaboxd.man.in \
|
EXTRA_DIST = shellinabox/shellinaboxd.man.in \
|
||||||
|
shellinabox/shell_in_a_box.js \
|
||||||
|
shellinabox/vt100.js \
|
||||||
debian/README \
|
debian/README \
|
||||||
debian/changelog \
|
debian/changelog \
|
||||||
debian/compat \
|
debian/compat \
|
||||||
|
@ -66,8 +68,8 @@ shellinaboxd_SOURCES = shellinabox/shellinaboxd.c \
|
||||||
shellinabox/session.h \
|
shellinabox/session.h \
|
||||||
shellinabox/cgi_root.html \
|
shellinabox/cgi_root.html \
|
||||||
shellinabox/root_page.html \
|
shellinabox/root_page.html \
|
||||||
shellinabox/vt100.js \
|
shellinabox/vt100.jspp \
|
||||||
shellinabox/shell_in_a_box.js \
|
shellinabox/shell_in_a_box.jspp \
|
||||||
shellinabox/styles.css \
|
shellinabox/styles.css \
|
||||||
shellinabox/favicon.ico \
|
shellinabox/favicon.ico \
|
||||||
shellinabox/beep.wav \
|
shellinabox/beep.wav \
|
||||||
|
@ -79,11 +81,10 @@ shellinaboxd_LDFLAGS = -static
|
||||||
libtool: $(LIBTOOL_DEPS)
|
libtool: $(LIBTOOL_DEPS)
|
||||||
$(SHELL) ./config.status --recheck
|
$(SHELL) ./config.status --recheck
|
||||||
|
|
||||||
shellinaboxd.1: shellinabox/shellinaboxd.man.in $(top_srcdir)/config.h
|
shellinaboxd.1: shellinabox/shellinaboxd.man.in config.h
|
||||||
@src="${top_srcdir}/shellinabox/shellinaboxd.man.in"; \
|
@src="${top_srcdir}/shellinabox/shellinaboxd.man.in"; \
|
||||||
echo preprocess "$$src" '>'"$@"; \
|
echo preprocess "$$src" '>'"$@"; \
|
||||||
if [ `sed -e 's/^#define \([^ ]*\).*/\1/' -e t -e d \
|
if [ `sed -e 's/^#define \([^ ]*\).*/\1/' -e t -e d config.h | \
|
||||||
"${top_srcdir}/config.h" | \
|
|
||||||
egrep 'HAVE_OPENSSL_BIO_H|HAVE_OPENSSL_ERR_H|HAVE_OPENSSL_SSL_H'|\
|
egrep 'HAVE_OPENSSL_BIO_H|HAVE_OPENSSL_ERR_H|HAVE_OPENSSL_SSL_H'|\
|
||||||
wc -l` -eq 3 ]; then \
|
wc -l` -eq 3 ]; then \
|
||||||
sed -e '/^#ifdef *HAVE_OPENSSL$$/d' \
|
sed -e '/^#ifdef *HAVE_OPENSSL$$/d' \
|
||||||
|
@ -91,8 +92,7 @@ shellinaboxd.1: shellinabox/shellinaboxd.man.in $(top_srcdir)/config.h
|
||||||
else \
|
else \
|
||||||
sed -e '/^#ifdef *HAVE_OPENSSL$$/,/^#endif$$/d' "$$src" >"$@"; \
|
sed -e '/^#ifdef *HAVE_OPENSSL$$/,/^#endif$$/d' "$$src" >"$@"; \
|
||||||
fi; \
|
fi; \
|
||||||
if sed -e 's/^#define \([^ ]*\).*/\1/' -e t -e d \
|
if sed -e 's/^#define \([^ ]*\).*/\1/' -e t -e d config.h | \
|
||||||
"${top_srcdir}/config.h" | \
|
|
||||||
grep 'HAVE_SECURITY_PAM_APPL_H' >/dev/null 2>&1; then \
|
grep 'HAVE_SECURITY_PAM_APPL_H' >/dev/null 2>&1; then \
|
||||||
sed -e '/^#ifdef *HAVE_PAM$$/d' \
|
sed -e '/^#ifdef *HAVE_PAM$$/d' \
|
||||||
-e '/^#endif$$/d' "$$src" >"$@"; \
|
-e '/^#endif$$/d' "$$src" >"$@"; \
|
||||||
|
@ -190,22 +190,24 @@ clean-local:
|
||||||
|
|
||||||
shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
|
|
||||||
.js.o:
|
.jspp.js:
|
||||||
@$(ECHO) preprocess "$<" \| objcopy "$@"
|
@$(ECHO) preprocess "$<" "$@"
|
||||||
@trap 'rm -f "$@.pre"' EXIT INT TERM QUIT; \
|
@sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
|
||||||
sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
|
|
||||||
-e t \
|
-e t \
|
||||||
-e d "$<"`" \
|
-e d "$<"`" \
|
||||||
-e "s/^#/\/\/ #/" \
|
-e "s/^#/\/\/ #/" \
|
||||||
-e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \
|
-e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \
|
||||||
"$<" >"$@.pre" && \
|
"$<" >"$@"
|
||||||
objcopy \
|
|
||||||
|
.js.o:
|
||||||
|
@$(ECHO) objcopy "$<" "$@"
|
||||||
|
@objcopy \
|
||||||
-I binary `echo $(host_cpu) | \
|
-I binary `echo $(host_cpu) | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
echo ' -O elf32-i386 -B i386' || \
|
echo ' -O elf32-i386 -B i386' || \
|
||||||
echo ' -O elf64-x86-64 -B i386:x86-64'` \
|
echo ' -O elf64-x86-64 -B i386:x86-64'` \
|
||||||
`echo "$@" | sed \
|
`echo "$<" | sed \
|
||||||
-e 's/\(.*\/\)\([^.]*\)\([.].*\)/\1\2\3=\2 /' \
|
-e 's/\(.*\/\)\([^.]*\)\([.].*\)/\1\2.js=\2 /' \
|
||||||
-e 't0' \
|
-e 't0' \
|
||||||
-e 's/\([^.]*\)\([.].*\)/\1\2=\1 /' \
|
-e 's/\([^.]*\)\([.].*\)/\1\2=\1 /' \
|
||||||
-e 't0' \
|
-e 't0' \
|
||||||
|
@ -218,10 +220,10 @@ shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
-e 's/.\{53\}$$//' \
|
-e 's/.\{53\}$$//' \
|
||||||
-e 's/[/.]/_/g' \
|
-e 's/[/.]/_/g' \
|
||||||
-e 's/^/--redefine-sym _binary_/' \
|
-e 's/^/--redefine-sym _binary_/' \
|
||||||
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_pre_end\2End/' \
|
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_end\2End/' \
|
||||||
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_pre_start\2Start/' \
|
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_start\2Start/' \
|
||||||
-e 's/[^ ]*\([^=]*\)=[^ ]*/-N\1_pre_size/'` \
|
-e 's/[^ ]*\([^=]*\)=[^ ]*/-N\1_size/'` \
|
||||||
"$@.pre" "$@"
|
"$<" "$@"
|
||||||
|
|
||||||
.wav.o:
|
.wav.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@$(ECHO) objcopy "$<" "$@"
|
||||||
|
|
42
Makefile.in
42
Makefile.in
|
@ -254,6 +254,8 @@ dist_doc_DATA = AUTHORS \
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
EXTRA_DIST = shellinabox/shellinaboxd.man.in \
|
EXTRA_DIST = shellinabox/shellinaboxd.man.in \
|
||||||
|
shellinabox/shell_in_a_box.js \
|
||||||
|
shellinabox/vt100.js \
|
||||||
debian/README \
|
debian/README \
|
||||||
debian/changelog \
|
debian/changelog \
|
||||||
debian/compat \
|
debian/compat \
|
||||||
|
@ -308,8 +310,8 @@ shellinaboxd_SOURCES = shellinabox/shellinaboxd.c \
|
||||||
shellinabox/session.h \
|
shellinabox/session.h \
|
||||||
shellinabox/cgi_root.html \
|
shellinabox/cgi_root.html \
|
||||||
shellinabox/root_page.html \
|
shellinabox/root_page.html \
|
||||||
shellinabox/vt100.js \
|
shellinabox/vt100.jspp \
|
||||||
shellinabox/shell_in_a_box.js \
|
shellinabox/shell_in_a_box.jspp \
|
||||||
shellinabox/styles.css \
|
shellinabox/styles.css \
|
||||||
shellinabox/favicon.ico \
|
shellinabox/favicon.ico \
|
||||||
shellinabox/beep.wav \
|
shellinabox/beep.wav \
|
||||||
|
@ -323,7 +325,7 @@ all: config.h
|
||||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .css .html .ico .js .lo .o .obj .wav
|
.SUFFIXES: .c .css .html .ico .js .jspp .lo .o .obj .wav
|
||||||
am--refresh:
|
am--refresh:
|
||||||
@:
|
@:
|
||||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
|
@ -993,11 +995,10 @@ uninstall-man: uninstall-man1
|
||||||
libtool: $(LIBTOOL_DEPS)
|
libtool: $(LIBTOOL_DEPS)
|
||||||
$(SHELL) ./config.status --recheck
|
$(SHELL) ./config.status --recheck
|
||||||
|
|
||||||
shellinaboxd.1: shellinabox/shellinaboxd.man.in $(top_srcdir)/config.h
|
shellinaboxd.1: shellinabox/shellinaboxd.man.in config.h
|
||||||
@src="${top_srcdir}/shellinabox/shellinaboxd.man.in"; \
|
@src="${top_srcdir}/shellinabox/shellinaboxd.man.in"; \
|
||||||
echo preprocess "$$src" '>'"$@"; \
|
echo preprocess "$$src" '>'"$@"; \
|
||||||
if [ `sed -e 's/^#define \([^ ]*\).*/\1/' -e t -e d \
|
if [ `sed -e 's/^#define \([^ ]*\).*/\1/' -e t -e d config.h | \
|
||||||
"${top_srcdir}/config.h" | \
|
|
||||||
egrep 'HAVE_OPENSSL_BIO_H|HAVE_OPENSSL_ERR_H|HAVE_OPENSSL_SSL_H'|\
|
egrep 'HAVE_OPENSSL_BIO_H|HAVE_OPENSSL_ERR_H|HAVE_OPENSSL_SSL_H'|\
|
||||||
wc -l` -eq 3 ]; then \
|
wc -l` -eq 3 ]; then \
|
||||||
sed -e '/^#ifdef *HAVE_OPENSSL$$/d' \
|
sed -e '/^#ifdef *HAVE_OPENSSL$$/d' \
|
||||||
|
@ -1005,8 +1006,7 @@ shellinaboxd.1: shellinabox/shellinaboxd.man.in $(top_srcdir)/config.h
|
||||||
else \
|
else \
|
||||||
sed -e '/^#ifdef *HAVE_OPENSSL$$/,/^#endif$$/d' "$$src" >"$@"; \
|
sed -e '/^#ifdef *HAVE_OPENSSL$$/,/^#endif$$/d' "$$src" >"$@"; \
|
||||||
fi; \
|
fi; \
|
||||||
if sed -e 's/^#define \([^ ]*\).*/\1/' -e t -e d \
|
if sed -e 's/^#define \([^ ]*\).*/\1/' -e t -e d config.h | \
|
||||||
"${top_srcdir}/config.h" | \
|
|
||||||
grep 'HAVE_SECURITY_PAM_APPL_H' >/dev/null 2>&1; then \
|
grep 'HAVE_SECURITY_PAM_APPL_H' >/dev/null 2>&1; then \
|
||||||
sed -e '/^#ifdef *HAVE_PAM$$/d' \
|
sed -e '/^#ifdef *HAVE_PAM$$/d' \
|
||||||
-e '/^#endif$$/d' "$$src" >"$@"; \
|
-e '/^#endif$$/d' "$$src" >"$@"; \
|
||||||
|
@ -1104,22 +1104,24 @@ clean-local:
|
||||||
|
|
||||||
shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
|
|
||||||
.js.o:
|
.jspp.js:
|
||||||
@$(ECHO) preprocess "$<" \| objcopy "$@"
|
@$(ECHO) preprocess "$<" "$@"
|
||||||
@trap 'rm -f "$@.pre"' EXIT INT TERM QUIT; \
|
@sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
|
||||||
sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
|
|
||||||
-e t \
|
-e t \
|
||||||
-e d "$<"`" \
|
-e d "$<"`" \
|
||||||
-e "s/^#/\/\/ #/" \
|
-e "s/^#/\/\/ #/" \
|
||||||
-e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \
|
-e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \
|
||||||
"$<" >"$@.pre" && \
|
"$<" >"$@"
|
||||||
objcopy \
|
|
||||||
|
.js.o:
|
||||||
|
@$(ECHO) objcopy "$<" "$@"
|
||||||
|
@objcopy \
|
||||||
-I binary `echo $(host_cpu) | \
|
-I binary `echo $(host_cpu) | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
echo ' -O elf32-i386 -B i386' || \
|
echo ' -O elf32-i386 -B i386' || \
|
||||||
echo ' -O elf64-x86-64 -B i386:x86-64'` \
|
echo ' -O elf64-x86-64 -B i386:x86-64'` \
|
||||||
`echo "$@" | sed \
|
`echo "$<" | sed \
|
||||||
-e 's/\(.*\/\)\([^.]*\)\([.].*\)/\1\2\3=\2 /' \
|
-e 's/\(.*\/\)\([^.]*\)\([.].*\)/\1\2.js=\2 /' \
|
||||||
-e 't0' \
|
-e 't0' \
|
||||||
-e 's/\([^.]*\)\([.].*\)/\1\2=\1 /' \
|
-e 's/\([^.]*\)\([.].*\)/\1\2=\1 /' \
|
||||||
-e 't0' \
|
-e 't0' \
|
||||||
|
@ -1132,10 +1134,10 @@ shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
-e 's/.\{53\}$$//' \
|
-e 's/.\{53\}$$//' \
|
||||||
-e 's/[/.]/_/g' \
|
-e 's/[/.]/_/g' \
|
||||||
-e 's/^/--redefine-sym _binary_/' \
|
-e 's/^/--redefine-sym _binary_/' \
|
||||||
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_pre_end\2End/' \
|
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_end\2End/' \
|
||||||
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_pre_start\2Start/' \
|
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_start\2Start/' \
|
||||||
-e 's/[^ ]*\([^=]*\)=[^ ]*/-N\1_pre_size/'` \
|
-e 's/[^ ]*\([^=]*\)=[^ ]*/-N\1_size/'` \
|
||||||
"$@.pre" "$@"
|
"$<" "$@"
|
||||||
|
|
||||||
.wav.o:
|
.wav.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@$(ECHO) objcopy "$<" "$@"
|
||||||
|
|
2
config.h
2
config.h
|
@ -95,7 +95,7 @@
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
/* Most recent revision number in the version control system */
|
/* Most recent revision number in the version control system */
|
||||||
#define VCS_REVISION "88"
|
#define VCS_REVISION "89"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "2.5"
|
#define VERSION "2.5"
|
||||||
|
|
2
configure
vendored
2
configure
vendored
|
@ -2055,7 +2055,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
||||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
VCS_REVISION=88
|
VCS_REVISION=89
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
|
|
@ -2,7 +2,7 @@ AC_PREREQ(2.57)
|
||||||
|
|
||||||
dnl This is the one location where the authoritative version number is stored
|
dnl This is the one location where the authoritative version number is stored
|
||||||
AC_INIT(shellinabox, 2.5, markus@shellinabox.com)
|
AC_INIT(shellinabox, 2.5, markus@shellinabox.com)
|
||||||
VCS_REVISION=88
|
VCS_REVISION=89
|
||||||
AC_SUBST(VCS_REVISION)
|
AC_SUBST(VCS_REVISION)
|
||||||
AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
|
AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
|
||||||
[Most recent revision number in the version control system])
|
[Most recent revision number in the version control system])
|
||||||
|
|
|
@ -63,11 +63,11 @@
|
||||||
// If in doubt, consult a legal professional familiar with the laws that
|
// If in doubt, consult a legal professional familiar with the laws that
|
||||||
// apply in your country.
|
// apply in your country.
|
||||||
|
|
||||||
#define XHR_UNITIALIZED 0
|
// #define XHR_UNITIALIZED 0
|
||||||
#define XHR_OPEN 1
|
// #define XHR_OPEN 1
|
||||||
#define XHR_SENT 2
|
// #define XHR_SENT 2
|
||||||
#define XHR_RECEIVING 3
|
// #define XHR_RECEIVING 3
|
||||||
#define XHR_LOADED 4
|
// #define XHR_LOADED 4
|
||||||
|
|
||||||
// IE does not define XMLHttpRequest by default, so we provide a suitable
|
// IE does not define XMLHttpRequest by default, so we provide a suitable
|
||||||
// wrapper.
|
// wrapper.
|
||||||
|
@ -184,7 +184,7 @@ ShellInABox.prototype.sendRequest = function(request) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ShellInABox.prototype.onReadyStateChange = function(request) {
|
ShellInABox.prototype.onReadyStateChange = function(request) {
|
||||||
if (request.readyState == XHR_LOADED) {
|
if (request.readyState == 4 /* XHR_LOADED */) {
|
||||||
if (request.status == 200) {
|
if (request.status == 200) {
|
||||||
this.connected = true;
|
this.connected = true;
|
||||||
var response = eval('(' + request.responseText + ')');
|
var response = eval('(' + request.responseText + ')');
|
||||||
|
@ -241,7 +241,7 @@ ShellInABox.prototype.sendKeys = function(keys) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ShellInABox.prototype.keyPressReadyStateChange = function(request) {
|
ShellInABox.prototype.keyPressReadyStateChange = function(request) {
|
||||||
if (request.readyState == XHR_LOADED) {
|
if (request.readyState == 4 /* XHR_LOADED */) {
|
||||||
this.keysInFlight = false;
|
this.keysInFlight = false;
|
||||||
if (this.pendingKeys) {
|
if (this.pendingKeys) {
|
||||||
this.sendKeys('');
|
this.sendKeys('');
|
||||||
|
@ -355,7 +355,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ShellInABox.prototype.about = function() {
|
ShellInABox.prototype.about = function() {
|
||||||
alert("Shell In A Box version " + VERSION +
|
alert("Shell In A Box version " + "2.5 (revision 88)" +
|
||||||
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
||||||
"For more information check http://shellinabox.com" +
|
"For more information check http://shellinabox.com" +
|
||||||
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
|
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
|
||||||
|
|
370
shellinabox/shell_in_a_box.jspp
Normal file
370
shellinabox/shell_in_a_box.jspp
Normal file
|
@ -0,0 +1,370 @@
|
||||||
|
// ShellInABox.js -- Use XMLHttpRequest to provide an AJAX terminal emulator.
|
||||||
|
// 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
|
||||||
|
// terms of the OpenSSL or SSLeay licenses, the author
|
||||||
|
// grants you additional permission to convey the resulting work.
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
//
|
||||||
|
// The author believes that for the purposes of this license, you meet the
|
||||||
|
// requirements for publishing the source code, if your web server publishes
|
||||||
|
// the source in unmodified form (i.e. with licensing information, comments,
|
||||||
|
// formatting, and identifier names intact). If there are technical reasons
|
||||||
|
// that require you to make changes to the source code when serving the
|
||||||
|
// JavaScript (e.g to remove pre-processor directives from the source), these
|
||||||
|
// changes should be done in a reversible fashion.
|
||||||
|
//
|
||||||
|
// The author does not consider websites that reference this script in
|
||||||
|
// unmodified form, and web servers that serve this script in unmodified form
|
||||||
|
// to be derived works. As such, they are believed to be outside of the
|
||||||
|
// scope of this license and not subject to the rights or restrictions of the
|
||||||
|
// GNU General Public License.
|
||||||
|
//
|
||||||
|
// If in doubt, consult a legal professional familiar with the laws that
|
||||||
|
// apply in your country.
|
||||||
|
|
||||||
|
#define XHR_UNITIALIZED 0
|
||||||
|
#define XHR_OPEN 1
|
||||||
|
#define XHR_SENT 2
|
||||||
|
#define XHR_RECEIVING 3
|
||||||
|
#define XHR_LOADED 4
|
||||||
|
|
||||||
|
// IE does not define XMLHttpRequest by default, so we provide a suitable
|
||||||
|
// wrapper.
|
||||||
|
if (typeof XMLHttpRequest == 'undefined') {
|
||||||
|
XMLHttpRequest = function() {
|
||||||
|
try { return new ActiveXObject('Msxml2.XMLHTTP.6.0');} catch (e) { }
|
||||||
|
try { return new ActiveXObject('Msxml2.XMLHTTP.3.0');} catch (e) { }
|
||||||
|
try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { }
|
||||||
|
try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) { }
|
||||||
|
throw new Error('');
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function extend(subClass, baseClass) {
|
||||||
|
function inheritance() { }
|
||||||
|
inheritance.prototype = baseClass.prototype;
|
||||||
|
subClass.prototype = new inheritance();
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.prototype.superClass = baseClass.prototype;
|
||||||
|
};
|
||||||
|
|
||||||
|
function ShellInABox(url, container) {
|
||||||
|
if (url == undefined) {
|
||||||
|
this.url = document.location.href.replace(/[?#].*/, '');
|
||||||
|
} else {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
if (document.location.hash != '') {
|
||||||
|
var hash = decodeURIComponent(document.location.hash).
|
||||||
|
replace(/^#/, '');
|
||||||
|
this.nextUrl = hash.replace(/,.*/, '');
|
||||||
|
this.session = hash.replace(/[^,]*,/, '');
|
||||||
|
} else {
|
||||||
|
this.nextUrl = this.url;
|
||||||
|
this.session = null;
|
||||||
|
}
|
||||||
|
this.pendingKeys = '';
|
||||||
|
this.keysInFlight = false;
|
||||||
|
this.connected = false;
|
||||||
|
this.superClass.constructor.call(this, container);
|
||||||
|
|
||||||
|
// We have to initiate the first XMLHttpRequest from a timer. Otherwise,
|
||||||
|
// Chrome never realizes that the page has loaded.
|
||||||
|
setTimeout(function(shellInABox) {
|
||||||
|
return function() {
|
||||||
|
shellInABox.sendRequest();
|
||||||
|
};
|
||||||
|
}(this), 1);
|
||||||
|
};
|
||||||
|
extend(ShellInABox, VT100);
|
||||||
|
|
||||||
|
ShellInABox.prototype.sessionClosed = function() {
|
||||||
|
try {
|
||||||
|
this.connected = false;
|
||||||
|
if (this.session) {
|
||||||
|
this.session = undefined;
|
||||||
|
if (this.cursorX > 0) {
|
||||||
|
this.vt100('\r\n');
|
||||||
|
}
|
||||||
|
this.vt100('Session closed.');
|
||||||
|
}
|
||||||
|
this.showReconnect(true);
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.reconnect = function() {
|
||||||
|
this.showReconnect(false);
|
||||||
|
if (!this.session) {
|
||||||
|
if (document.location.hash != '') {
|
||||||
|
// A shellinaboxd daemon launched from a CGI only allows a single
|
||||||
|
// session. In order to reconnect, we must reload the frame definition
|
||||||
|
// and obtain a new port number. As this is a different origin, we
|
||||||
|
// need to get enclosing page to help us.
|
||||||
|
parent.location = this.nextUrl;
|
||||||
|
} else {
|
||||||
|
if (this.url != this.nextUrl) {
|
||||||
|
document.location.replace(this.nextUrl);
|
||||||
|
} else {
|
||||||
|
this.pendingKeys = '';
|
||||||
|
this.keysInFlight = false;
|
||||||
|
this.reset(true);
|
||||||
|
this.sendRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.sendRequest = function(request) {
|
||||||
|
if (request == undefined) {
|
||||||
|
request = new XMLHttpRequest();
|
||||||
|
}
|
||||||
|
request.open('POST', this.url + '?', true);
|
||||||
|
request.setRequestHeader('Cache-Control', 'no-cache');
|
||||||
|
request.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded; charset=utf-8');
|
||||||
|
var content = 'width=' + this.terminalWidth +
|
||||||
|
'&height=' + this.terminalHeight +
|
||||||
|
(this.session ? '&session=' +
|
||||||
|
encodeURIComponent(this.session) : '');
|
||||||
|
request.setRequestHeader('Content-Length', content.length);
|
||||||
|
|
||||||
|
request.onreadystatechange = function(shellInABox) {
|
||||||
|
return function() {
|
||||||
|
try {
|
||||||
|
return shellInABox.onReadyStateChange(request);
|
||||||
|
} catch (e) {
|
||||||
|
shellInABox.sessionClosed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}(this);
|
||||||
|
request.send(content);
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.onReadyStateChange = function(request) {
|
||||||
|
if (request.readyState == XHR_LOADED) {
|
||||||
|
if (request.status == 200) {
|
||||||
|
this.connected = true;
|
||||||
|
var response = eval('(' + request.responseText + ')');
|
||||||
|
if (response.data) {
|
||||||
|
this.vt100(response.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.session ||
|
||||||
|
this.session && this.session != response.session) {
|
||||||
|
this.sessionClosed();
|
||||||
|
} else {
|
||||||
|
this.session = response.session;
|
||||||
|
this.sendRequest(request);
|
||||||
|
}
|
||||||
|
} else if (request.status == 0) {
|
||||||
|
// Time Out
|
||||||
|
this.sendRequest(request);
|
||||||
|
} else {
|
||||||
|
this.sessionClosed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.sendKeys = function(keys) {
|
||||||
|
if (!this.connected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.keysInFlight || this.session == undefined) {
|
||||||
|
this.pendingKeys += keys;
|
||||||
|
} else {
|
||||||
|
this.keysInFlight = true;
|
||||||
|
keys = this.pendingKeys + keys;
|
||||||
|
this.pendingKeys = '';
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
request.open('POST', this.url + '?', true);
|
||||||
|
request.setRequestHeader('Cache-Control', 'no-cache');
|
||||||
|
request.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded; charset=utf-8');
|
||||||
|
var content = 'width=' + this.terminalWidth +
|
||||||
|
'&height=' + this.terminalHeight +
|
||||||
|
'&session=' +encodeURIComponent(this.session)+
|
||||||
|
'&keys=' + encodeURIComponent(keys);
|
||||||
|
request.setRequestHeader('Content-Length', content.length);
|
||||||
|
request.onreadystatechange = function(shellInABox) {
|
||||||
|
return function() {
|
||||||
|
try {
|
||||||
|
return shellInABox.keyPressReadyStateChange(request);
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}(this);
|
||||||
|
request.send(content);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.keyPressReadyStateChange = function(request) {
|
||||||
|
if (request.readyState == XHR_LOADED) {
|
||||||
|
this.keysInFlight = false;
|
||||||
|
if (this.pendingKeys) {
|
||||||
|
this.sendKeys('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.keysPressed = function(ch) {
|
||||||
|
var hex = '0123456789ABCDEF';
|
||||||
|
var s = '';
|
||||||
|
for (var i = 0; i < ch.length; i++) {
|
||||||
|
var c = ch.charCodeAt(i);
|
||||||
|
if (c < 128) {
|
||||||
|
s += hex.charAt(c >> 4) + hex.charAt(c & 0xF);
|
||||||
|
} else if (c < 0x800) {
|
||||||
|
s += hex.charAt(0xC + (c >> 10) ) +
|
||||||
|
hex.charAt( (c >> 6) & 0xF ) +
|
||||||
|
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
||||||
|
hex.charAt( c & 0xF );
|
||||||
|
} else if (c < 0x10000) {
|
||||||
|
s += 'E' +
|
||||||
|
hex.charAt( (c >> 12) ) +
|
||||||
|
hex.charAt(0x8 + (c >> 10) & 0x3 ) +
|
||||||
|
hex.charAt( (c >> 6) & 0xF ) +
|
||||||
|
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
||||||
|
hex.charAt( c & 0xF );
|
||||||
|
} else if (c < 0x110000) {
|
||||||
|
s += 'F' +
|
||||||
|
hex.charAt( (c >> 18) ) +
|
||||||
|
hex.charAt(0x8 + (c >> 16) & 0x3 ) +
|
||||||
|
hex.charAt( (c >> 12) & 0xF ) +
|
||||||
|
hex.charAt(0x8 + (c >> 10) & 0x3 ) +
|
||||||
|
hex.charAt( (c >> 6) & 0xF ) +
|
||||||
|
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
||||||
|
hex.charAt( c & 0xF );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.sendKeys(s);
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.resized = function(w, h) {
|
||||||
|
// Do not send a resize request until we are fully initialized.
|
||||||
|
if (this.session) {
|
||||||
|
// sendKeys() always transmits the current terminal size. So, flush all
|
||||||
|
// pending keys.
|
||||||
|
this.sendKeys('');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.toggleSSL = function() {
|
||||||
|
if (document.location.hash != '') {
|
||||||
|
if (this.nextUrl.match(/\?plain$/)) {
|
||||||
|
this.nextUrl = this.nextUrl.replace(/\?plain$/, '');
|
||||||
|
} else {
|
||||||
|
this.nextUrl = this.nextUrl.replace(/[?#].*/, '') + '?plain';
|
||||||
|
}
|
||||||
|
if (!this.session) {
|
||||||
|
parent.location = this.nextUrl;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.nextUrl = this.nextUrl.match(/^https:/)
|
||||||
|
? this.nextUrl.replace(/^https:/, 'http:').replace(/\/*$/, '/plain')
|
||||||
|
: this.nextUrl.replace(/^http/, 'https').replace(/\/*plain$/, '');
|
||||||
|
}
|
||||||
|
if (this.nextUrl.match(/^[:]*:\/\/[^/]*$/)) {
|
||||||
|
this.nextUrl += '/';
|
||||||
|
}
|
||||||
|
if (this.session && this.nextUrl != this.url) {
|
||||||
|
alert('This change will take effect the next time you login.');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.extendContextMenu = function(entries, actions) {
|
||||||
|
// Modify the entries and actions in place, adding any locally defined
|
||||||
|
// menu entries.
|
||||||
|
var oldActions = [ ];
|
||||||
|
for (var i = 0; i < actions.length; i++) {
|
||||||
|
oldActions[i] = actions[i];
|
||||||
|
}
|
||||||
|
for (var node = entries.firstChild, i = 0, j = 0; node;
|
||||||
|
node = node.nextSibling) {
|
||||||
|
if (node.tagName == 'LI') {
|
||||||
|
actions[i++] = oldActions[j++];
|
||||||
|
if (node.id == "endconfig") {
|
||||||
|
node.id = '';
|
||||||
|
if (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL &&
|
||||||
|
!(typeof disableSSLMenu != 'undefined' && disableSSLMenu)) {
|
||||||
|
// If the server supports both SSL and plain text connections,
|
||||||
|
// provide a menu entry to switch between the two.
|
||||||
|
var newNode = document.createElement('li');
|
||||||
|
var isSecure;
|
||||||
|
if (document.location.href != '') {
|
||||||
|
isSecure = !this.nextUrl.match(/\?plain$/);
|
||||||
|
} else {
|
||||||
|
isSecure = this.nextUrl.match(/^https:/);
|
||||||
|
}
|
||||||
|
newNode.innerHTML = (isSecure ? '✔ ' : '') + 'Secure';
|
||||||
|
if (node.nextSibling) {
|
||||||
|
entries.insertBefore(newNode, node.nextSibling);
|
||||||
|
} else {
|
||||||
|
entries.appendChild(newNode);
|
||||||
|
}
|
||||||
|
actions[i++] = this.toggleSSL;
|
||||||
|
node = newNode;
|
||||||
|
}
|
||||||
|
node.id = 'endconfig';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
ShellInABox.prototype.about = function() {
|
||||||
|
alert("Shell In A Box version " + VERSION +
|
||||||
|
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
||||||
|
"For more information check http://shellinabox.com" +
|
||||||
|
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
|
||||||
|
"\n\n" +
|
||||||
|
"This product includes software developed by the OpenSSL Project\n" +
|
||||||
|
"for use in the OpenSSL Toolkit. (http://www.openssl.org/)\n" +
|
||||||
|
"\n" +
|
||||||
|
"This product includes cryptographic software written by " +
|
||||||
|
"Eric Young\n(eay@cryptsoft.com)" :
|
||||||
|
""));
|
||||||
|
};
|
||||||
|
|
|
@ -63,37 +63,37 @@
|
||||||
// If in doubt, consult a legal professional familiar with the laws that
|
// If in doubt, consult a legal professional familiar with the laws that
|
||||||
// apply in your country.
|
// apply in your country.
|
||||||
|
|
||||||
#define ESnormal 0
|
// #define ESnormal 0
|
||||||
#define ESesc 1
|
// #define ESesc 1
|
||||||
#define ESsquare 2
|
// #define ESsquare 2
|
||||||
#define ESgetpars 3
|
// #define ESgetpars 3
|
||||||
#define ESgotpars 4
|
// #define ESgotpars 4
|
||||||
#define ESdeviceattr 5
|
// #define ESdeviceattr 5
|
||||||
#define ESfunckey 6
|
// #define ESfunckey 6
|
||||||
#define EShash 7
|
// #define EShash 7
|
||||||
#define ESsetG0 8
|
// #define ESsetG0 8
|
||||||
#define ESsetG1 9
|
// #define ESsetG1 9
|
||||||
#define ESsetG2 10
|
// #define ESsetG2 10
|
||||||
#define ESsetG3 11
|
// #define ESsetG3 11
|
||||||
#define ESbang 12
|
// #define ESbang 12
|
||||||
#define ESpercent 13
|
// #define ESpercent 13
|
||||||
#define ESignore 14
|
// #define ESignore 14
|
||||||
#define ESnonstd 15
|
// #define ESnonstd 15
|
||||||
#define ESpalette 16
|
// #define ESpalette 16
|
||||||
#define ESstatus 17
|
// #define ESstatus 17
|
||||||
#define ESss2 18
|
// #define ESss2 18
|
||||||
#define ESss3 19
|
// #define ESss3 19
|
||||||
|
|
||||||
#define ATTR_DEFAULT 0x00F0
|
// #define ATTR_DEFAULT 0x00F0
|
||||||
#define ATTR_REVERSE 0x0100
|
// #define ATTR_REVERSE 0x0100
|
||||||
#define ATTR_UNDERLINE 0x0200
|
// #define ATTR_UNDERLINE 0x0200
|
||||||
#define ATTR_DIM 0x0400
|
// #define ATTR_DIM 0x0400
|
||||||
#define ATTR_BRIGHT 0x0800
|
// #define ATTR_BRIGHT 0x0800
|
||||||
#define ATTR_BLINK 0x1000
|
// #define ATTR_BLINK 0x1000
|
||||||
|
|
||||||
#define MOUSE_DOWN 0
|
// #define MOUSE_DOWN 0
|
||||||
#define MOUSE_UP 1
|
// #define MOUSE_UP 1
|
||||||
#define MOUSE_CLICK 2
|
// #define MOUSE_CLICK 2
|
||||||
|
|
||||||
function VT100(container) {
|
function VT100(container) {
|
||||||
this.initializeElements(container);
|
this.initializeElements(container);
|
||||||
|
@ -116,7 +116,7 @@ function VT100(container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
VT100.prototype.reset = function(clearHistory) {
|
VT100.prototype.reset = function(clearHistory) {
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
this.needWrap = false;
|
this.needWrap = false;
|
||||||
this.autoWrapMode = true;
|
this.autoWrapMode = true;
|
||||||
this.dispCtrl = false;
|
this.dispCtrl = false;
|
||||||
|
@ -134,7 +134,7 @@ VT100.prototype.reset = function(clearHistory) {
|
||||||
this.utfCount = 0;
|
this.utfCount = 0;
|
||||||
this.utfChar = 0;
|
this.utfChar = 0;
|
||||||
this.style = '';
|
this.style = '';
|
||||||
this.attr = ATTR_DEFAULT;
|
this.attr = 0x00F0 /* ATTR_DEFAULT */;
|
||||||
this.useGMap = 0;
|
this.useGMap = 0;
|
||||||
this.GMap = [ this.Latin1Map,
|
this.GMap = [ this.Latin1Map,
|
||||||
this.VT100GraphicsMap,
|
this.VT100GraphicsMap,
|
||||||
|
@ -383,9 +383,9 @@ VT100.prototype.initializeElements = function(container) {
|
||||||
return vt100.mouseEvent(e, type);
|
return vt100.mouseEvent(e, type);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
this.addListener(this.scrollable,'mousedown',mouseEvent(this, MOUSE_DOWN));
|
this.addListener(this.scrollable,'mousedown',mouseEvent(this, 0 /* MOUSE_DOWN */));
|
||||||
this.addListener(this.scrollable,'mouseup', mouseEvent(this, MOUSE_UP));
|
this.addListener(this.scrollable,'mouseup', mouseEvent(this, 1 /* MOUSE_UP */));
|
||||||
this.addListener(this.scrollable,'click', mouseEvent(this, MOUSE_CLICK));
|
this.addListener(this.scrollable,'click', mouseEvent(this, 2 /* MOUSE_CLICK */));
|
||||||
|
|
||||||
// Initialize the blank terminal window.
|
// Initialize the blank terminal window.
|
||||||
this.currentScreen = 0;
|
this.currentScreen = 0;
|
||||||
|
@ -607,7 +607,7 @@ VT100.prototype.mouseEvent = function(event, type) {
|
||||||
// If any text is currently selected, do not move the focus as that would
|
// If any text is currently selected, do not move the focus as that would
|
||||||
// invalidate the selection.
|
// invalidate the selection.
|
||||||
var selection = this.selection();
|
var selection = this.selection();
|
||||||
if ((type == MOUSE_UP || type == MOUSE_CLICK) && !selection.length) {
|
if ((type == 1 /* MOUSE_UP */ || type == 2 /* MOUSE_CLICK */) && !selection.length) {
|
||||||
this.input.focus();
|
this.input.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ VT100.prototype.mouseEvent = function(event, type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute button number and modifier keys.
|
// Compute button number and modifier keys.
|
||||||
var button = type != MOUSE_DOWN ? 3 :
|
var button = type != 0 /* MOUSE_DOWN */ ? 3 :
|
||||||
typeof event.pageX != 'undefined' ? event.button :
|
typeof event.pageX != 'undefined' ? event.button :
|
||||||
[ undefined, 0, 2, 0, 1, 0, 1, 0 ][event.button];
|
[ undefined, 0, 2, 0, 1, 0, 1, 0 ][event.button];
|
||||||
if (button != undefined) {
|
if (button != undefined) {
|
||||||
|
@ -659,13 +659,13 @@ VT100.prototype.mouseEvent = function(event, type) {
|
||||||
// with the SHIFT key unpressed. Both of these restrictions do not apply
|
// with the SHIFT key unpressed. Both of these restrictions do not apply
|
||||||
// for button releases, as we always want to report those.
|
// for button releases, as we always want to report those.
|
||||||
if (this.mouseReporting && !selection.length &&
|
if (this.mouseReporting && !selection.length &&
|
||||||
(type != MOUSE_DOWN || !event.shiftKey)) {
|
(type != 0 /* MOUSE_DOWN */ || !event.shiftKey)) {
|
||||||
if (inside || type != MOUSE_DOWN) {
|
if (inside || type != 0 /* MOUSE_DOWN */) {
|
||||||
if (button != undefined) {
|
if (button != undefined) {
|
||||||
var report = '\u001B[M' + String.fromCharCode(button + 32) +
|
var report = '\u001B[M' + String.fromCharCode(button + 32) +
|
||||||
String.fromCharCode(x + 33) +
|
String.fromCharCode(x + 33) +
|
||||||
String.fromCharCode(y + 33);
|
String.fromCharCode(y + 33);
|
||||||
if (type != MOUSE_CLICK) {
|
if (type != 2 /* MOUSE_CLICK */) {
|
||||||
this.keysPressed(report);
|
this.keysPressed(report);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ VT100.prototype.mouseEvent = function(event, type) {
|
||||||
|
|
||||||
// Bring up context menu.
|
// Bring up context menu.
|
||||||
if (button == 2 && !event.shiftKey) {
|
if (button == 2 && !event.shiftKey) {
|
||||||
if (type == MOUSE_DOWN) {
|
if (type == 0 /* MOUSE_DOWN */) {
|
||||||
this.showContextMenu(event.clientX - offsetX, event.clientY - offsetY);
|
this.showContextMenu(event.clientX - offsetX, event.clientY - offsetY);
|
||||||
}
|
}
|
||||||
return this.cancelEvent(event);
|
return this.cancelEvent(event);
|
||||||
|
@ -1500,7 +1500,7 @@ VT100.prototype.toggleBell = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.about = function() {
|
VT100.prototype.about = function() {
|
||||||
alert("VT100 Terminal Emulator " + VERSION +
|
alert("VT100 Terminal Emulator " + "2.5 (revision 88)" +
|
||||||
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
||||||
"For more information check http://shellinabox.com");
|
"For more information check http://shellinabox.com");
|
||||||
};
|
};
|
||||||
|
@ -2261,22 +2261,22 @@ VT100.prototype.respondSecondaryDA = function() {
|
||||||
|
|
||||||
VT100.prototype.updateStyle = function() {
|
VT100.prototype.updateStyle = function() {
|
||||||
var style = '';
|
var style = '';
|
||||||
if (this.attr & ATTR_UNDERLINE) {
|
if (this.attr & 0x0200 /* ATTR_UNDERLINE */) {
|
||||||
style += 'text-decoration:underline;';
|
style += 'text-decoration:underline;';
|
||||||
}
|
}
|
||||||
var bg = (this.attr >> 4) & 0xF;
|
var bg = (this.attr >> 4) & 0xF;
|
||||||
var fg = this.attr & 0xF;
|
var fg = this.attr & 0xF;
|
||||||
if (this.attr & ATTR_REVERSE) {
|
if (this.attr & 0x0100 /* ATTR_REVERSE */) {
|
||||||
var tmp = bg;
|
var tmp = bg;
|
||||||
bg = fg;
|
bg = fg;
|
||||||
fg = tmp;
|
fg = tmp;
|
||||||
}
|
}
|
||||||
if ((this.attr & (ATTR_REVERSE | ATTR_DIM)) == ATTR_DIM) {
|
if ((this.attr & (0x0100 /* ATTR_REVERSE */ | 0x0400 /* ATTR_DIM */)) == 0x0400 /* ATTR_DIM */) {
|
||||||
fg = 8; // Dark grey
|
fg = 8; // Dark grey
|
||||||
} else if (this.attr & ATTR_BRIGHT) {
|
} else if (this.attr & 0x0800 /* ATTR_BRIGHT */) {
|
||||||
fg |= 8;
|
fg |= 8;
|
||||||
}
|
}
|
||||||
if (this.attr & ATTR_BLINK) {
|
if (this.attr & 0x1000 /* ATTR_BLINK */) {
|
||||||
bg ^= 8;
|
bg ^= 8;
|
||||||
}
|
}
|
||||||
// Make some readability enhancements. Most notably, disallow identical
|
// Make some readability enhancements. Most notably, disallow identical
|
||||||
|
@ -2480,12 +2480,12 @@ VT100.prototype.csiM = function(number) {
|
||||||
VT100.prototype.csim = function() {
|
VT100.prototype.csim = function() {
|
||||||
for (var i = 0; i <= this.npar; i++) {
|
for (var i = 0; i <= this.npar; i++) {
|
||||||
switch (this.par[i]) {
|
switch (this.par[i]) {
|
||||||
case 0: this.attr = ATTR_DEFAULT; break;
|
case 0: this.attr = 0x00F0 /* ATTR_DEFAULT */; break;
|
||||||
case 1: this.attr = (this.attr & ~ATTR_DIM)|ATTR_BRIGHT; break;
|
case 1: this.attr = (this.attr & ~0x0400 /* ATTR_DIM */)|0x0800 /* ATTR_BRIGHT */; break;
|
||||||
case 2: this.attr = (this.attr & ~ATTR_BRIGHT)|ATTR_DIM; break;
|
case 2: this.attr = (this.attr & ~0x0800 /* ATTR_BRIGHT */)|0x0400 /* ATTR_DIM */; break;
|
||||||
case 4: this.attr |= ATTR_UNDERLINE; break;
|
case 4: this.attr |= 0x0200 /* ATTR_UNDERLINE */; break;
|
||||||
case 5: this.attr |= ATTR_BLINK; break;
|
case 5: this.attr |= 0x1000 /* ATTR_BLINK */; break;
|
||||||
case 7: this.attr |= ATTR_REVERSE; break;
|
case 7: this.attr |= 0x0100 /* ATTR_REVERSE */; break;
|
||||||
case 10:
|
case 10:
|
||||||
this.translate = this.GMap[this.useGMap];
|
this.translate = this.GMap[this.useGMap];
|
||||||
this.dispCtrl = false;
|
this.dispCtrl = false;
|
||||||
|
@ -2502,13 +2502,13 @@ VT100.prototype.csim = function() {
|
||||||
this.toggleMeta = true;
|
this.toggleMeta = true;
|
||||||
break;
|
break;
|
||||||
case 21:
|
case 21:
|
||||||
case 22: this.attr &= ~(ATTR_BRIGHT|ATTR_DIM); break;
|
case 22: this.attr &= ~(0x0800 /* ATTR_BRIGHT */|0x0400 /* ATTR_DIM */); break;
|
||||||
case 24: this.attr &= ~ ATTR_UNDERLINE; break;
|
case 24: this.attr &= ~ 0x0200 /* ATTR_UNDERLINE */; break;
|
||||||
case 25: this.attr &= ~ ATTR_BLINK; break;
|
case 25: this.attr &= ~ 0x1000 /* ATTR_BLINK */; break;
|
||||||
case 27: this.attr &= ~ ATTR_REVERSE; break;
|
case 27: this.attr &= ~ 0x0100 /* ATTR_REVERSE */; break;
|
||||||
case 38: this.attr = (this.attr & ~(ATTR_DIM|ATTR_BRIGHT|0x0F))|
|
case 38: this.attr = (this.attr & ~(0x0400 /* ATTR_DIM */|0x0800 /* ATTR_BRIGHT */|0x0F))|
|
||||||
ATTR_UNDERLINE; break;
|
0x0200 /* ATTR_UNDERLINE */; break;
|
||||||
case 39: this.attr &= ~(ATTR_DIM|ATTR_BRIGHT|ATTR_UNDERLINE|0x0F); break;
|
case 39: this.attr &= ~(0x0400 /* ATTR_DIM */|0x0800 /* ATTR_BRIGHT */|0x0200 /* ATTR_UNDERLINE */|0x0F); break;
|
||||||
case 49: this.attr |= 0xF0; break;
|
case 49: this.attr |= 0xF0; break;
|
||||||
default:
|
default:
|
||||||
if (this.par[i] >= 30 && this.par[i] <= 37) {
|
if (this.par[i] >= 30 && this.par[i] <= 37) {
|
||||||
|
@ -2573,32 +2573,32 @@ VT100.prototype.doControl = function(ch) {
|
||||||
this.translate = this.GMap[0];
|
this.translate = this.GMap[0];
|
||||||
this.dispCtrl = false; break;
|
this.dispCtrl = false; break;
|
||||||
case 0x18:
|
case 0x18:
|
||||||
case 0x1A: this.isEsc = ESnormal; break;
|
case 0x1A: this.isEsc = 0 /* ESnormal */; break;
|
||||||
case 0x1B: this.isEsc = ESesc; break;
|
case 0x1B: this.isEsc = 1 /* ESesc */; break;
|
||||||
case 0x7F: /* ignored */ break;
|
case 0x7F: /* ignored */ break;
|
||||||
case 0x88: this.userTabStop[this.cursorX] = true; break;
|
case 0x88: this.userTabStop[this.cursorX] = true; break;
|
||||||
case 0x8D: this.ri(); break;
|
case 0x8D: this.ri(); break;
|
||||||
case 0x8E: this.isEsc = ESss2; break;
|
case 0x8E: this.isEsc = 18 /* ESss2 */; break;
|
||||||
case 0x8F: this.isEsc = ESss3; break;
|
case 0x8F: this.isEsc = 19 /* ESss3 */; break;
|
||||||
case 0x9A: this.respondID(); break;
|
case 0x9A: this.respondID(); break;
|
||||||
case 0x9B: this.isEsc = ESsquare; break;
|
case 0x9B: this.isEsc = 2 /* ESsquare */; break;
|
||||||
case 0x07: if (this.isEsc != ESstatus) {
|
case 0x07: if (this.isEsc != 17 /* ESstatus */) {
|
||||||
this.beep(); break;
|
this.beep(); break;
|
||||||
}
|
}
|
||||||
/* fall thru */
|
/* fall thru */
|
||||||
default: switch (this.isEsc) {
|
default: switch (this.isEsc) {
|
||||||
case ESesc:
|
case 1 /* ESesc */:
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
/*%*/ case 0x25: this.isEsc = ESpercent; break;
|
/*%*/ case 0x25: this.isEsc = 13 /* ESpercent */; break;
|
||||||
/*(*/ case 0x28: this.isEsc = ESsetG0; break;
|
/*(*/ case 0x28: this.isEsc = 8 /* ESsetG0 */; break;
|
||||||
/*-*/ case 0x2D:
|
/*-*/ case 0x2D:
|
||||||
/*)*/ case 0x29: this.isEsc = ESsetG1; break;
|
/*)*/ case 0x29: this.isEsc = 9 /* ESsetG1 */; break;
|
||||||
/*.*/ case 0x2E:
|
/*.*/ case 0x2E:
|
||||||
/***/ case 0x2A: this.isEsc = ESsetG2; break;
|
/***/ case 0x2A: this.isEsc = 10 /* ESsetG2 */; break;
|
||||||
/*/*/ case 0x2F:
|
/*/*/ case 0x2F:
|
||||||
/*+*/ case 0x2B: this.isEsc = ESsetG3; break;
|
/*+*/ case 0x2B: this.isEsc = 11 /* ESsetG3 */; break;
|
||||||
/*#*/ case 0x23: this.isEsc = EShash; break;
|
/*#*/ case 0x23: this.isEsc = 7 /* EShash */; break;
|
||||||
/*7*/ case 0x37: this.saveCursor(); break;
|
/*7*/ case 0x37: this.saveCursor(); break;
|
||||||
/*8*/ case 0x38: this.restoreCursor(); break;
|
/*8*/ case 0x38: this.restoreCursor(); break;
|
||||||
/*>*/ case 0x3E: this.applKeyMode = false; break;
|
/*>*/ case 0x3E: this.applKeyMode = false; break;
|
||||||
|
@ -2606,30 +2606,30 @@ VT100.prototype.doControl = function(ch) {
|
||||||
/*D*/ case 0x44: this.lf(); break;
|
/*D*/ case 0x44: this.lf(); break;
|
||||||
/*E*/ case 0x45: this.cr(); this.lf(); break;
|
/*E*/ case 0x45: this.cr(); this.lf(); break;
|
||||||
/*M*/ case 0x4D: this.ri(); break;
|
/*M*/ case 0x4D: this.ri(); break;
|
||||||
/*N*/ case 0x4E: this.isEsc = ESss2; break;
|
/*N*/ case 0x4E: this.isEsc = 18 /* ESss2 */; break;
|
||||||
/*O*/ case 0x4F: this.isEsc = ESss3; break;
|
/*O*/ case 0x4F: this.isEsc = 19 /* ESss3 */; break;
|
||||||
/*H*/ case 0x48: this.userTabStop[this.cursorX] = true; break;
|
/*H*/ case 0x48: this.userTabStop[this.cursorX] = true; break;
|
||||||
/*Z*/ case 0x5A: this.respondID(); break;
|
/*Z*/ case 0x5A: this.respondID(); break;
|
||||||
/*[*/ case 0x5B: this.isEsc = ESsquare; break;
|
/*[*/ case 0x5B: this.isEsc = 2 /* ESsquare */; break;
|
||||||
/*]*/ case 0x5D: this.isEsc = ESnonstd; break;
|
/*]*/ case 0x5D: this.isEsc = 15 /* ESnonstd */; break;
|
||||||
/*c*/ case 0x63: this.reset(); break;
|
/*c*/ case 0x63: this.reset(); break;
|
||||||
/*g*/ case 0x67: this.flashScreen(); break;
|
/*g*/ case 0x67: this.flashScreen(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESnonstd:
|
case 15 /* ESnonstd */:
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
/*0*/ case 0x30:
|
/*0*/ case 0x30:
|
||||||
/*1*/ case 0x31:
|
/*1*/ case 0x31:
|
||||||
/*2*/ case 0x32: this.statusString = ''; this.isEsc = ESstatus; break;
|
/*2*/ case 0x32: this.statusString = ''; this.isEsc = 17 /* ESstatus */; break;
|
||||||
/*P*/ case 0x50: this.npar = 0; this.par = [ 0, 0, 0, 0, 0, 0, 0 ];
|
/*P*/ case 0x50: this.npar = 0; this.par = [ 0, 0, 0, 0, 0, 0, 0 ];
|
||||||
this.isEsc = ESpalette; break;
|
this.isEsc = 16 /* ESpalette */; break;
|
||||||
/*R*/ case 0x52: // Palette support is not implemented
|
/*R*/ case 0x52: // Palette support is not implemented
|
||||||
this.isEsc = ESnormal; break;
|
this.isEsc = 0 /* ESnormal */; break;
|
||||||
default: this.isEsc = ESnormal; break;
|
default: this.isEsc = 0 /* ESnormal */; break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESpalette:
|
case 16 /* ESpalette */:
|
||||||
if ((ch >= 0x30 /*0*/ && ch <= 0x39 /*9*/) ||
|
if ((ch >= 0x30 /*0*/ && ch <= 0x39 /*9*/) ||
|
||||||
(ch >= 0x41 /*A*/ && ch <= 0x46 /*F*/) ||
|
(ch >= 0x41 /*A*/ && ch <= 0x46 /*F*/) ||
|
||||||
(ch >= 0x61 /*a*/ && ch <= 0x66 /*f*/)) {
|
(ch >= 0x61 /*a*/ && ch <= 0x66 /*f*/)) {
|
||||||
|
@ -2637,19 +2637,19 @@ VT100.prototype.doControl = function(ch) {
|
||||||
: (ch & 0xF);
|
: (ch & 0xF);
|
||||||
if (this.npar == 7) {
|
if (this.npar == 7) {
|
||||||
// Palette support is not implemented
|
// Palette support is not implemented
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESsquare:
|
case 2 /* ESsquare */:
|
||||||
this.npar = 0;
|
this.npar = 0;
|
||||||
this.par = [ 0, 0, 0, 0, 0, 0, 0, 0,
|
this.par = [ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0 ];
|
0, 0, 0, 0, 0, 0, 0, 0 ];
|
||||||
this.isEsc = ESgetpars;
|
this.isEsc = 3 /* ESgetpars */;
|
||||||
/*[*/ if (ch == 0x5B) { // Function key
|
/*[*/ if (ch == 0x5B) { // Function key
|
||||||
this.isEsc = ESfunckey;
|
this.isEsc = 6 /* ESfunckey */;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
/*?*/ this.isQuestionMark = ch == 0x3F;
|
/*?*/ this.isQuestionMark = ch == 0x3F;
|
||||||
|
@ -2658,8 +2658,8 @@ VT100.prototype.doControl = function(ch) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fall through
|
// Fall through
|
||||||
case ESdeviceattr:
|
case 5 /* ESdeviceattr */:
|
||||||
case ESgetpars:
|
case 3 /* ESgetpars */:
|
||||||
/*;*/ if (ch == 0x3B) {
|
/*;*/ if (ch == 0x3B) {
|
||||||
this.npar++;
|
this.npar++;
|
||||||
break;
|
break;
|
||||||
|
@ -2670,7 +2670,7 @@ VT100.prototype.doControl = function(ch) {
|
||||||
}
|
}
|
||||||
this.par[this.npar] = 10*par + (ch & 0xF);
|
this.par[this.npar] = 10*par + (ch & 0xF);
|
||||||
break;
|
break;
|
||||||
} else if (this.isEsc == ESdeviceattr) {
|
} else if (this.isEsc == 5 /* ESdeviceattr */) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
/*c*/ case 0x63: if (this.par[0] == 0) this.respondSecondaryDA(); break;
|
/*c*/ case 0x63: if (this.par[0] == 0) this.respondSecondaryDA(); break;
|
||||||
/*m*/ case 0x6D: /* (re)set key modifier resource values */ break;
|
/*m*/ case 0x6D: /* (re)set key modifier resource values */ break;
|
||||||
|
@ -2678,14 +2678,14 @@ VT100.prototype.doControl = function(ch) {
|
||||||
/*p*/ case 0x70: /* set pointer mode resource value */ break;
|
/*p*/ case 0x70: /* set pointer mode resource value */ break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
this.isEsc = ESgotpars;
|
this.isEsc = 4 /* ESgotpars */;
|
||||||
}
|
}
|
||||||
// Fall through
|
// Fall through
|
||||||
case ESgotpars:
|
case 4 /* ESgotpars */:
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
if (this.isQuestionMark) {
|
if (this.isQuestionMark) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
/*h*/ case 0x68: this.setMode(true); break;
|
/*h*/ case 0x68: this.setMode(true); break;
|
||||||
|
@ -2697,8 +2697,8 @@ VT100.prototype.doControl = function(ch) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
/*!*/ case 0x21: this.isEsc = ESbang; break;
|
/*!*/ case 0x21: this.isEsc = 12 /* ESbang */; break;
|
||||||
/*>*/ case 0x3E: if (!this.npar) this.isEsc = ESdeviceattr; break;
|
/*>*/ case 0x3E: if (!this.npar) this.isEsc = 5 /* ESdeviceattr */; break;
|
||||||
/*G*/ case 0x47:
|
/*G*/ case 0x47:
|
||||||
/*`*/ case 0x60: this.gotoXY(this.par[0] - 1, this.cursorY); break;
|
/*`*/ case 0x60: this.gotoXY(this.par[0] - 1, this.cursorY); break;
|
||||||
/*A*/ case 0x41: this.gotoXY(this.cursorX,
|
/*A*/ case 0x41: this.gotoXY(this.cursorX,
|
||||||
|
@ -2775,14 +2775,14 @@ VT100.prototype.doControl = function(ch) {
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESbang:
|
case 12 /* ESbang */:
|
||||||
if (ch == 'p') {
|
if (ch == 'p') {
|
||||||
this.reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
break;
|
break;
|
||||||
case ESpercent:
|
case 13 /* ESpercent */:
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
/*@*/ case 0x40: this.utfEnabled = false; break;
|
/*@*/ case 0x40: this.utfEnabled = false; break;
|
||||||
/*G*/ case 0x47:
|
/*G*/ case 0x47:
|
||||||
|
@ -2790,20 +2790,20 @@ VT100.prototype.doControl = function(ch) {
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESfunckey:
|
case 6 /* ESfunckey */:
|
||||||
this.isEsc = ESnormal; break;
|
this.isEsc = 0 /* ESnormal */; break;
|
||||||
case EShash:
|
case 7 /* EShash */:
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
/*8*/ if (ch == 0x38) {
|
/*8*/ if (ch == 0x38) {
|
||||||
// Screen alignment test not implemented
|
// Screen alignment test not implemented
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESsetG0:
|
case 8 /* ESsetG0 */:
|
||||||
case ESsetG1:
|
case 9 /* ESsetG1 */:
|
||||||
case ESsetG2:
|
case 10 /* ESsetG2 */:
|
||||||
case ESsetG3:
|
case 11 /* ESsetG3 */:
|
||||||
var g = this.isEsc - ESsetG0;
|
var g = this.isEsc - 8 /* ESsetG0 */;
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
/*0*/ case 0x30: this.GMap[g] = this.VT100GraphicsMap; break;
|
/*0*/ case 0x30: this.GMap[g] = this.VT100GraphicsMap; break;
|
||||||
/*A*/ case 0x42:
|
/*A*/ case 0x42:
|
||||||
|
@ -2816,7 +2816,7 @@ VT100.prototype.doControl = function(ch) {
|
||||||
this.translate = this.GMap[g];
|
this.translate = this.GMap[g];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESstatus:
|
case 17 /* ESstatus */:
|
||||||
if (ch == 0x07) {
|
if (ch == 0x07) {
|
||||||
if (this.statusString && this.statusString.charAt(0) == ';') {
|
if (this.statusString && this.statusString.charAt(0) == ';') {
|
||||||
this.statusString = this.statusString.substr(1);
|
this.statusString = this.statusString.substr(1);
|
||||||
|
@ -2825,27 +2825,27 @@ VT100.prototype.doControl = function(ch) {
|
||||||
window.status = this.statusString;
|
window.status = this.statusString;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
this.isEsc = ESnormal;
|
this.isEsc = 0 /* ESnormal */;
|
||||||
} else {
|
} else {
|
||||||
this.statusString += String.fromCharCode(ch);
|
this.statusString += String.fromCharCode(ch);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESss2:
|
case 18 /* ESss2 */:
|
||||||
case ESss3:
|
case 19 /* ESss3 */:
|
||||||
if (ch < 256) {
|
if (ch < 256) {
|
||||||
ch = this.GMap[this.isEsc - ESss2 + 2]
|
ch = this.GMap[this.isEsc - 18 /* ESss2 */ + 2]
|
||||||
[this.toggleMeta ? (ch | 0x80) : ch];
|
[this.toggleMeta ? (ch | 0x80) : ch];
|
||||||
if ((ch & 0xFF00) == 0xF000) {
|
if ((ch & 0xFF00) == 0xF000) {
|
||||||
ch = ch & 0xFF;
|
ch = ch & 0xFF;
|
||||||
} else if (ch == 0xFEFF || (ch >= 0x200A && ch <= 0x200F)) {
|
} else if (ch == 0xFEFF || (ch >= 0x200A && ch <= 0x200F)) {
|
||||||
this.isEsc = ESnormal; break;
|
this.isEsc = 0 /* ESnormal */; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.lastCharacter = String.fromCharCode(ch);
|
this.lastCharacter = String.fromCharCode(ch);
|
||||||
lineBuf += this.lastCharacter;
|
lineBuf += this.lastCharacter;
|
||||||
this.isEsc = ESnormal; break;
|
this.isEsc = 0 /* ESnormal */; break;
|
||||||
default:
|
default:
|
||||||
this.isEsc = ESnormal; break;
|
this.isEsc = 0 /* ESnormal */; break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2922,7 +2922,7 @@ VT100.prototype.vt100 = function(s) {
|
||||||
!(this.dispCtrl ? this.ctrlAlways : this.ctrlAction)[ch & 0x1F]) &&
|
!(this.dispCtrl ? this.ctrlAlways : this.ctrlAction)[ch & 0x1F]) &&
|
||||||
(ch != 0x7F || this.dispCtrl);
|
(ch != 0x7F || this.dispCtrl);
|
||||||
|
|
||||||
if (isNormalCharacter && this.isEsc == ESnormal) {
|
if (isNormalCharacter && this.isEsc == 0 /* ESnormal */) {
|
||||||
if (ch < 256) {
|
if (ch < 256) {
|
||||||
ch = this.translate[this.toggleMeta ? (ch | 0x80) : ch];
|
ch = this.translate[this.toggleMeta ? (ch | 0x80) : ch];
|
||||||
}
|
}
|
||||||
|
|
3126
shellinabox/vt100.jspp
Normal file
3126
shellinabox/vt100.jspp
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue