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:
zodiac 2009-01-08 22:53:05 +00:00
parent 4bab85fdc2
commit 2212ea7606
5 changed files with 58 additions and 30 deletions

View file

@ -5,4 +5,6 @@ SHELLINABOX_DAEMON_START=1
SHELLINABOX_PORT=4200
# 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

View file

@ -319,7 +319,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
actions[i++] = oldActions[j++];
if (node.id == "endconfig") {
node.id = '';
if (serverSupportsSSL) {
if (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL) {
// If the server supports both SSL and plain text connections,
// provide a menu entry to switch between the two.
var newNode = document.createElement('li');
@ -349,7 +349,7 @@ 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" +
(serverSupportsSSL ?
(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" +

View file

@ -74,6 +74,7 @@
static int port;
static int portMin;
static int portMax;
static int noBeep = 0;
static int numericHosts = 0;
static int enableSSL = 1;
static char *certificateDir;
@ -485,11 +486,13 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
extern char vt100End[];
extern char shellInABoxStart[];
extern char shellInABoxEnd[];
char *sslState = stringPrintf(NULL,
"serverSupportsSSL = %s;\n\n",
enableSSL ? "true" : "false");
int sslStateLength = strlen(sslState);
int contentLength = sslStateLength +
char *stateVars = stringPrintf(NULL,
"serverSupportsSSL = %s;\n"
"suppressAllAudio = %d;\n\n",
enableSSL ? "true" : "false",
noBeep);
int stateVarsLength = strlen(stateVars);
int contentLength = stateVarsLength +
(vt100End - vt100Start) +
(shellInABoxEnd - shellInABoxStart);
char *response = stringPrintf(NULL,
@ -502,13 +505,13 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
if (strcmp(httpGetMethod(http), "HEAD")) {
check(response = realloc(response, headerLength + contentLength));
memcpy(memcpy(memcpy(
response + headerLength, sslState, sslStateLength) + sslStateLength,
response + headerLength, stateVars, stateVarsLength)+stateVarsLength,
vt100Start, vt100End - vt100Start) + (vt100End - vt100Start),
shellInABoxStart, shellInABoxEnd - shellInABoxStart);
} else {
contentLength = 0;
}
free(sslState);
free(stateVars);
httpTransfer(http, response, headerLength + contentLength);
} else if (pathInfoLength == 10 && !memcmp(pathInfo, "styles.css", 10)) {
// Serve the style sheet.
@ -558,6 +561,7 @@ static void usage(void) {
" -f, --static-file=URL:FILE serve static file from URL path\n"
" -g, --group=GID switch to this group (default: %s)\n"
" -h, --help print this message\n"
" --no-beep suppress all audio output\n"
" -n, --numeric do not resolve hostnames\n"
" -p, --port=PORT select a port (default: %d)\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' },
{ "static-file", 1, 0, 'f' },
{ "group", 1, 0, 'g' },
{ "no-beep", 0, 0, 0 },
{ "numeric", 0, 0, 'n' },
{ "port", 1, 0, 'p' },
{ "service", 1, 0, 's' },
@ -715,6 +720,9 @@ static void parseArgs(int argc, char * const argv[]) {
fatal("Duplicate --group option.");
}
runAsGroup = parseGroup(optarg, NULL);
} else if (!idx--) {
// No Beep
noBeep = 1;
} else if (!idx--) {
// Numeric
numericHosts = 1;

View file

@ -57,6 +57,7 @@ shellinaboxd \- publish command line shell through AJAX interface
[\ \fB-f\fP\ | \fB--static-file=\fP\fIurl\fP:\fIfile\fP\ ]
[\ \fB-g\fP\ | \fB--group=\fP\fIgid\fP\ ]
[\ \fB-h\fP\ | \fB--help\fP\ ]
[\ \fB--no-beep\fP\ ]
[\ \fB-n\fP\ | \fB--numeric\fP\ ]
[\ \fB-p\fP\ | \fB--port=\fP\fIport\fP\ ]
[\ \fB-s\fP\ | \fB--service=\fP\fIservice\fP\ ]
@ -238,6 +239,11 @@ runs as.
\fB-h\fP\ |\ \fB--help\fP
Display a brief usage message showing the valid command line parameters.
.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
When running in
.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
simultaneously. If this becomes a problem, users can typically
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.

View file

@ -128,7 +128,8 @@ VT100.prototype.reset = function(clearHistory) {
this.offsetMode = false;
this.mouseReporting = false;
this.utfEnabled = true;
this.visibleBell = false;
this.visualBell = suppressAllAudio != 'undefined' &&
suppressAllAudio;
this.utfCount = 0;
this.utfChar = 0;
this.style = '';
@ -209,7 +210,7 @@ VT100.prototype.initializeElements = function(container) {
try {
if (typeof navigator.mimeTypes["audio/x-wav"].enabledPlugin.name !=
'undefined') {
embed =
embed = suppressAllAudio ? "" :
'<embed classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' +
'id="beep_embed" ' +
'src="beep.wav" ' +
@ -219,7 +220,7 @@ VT100.prototype.initializeElements = function(container) {
'type="audio/x-wav" ' +
'height="16" ' +
'width="200" ' +
'style="position:absolute;left:-1000px;top:-1000px">';
'style="position:absolute;left:-1000px;top:-1000px" />';
}
} catch (e) {
}
@ -240,11 +241,15 @@ VT100.prototype.initializeElements = function(container) {
'<input type="textfield" id="input" />' +
'<input type="textfield" id="cliphelper" />' +
'<span id="attrib">&nbsp;</span>' +
embed + '<bgsound id="beep_bgsound" loop=1 />' +
(suppressAllAudio ? "" :
embed + '<bgsound id="beep_bgsound" loop=1 />') +
'</div>';
}
// 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,
'beep_embed');
if (!this.beeper || !this.beeper.Play) {
@ -254,6 +259,7 @@ VT100.prototype.initializeElements = function(container) {
this.beeper = undefined;
}
}
}
// Initialize the variables for finding the text console and the
// cursor.
@ -1441,7 +1447,7 @@ VT100.prototype.toggleUTF = function() {
};
VT100.prototype.toggleBell = function() {
this.visibleBell = !this.visibleBell;
this.visualBell = !this.visualBell;
};
VT100.prototype.about = function() {
@ -1475,7 +1481,7 @@ VT100.prototype.showContextMenu = function(x, y) {
'<li id="beginconfig">' +
(this.utfEnabled ? '&#10004; ' : '') + 'Unicode</li>' +
'<li id="endconfig">' +
(this.visibleBell ? '&#10004; ' : '') + 'Visible Bell</li>'+
(this.visualBell ? '&#10004; ' : '') + 'Visual Bell</li>'+
'<hr />' +
'<li id="about">About...</li>' +
'</ul>' +
@ -2064,7 +2070,7 @@ VT100.prototype.flashScreen = function() {
};
VT100.prototype.beep = function() {
if (this.visibleBell) {
if (this.visualBell) {
this.flashScreen();
} else {
try {