Added --no-beep command line option to avoid VLC plugins crashing Firefox.
Instead, switch to visual bell. Made this the default for the Debian package. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@35 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
parent
4bab85fdc2
commit
2212ea7606
5 changed files with 58 additions and 30 deletions
4
debian/shellinabox.default
vendored
4
debian/shellinabox.default
vendored
|
@ -5,4 +5,6 @@ SHELLINABOX_DAEMON_START=1
|
||||||
SHELLINABOX_PORT=4200
|
SHELLINABOX_PORT=4200
|
||||||
|
|
||||||
# Any optional arguments (e.g. extra service definitions)
|
# Any optional arguments (e.g. extra service definitions)
|
||||||
SHELLINABOX_ARGS=
|
# We disable beeps, as there have been reports of the VLC plugin crashing
|
||||||
|
# Firefox on Linux/x86_64.
|
||||||
|
SHELLINABOX_ARGS=--no-beep
|
||||||
|
|
|
@ -319,7 +319,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
|
||||||
actions[i++] = oldActions[j++];
|
actions[i++] = oldActions[j++];
|
||||||
if (node.id == "endconfig") {
|
if (node.id == "endconfig") {
|
||||||
node.id = '';
|
node.id = '';
|
||||||
if (serverSupportsSSL) {
|
if (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL) {
|
||||||
// If the server supports both SSL and plain text connections,
|
// If the server supports both SSL and plain text connections,
|
||||||
// provide a menu entry to switch between the two.
|
// provide a menu entry to switch between the two.
|
||||||
var newNode = document.createElement('li');
|
var newNode = document.createElement('li');
|
||||||
|
@ -349,7 +349,7 @@ ShellInABox.prototype.about = function() {
|
||||||
alert("Shell In A Box version " + VERSION +
|
alert("Shell In A Box version " + VERSION +
|
||||||
"\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" +
|
||||||
(serverSupportsSSL ?
|
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"This product includes software developed by the OpenSSL Project\n" +
|
"This product includes software developed by the OpenSSL Project\n" +
|
||||||
"for use in the OpenSSL Toolkit. (http://www.openssl.org/)\n" +
|
"for use in the OpenSSL Toolkit. (http://www.openssl.org/)\n" +
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
static int port;
|
static int port;
|
||||||
static int portMin;
|
static int portMin;
|
||||||
static int portMax;
|
static int portMax;
|
||||||
|
static int noBeep = 0;
|
||||||
static int numericHosts = 0;
|
static int numericHosts = 0;
|
||||||
static int enableSSL = 1;
|
static int enableSSL = 1;
|
||||||
static char *certificateDir;
|
static char *certificateDir;
|
||||||
|
@ -485,11 +486,13 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
|
||||||
extern char vt100End[];
|
extern char vt100End[];
|
||||||
extern char shellInABoxStart[];
|
extern char shellInABoxStart[];
|
||||||
extern char shellInABoxEnd[];
|
extern char shellInABoxEnd[];
|
||||||
char *sslState = stringPrintf(NULL,
|
char *stateVars = stringPrintf(NULL,
|
||||||
"serverSupportsSSL = %s;\n\n",
|
"serverSupportsSSL = %s;\n"
|
||||||
enableSSL ? "true" : "false");
|
"suppressAllAudio = %d;\n\n",
|
||||||
int sslStateLength = strlen(sslState);
|
enableSSL ? "true" : "false",
|
||||||
int contentLength = sslStateLength +
|
noBeep);
|
||||||
|
int stateVarsLength = strlen(stateVars);
|
||||||
|
int contentLength = stateVarsLength +
|
||||||
(vt100End - vt100Start) +
|
(vt100End - vt100Start) +
|
||||||
(shellInABoxEnd - shellInABoxStart);
|
(shellInABoxEnd - shellInABoxStart);
|
||||||
char *response = stringPrintf(NULL,
|
char *response = stringPrintf(NULL,
|
||||||
|
@ -502,13 +505,13 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
|
||||||
if (strcmp(httpGetMethod(http), "HEAD")) {
|
if (strcmp(httpGetMethod(http), "HEAD")) {
|
||||||
check(response = realloc(response, headerLength + contentLength));
|
check(response = realloc(response, headerLength + contentLength));
|
||||||
memcpy(memcpy(memcpy(
|
memcpy(memcpy(memcpy(
|
||||||
response + headerLength, sslState, sslStateLength) + sslStateLength,
|
response + headerLength, stateVars, stateVarsLength)+stateVarsLength,
|
||||||
vt100Start, vt100End - vt100Start) + (vt100End - vt100Start),
|
vt100Start, vt100End - vt100Start) + (vt100End - vt100Start),
|
||||||
shellInABoxStart, shellInABoxEnd - shellInABoxStart);
|
shellInABoxStart, shellInABoxEnd - shellInABoxStart);
|
||||||
} else {
|
} else {
|
||||||
contentLength = 0;
|
contentLength = 0;
|
||||||
}
|
}
|
||||||
free(sslState);
|
free(stateVars);
|
||||||
httpTransfer(http, response, headerLength + contentLength);
|
httpTransfer(http, response, headerLength + contentLength);
|
||||||
} else if (pathInfoLength == 10 && !memcmp(pathInfo, "styles.css", 10)) {
|
} else if (pathInfoLength == 10 && !memcmp(pathInfo, "styles.css", 10)) {
|
||||||
// Serve the style sheet.
|
// Serve the style sheet.
|
||||||
|
@ -558,6 +561,7 @@ static void usage(void) {
|
||||||
" -f, --static-file=URL:FILE serve static file from URL path\n"
|
" -f, --static-file=URL:FILE serve static file from URL path\n"
|
||||||
" -g, --group=GID switch to this group (default: %s)\n"
|
" -g, --group=GID switch to this group (default: %s)\n"
|
||||||
" -h, --help print this message\n"
|
" -h, --help print this message\n"
|
||||||
|
" --no-beep suppress all audio output\n"
|
||||||
" -n, --numeric do not resolve hostnames\n"
|
" -n, --numeric do not resolve hostnames\n"
|
||||||
" -p, --port=PORT select a port (default: %d)\n"
|
" -p, --port=PORT select a port (default: %d)\n"
|
||||||
" -s, --service=SERVICE define one or more services\n"
|
" -s, --service=SERVICE define one or more services\n"
|
||||||
|
@ -623,6 +627,7 @@ static void parseArgs(int argc, char * const argv[]) {
|
||||||
{ "debug", 0, 0, 'd' },
|
{ "debug", 0, 0, 'd' },
|
||||||
{ "static-file", 1, 0, 'f' },
|
{ "static-file", 1, 0, 'f' },
|
||||||
{ "group", 1, 0, 'g' },
|
{ "group", 1, 0, 'g' },
|
||||||
|
{ "no-beep", 0, 0, 0 },
|
||||||
{ "numeric", 0, 0, 'n' },
|
{ "numeric", 0, 0, 'n' },
|
||||||
{ "port", 1, 0, 'p' },
|
{ "port", 1, 0, 'p' },
|
||||||
{ "service", 1, 0, 's' },
|
{ "service", 1, 0, 's' },
|
||||||
|
@ -715,6 +720,9 @@ static void parseArgs(int argc, char * const argv[]) {
|
||||||
fatal("Duplicate --group option.");
|
fatal("Duplicate --group option.");
|
||||||
}
|
}
|
||||||
runAsGroup = parseGroup(optarg, NULL);
|
runAsGroup = parseGroup(optarg, NULL);
|
||||||
|
} else if (!idx--) {
|
||||||
|
// No Beep
|
||||||
|
noBeep = 1;
|
||||||
} else if (!idx--) {
|
} else if (!idx--) {
|
||||||
// Numeric
|
// Numeric
|
||||||
numericHosts = 1;
|
numericHosts = 1;
|
||||||
|
|
|
@ -57,6 +57,7 @@ shellinaboxd \- publish command line shell through AJAX interface
|
||||||
[\ \fB-f\fP\ | \fB--static-file=\fP\fIurl\fP:\fIfile\fP\ ]
|
[\ \fB-f\fP\ | \fB--static-file=\fP\fIurl\fP:\fIfile\fP\ ]
|
||||||
[\ \fB-g\fP\ | \fB--group=\fP\fIgid\fP\ ]
|
[\ \fB-g\fP\ | \fB--group=\fP\fIgid\fP\ ]
|
||||||
[\ \fB-h\fP\ | \fB--help\fP\ ]
|
[\ \fB-h\fP\ | \fB--help\fP\ ]
|
||||||
|
[\ \fB--no-beep\fP\ ]
|
||||||
[\ \fB-n\fP\ | \fB--numeric\fP\ ]
|
[\ \fB-n\fP\ | \fB--numeric\fP\ ]
|
||||||
[\ \fB-p\fP\ | \fB--port=\fP\fIport\fP\ ]
|
[\ \fB-p\fP\ | \fB--port=\fP\fIport\fP\ ]
|
||||||
[\ \fB-s\fP\ | \fB--service=\fP\fIservice\fP\ ]
|
[\ \fB-s\fP\ | \fB--service=\fP\fIservice\fP\ ]
|
||||||
|
@ -238,6 +239,11 @@ runs as.
|
||||||
\fB-h\fP\ |\ \fB--help\fP
|
\fB-h\fP\ |\ \fB--help\fP
|
||||||
Display a brief usage message showing the valid command line parameters.
|
Display a brief usage message showing the valid command line parameters.
|
||||||
.TP
|
.TP
|
||||||
|
\fB--no-beep\fP
|
||||||
|
not only are audible signals undesired in some working environments, but
|
||||||
|
browser support for media playback is often buggy, too. Setting this option
|
||||||
|
suppresses all audio playback and enables the visual bell by default.
|
||||||
|
.TP
|
||||||
\fB-n\fP\ |\ \fB--numeric\fP
|
\fB-n\fP\ |\ \fB--numeric\fP
|
||||||
When running in
|
When running in
|
||||||
.B --verbose
|
.B --verbose
|
||||||
|
@ -580,3 +586,9 @@ Some browsers restrict the number of concurrent connections to a
|
||||||
server. This restricts how many AJAX terminals can be opened
|
server. This restricts how many AJAX terminals can be opened
|
||||||
simultaneously. If this becomes a problem, users can typically
|
simultaneously. If this becomes a problem, users can typically
|
||||||
reconfigure their browsers to raise the limit.
|
reconfigure their browsers to raise the limit.
|
||||||
|
.P
|
||||||
|
There have been reports of the VLC plugin on Linux/x86_64 crashing Firefox
|
||||||
|
when the browser page gets reloaded. Setting the
|
||||||
|
.B --no-beep
|
||||||
|
option eliminates all references to VLC and thus appears to work around
|
||||||
|
this crash.
|
||||||
|
|
|
@ -128,7 +128,8 @@ VT100.prototype.reset = function(clearHistory) {
|
||||||
this.offsetMode = false;
|
this.offsetMode = false;
|
||||||
this.mouseReporting = false;
|
this.mouseReporting = false;
|
||||||
this.utfEnabled = true;
|
this.utfEnabled = true;
|
||||||
this.visibleBell = false;
|
this.visualBell = suppressAllAudio != 'undefined' &&
|
||||||
|
suppressAllAudio;
|
||||||
this.utfCount = 0;
|
this.utfCount = 0;
|
||||||
this.utfChar = 0;
|
this.utfChar = 0;
|
||||||
this.style = '';
|
this.style = '';
|
||||||
|
@ -209,7 +210,7 @@ VT100.prototype.initializeElements = function(container) {
|
||||||
try {
|
try {
|
||||||
if (typeof navigator.mimeTypes["audio/x-wav"].enabledPlugin.name !=
|
if (typeof navigator.mimeTypes["audio/x-wav"].enabledPlugin.name !=
|
||||||
'undefined') {
|
'undefined') {
|
||||||
embed =
|
embed = suppressAllAudio ? "" :
|
||||||
'<embed classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' +
|
'<embed classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' +
|
||||||
'id="beep_embed" ' +
|
'id="beep_embed" ' +
|
||||||
'src="beep.wav" ' +
|
'src="beep.wav" ' +
|
||||||
|
@ -219,7 +220,7 @@ VT100.prototype.initializeElements = function(container) {
|
||||||
'type="audio/x-wav" ' +
|
'type="audio/x-wav" ' +
|
||||||
'height="16" ' +
|
'height="16" ' +
|
||||||
'width="200" ' +
|
'width="200" ' +
|
||||||
'style="position:absolute;left:-1000px;top:-1000px">';
|
'style="position:absolute;left:-1000px;top:-1000px" />';
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
|
@ -240,11 +241,15 @@ VT100.prototype.initializeElements = function(container) {
|
||||||
'<input type="textfield" id="input" />' +
|
'<input type="textfield" id="input" />' +
|
||||||
'<input type="textfield" id="cliphelper" />' +
|
'<input type="textfield" id="cliphelper" />' +
|
||||||
'<span id="attrib"> </span>' +
|
'<span id="attrib"> </span>' +
|
||||||
embed + '<bgsound id="beep_bgsound" loop=1 />' +
|
(suppressAllAudio ? "" :
|
||||||
|
embed + '<bgsound id="beep_bgsound" loop=1 />') +
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the object used for playing the "beep" sound, if any.
|
// Find the object used for playing the "beep" sound, if any.
|
||||||
|
if (typeof suppressAllAudio != 'undefined' && suppressAllAudio) {
|
||||||
|
this.beeper = undefined;
|
||||||
|
} else {
|
||||||
this.beeper = this.getChildById(this.container,
|
this.beeper = this.getChildById(this.container,
|
||||||
'beep_embed');
|
'beep_embed');
|
||||||
if (!this.beeper || !this.beeper.Play) {
|
if (!this.beeper || !this.beeper.Play) {
|
||||||
|
@ -254,6 +259,7 @@ VT100.prototype.initializeElements = function(container) {
|
||||||
this.beeper = undefined;
|
this.beeper = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the variables for finding the text console and the
|
// Initialize the variables for finding the text console and the
|
||||||
// cursor.
|
// cursor.
|
||||||
|
@ -1441,7 +1447,7 @@ VT100.prototype.toggleUTF = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.toggleBell = function() {
|
VT100.prototype.toggleBell = function() {
|
||||||
this.visibleBell = !this.visibleBell;
|
this.visualBell = !this.visualBell;
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.about = function() {
|
VT100.prototype.about = function() {
|
||||||
|
@ -1475,7 +1481,7 @@ VT100.prototype.showContextMenu = function(x, y) {
|
||||||
'<li id="beginconfig">' +
|
'<li id="beginconfig">' +
|
||||||
(this.utfEnabled ? '✔ ' : '') + 'Unicode</li>' +
|
(this.utfEnabled ? '✔ ' : '') + 'Unicode</li>' +
|
||||||
'<li id="endconfig">' +
|
'<li id="endconfig">' +
|
||||||
(this.visibleBell ? '✔ ' : '') + 'Visible Bell</li>'+
|
(this.visualBell ? '✔ ' : '') + 'Visual Bell</li>'+
|
||||||
'<hr />' +
|
'<hr />' +
|
||||||
'<li id="about">About...</li>' +
|
'<li id="about">About...</li>' +
|
||||||
'</ul>' +
|
'</ul>' +
|
||||||
|
@ -2064,7 +2070,7 @@ VT100.prototype.flashScreen = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.beep = function() {
|
VT100.prototype.beep = function() {
|
||||||
if (this.visibleBell) {
|
if (this.visualBell) {
|
||||||
this.flashScreen();
|
this.flashScreen();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue