More fine tuning of the regular expressions that detect URLs. We now allow '.' and ',' in URLs, as long as they are not at the very end of the URL, where they would probably be part of the enclosing sentence and not actually part of the URL.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@143 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
parent
8920606f6f
commit
d96e312a70
8 changed files with 35 additions and 30 deletions
|
@ -3,6 +3,11 @@
|
||||||
* Optionally compress large responses, if the browser accepts
|
* Optionally compress large responses, if the browser accepts
|
||||||
deflate compression. This mainly improves start up time.
|
deflate compression. This mainly improves start up time.
|
||||||
|
|
||||||
|
* More fine tuning of the regular expressions that detect URLs.
|
||||||
|
We now allow '.' and ',' in URLs, as long as they are not at the
|
||||||
|
very end of the URL, where they would probably be part of the
|
||||||
|
enclosing sentence and not actually part of the URL.
|
||||||
|
|
||||||
2009-07-06 Markus Gutschke <markus@shellinabox.com>
|
2009-07-06 Markus Gutschke <markus@shellinabox.com>
|
||||||
|
|
||||||
* Making it easier to host the terminal on non-root URLs by always
|
* Making it easier to host the terminal on non-root URLs by always
|
||||||
|
|
2
config.h
2
config.h
|
@ -135,7 +135,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 "142"
|
#define VCS_REVISION "143"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "2.9"
|
#define VERSION "2.9"
|
||||||
|
|
2
configure
vendored
2
configure
vendored
|
@ -2037,7 +2037,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=142
|
VCS_REVISION=143
|
||||||
|
|
||||||
|
|
||||||
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.9, markus@shellinabox.com)
|
AC_INIT(shellinabox, 2.9, markus@shellinabox.com)
|
||||||
VCS_REVISION=142
|
VCS_REVISION=143
|
||||||
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])
|
||||||
|
|
|
@ -104,7 +104,7 @@ function VT100(container) {
|
||||||
'(?:http|https|ftp)://' +
|
'(?:http|https|ftp)://' +
|
||||||
|
|
||||||
// Optionally allow username and passwords.
|
// Optionally allow username and passwords.
|
||||||
'(?:[^:@/ ]*(?::[^@/ ]*)?@)?' +
|
'(?:[^:@/ \u00A0]*(?::[^@/ \u00A0]*)?@)?' +
|
||||||
|
|
||||||
// Hostname.
|
// Hostname.
|
||||||
'(?:[1-9][0-9]{0,2}(?:[.][1-9][0-9]{0,2}){3}|' +
|
'(?:[1-9][0-9]{0,2}(?:[.][1-9][0-9]{0,2}){3}|' +
|
||||||
|
@ -115,12 +115,12 @@ function VT100(container) {
|
||||||
'(?::[1-9][0-9]*)?' +
|
'(?::[1-9][0-9]*)?' +
|
||||||
|
|
||||||
// Path.
|
// Path.
|
||||||
'(?:/[^/,.) ]*)*|' +
|
'(?:/(?:(?![/ \u00A0]|[,.)][ \u00A0]|[,.)]$).)*)*|' +
|
||||||
|
|
||||||
(linkifyURLs <= 1 ? '' :
|
(linkifyURLs <= 1 ? '' :
|
||||||
// Also support URLs without a protocol (assume "http").
|
// Also support URLs without a protocol (assume "http").
|
||||||
// Optional username and password.
|
// Optional username and password.
|
||||||
'(?:[^:@/ ]*(?::[^@/ ]*)?@)?' +
|
'(?:[^:@/ \u00A0]*(?::[^@/ \u00A0]*)?@)?' +
|
||||||
|
|
||||||
// Hostnames must end with a well-known top-level domain or must be
|
// Hostnames must end with a well-known top-level domain or must be
|
||||||
// numeric.
|
// numeric.
|
||||||
|
@ -146,7 +146,7 @@ function VT100(container) {
|
||||||
'(?::[1-9][0-9]{0,4})?' +
|
'(?::[1-9][0-9]{0,4})?' +
|
||||||
|
|
||||||
// Path.
|
// Path.
|
||||||
'(?:/[^/,.) ]*)*|') +
|
'(?:/(?:(?![/ \u00A0]|[,.)][ \u00A0]|[,.)]$).)*)*|') +
|
||||||
|
|
||||||
// In addition, support e-mail address. Optionally, recognize "mailto:"
|
// In addition, support e-mail address. Optionally, recognize "mailto:"
|
||||||
'(?:mailto:)' + (linkifyURLs <= 1 ? '' : '?') +
|
'(?:mailto:)' + (linkifyURLs <= 1 ? '' : '?') +
|
||||||
|
@ -171,7 +171,7 @@ function VT100(container) {
|
||||||
'yu|za|zm|zw|arpa)(?![a-zA-Z0-9])|[Xx][Nn]--[-a-zA-Z0-9]+)' +
|
'yu|za|zm|zw|arpa)(?![a-zA-Z0-9])|[Xx][Nn]--[-a-zA-Z0-9]+)' +
|
||||||
|
|
||||||
// Optional arguments
|
// Optional arguments
|
||||||
'(?:[?][^/,.) ]+)?');
|
'(?:[?](?:(?![ \u00A0]|[,.)][ \u00A0]|[,.)]$).)*)?');
|
||||||
}
|
}
|
||||||
this.initializeElements(container);
|
this.initializeElements(container);
|
||||||
this.initializeAnsiColors();
|
this.initializeAnsiColors();
|
||||||
|
@ -980,7 +980,7 @@ VT100.prototype.truncateLines = function(width) {
|
||||||
if (line.tagName == 'DIV') {
|
if (line.tagName == 'DIV') {
|
||||||
var x = 0;
|
var x = 0;
|
||||||
|
|
||||||
// Traverse current line and truncate if once we saw "width" characters
|
// Traverse current line and truncate it once we saw "width" characters
|
||||||
for (var span = line.firstChild; span;
|
for (var span = line.firstChild; span;
|
||||||
span = span.nextSibling) {
|
span = span.nextSibling) {
|
||||||
var s = this.getTextContent(span);
|
var s = this.getTextContent(span);
|
||||||
|
@ -1000,7 +1000,7 @@ VT100.prototype.truncateLines = function(width) {
|
||||||
// Scan backwards looking for first non-space character
|
// Scan backwards looking for first non-space character
|
||||||
var s = this.getTextContent(span);
|
var s = this.getTextContent(span);
|
||||||
for (var i = s.length; i--; ) {
|
for (var i = s.length; i--; ) {
|
||||||
if (s.charAt(i) != ' ') {
|
if (s.charAt(i) != ' ' && s.charAt(i) != '\u00A0') {
|
||||||
if (i+1 != s.length) {
|
if (i+1 != s.length) {
|
||||||
this.setTextContent(s.substr(0, i+1));
|
this.setTextContent(s.substr(0, i+1));
|
||||||
}
|
}
|
||||||
|
@ -1253,7 +1253,7 @@ VT100.prototype.putString = function(x, y, text, style) {
|
||||||
// Scan backwards looking for first non-space character
|
// Scan backwards looking for first non-space character
|
||||||
s = this.getTextContent(span);
|
s = this.getTextContent(span);
|
||||||
for (var i = s.length; i--; ) {
|
for (var i = s.length; i--; ) {
|
||||||
if (s.charAt(i) != ' ') {
|
if (s.charAt(i) != ' ' && s.charAt(i) != '\u00A0') {
|
||||||
if (i+1 != s.length) {
|
if (i+1 != s.length) {
|
||||||
this.setTextContent(s.substr(0, i+1));
|
this.setTextContent(s.substr(0, i+1));
|
||||||
}
|
}
|
||||||
|
@ -1693,7 +1693,7 @@ VT100.prototype.toggleBell = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.about = function() {
|
VT100.prototype.about = function() {
|
||||||
alert("VT100 Terminal Emulator " + "2.9 (revision 142)" +
|
alert("VT100 Terminal Emulator " + "2.9 (revision 143)" +
|
||||||
"\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");
|
||||||
};
|
};
|
||||||
|
|
|
@ -355,7 +355,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ShellInABox.prototype.about = function() {
|
ShellInABox.prototype.about = function() {
|
||||||
alert("Shell In A Box version " + "2.9 (revision 142)" +
|
alert("Shell In A Box version " + "2.9 (revision 143)" +
|
||||||
"\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 ?
|
||||||
|
|
|
@ -104,7 +104,7 @@ function VT100(container) {
|
||||||
'(?:http|https|ftp)://' +
|
'(?:http|https|ftp)://' +
|
||||||
|
|
||||||
// Optionally allow username and passwords.
|
// Optionally allow username and passwords.
|
||||||
'(?:[^:@/ ]*(?::[^@/ ]*)?@)?' +
|
'(?:[^:@/ \u00A0]*(?::[^@/ \u00A0]*)?@)?' +
|
||||||
|
|
||||||
// Hostname.
|
// Hostname.
|
||||||
'(?:[1-9][0-9]{0,2}(?:[.][1-9][0-9]{0,2}){3}|' +
|
'(?:[1-9][0-9]{0,2}(?:[.][1-9][0-9]{0,2}){3}|' +
|
||||||
|
@ -115,12 +115,12 @@ function VT100(container) {
|
||||||
'(?::[1-9][0-9]*)?' +
|
'(?::[1-9][0-9]*)?' +
|
||||||
|
|
||||||
// Path.
|
// Path.
|
||||||
'(?:/[^/,.) ]*)*|' +
|
'(?:/(?:(?![/ \u00A0]|[,.)][ \u00A0]|[,.)]$).)*)*|' +
|
||||||
|
|
||||||
(linkifyURLs <= 1 ? '' :
|
(linkifyURLs <= 1 ? '' :
|
||||||
// Also support URLs without a protocol (assume "http").
|
// Also support URLs without a protocol (assume "http").
|
||||||
// Optional username and password.
|
// Optional username and password.
|
||||||
'(?:[^:@/ ]*(?::[^@/ ]*)?@)?' +
|
'(?:[^:@/ \u00A0]*(?::[^@/ \u00A0]*)?@)?' +
|
||||||
|
|
||||||
// Hostnames must end with a well-known top-level domain or must be
|
// Hostnames must end with a well-known top-level domain or must be
|
||||||
// numeric.
|
// numeric.
|
||||||
|
@ -146,7 +146,7 @@ function VT100(container) {
|
||||||
'(?::[1-9][0-9]{0,4})?' +
|
'(?::[1-9][0-9]{0,4})?' +
|
||||||
|
|
||||||
// Path.
|
// Path.
|
||||||
'(?:/[^/,.) ]*)*|') +
|
'(?:/(?:(?![/ \u00A0]|[,.)][ \u00A0]|[,.)]$).)*)*|') +
|
||||||
|
|
||||||
// In addition, support e-mail address. Optionally, recognize "mailto:"
|
// In addition, support e-mail address. Optionally, recognize "mailto:"
|
||||||
'(?:mailto:)' + (linkifyURLs <= 1 ? '' : '?') +
|
'(?:mailto:)' + (linkifyURLs <= 1 ? '' : '?') +
|
||||||
|
@ -171,7 +171,7 @@ function VT100(container) {
|
||||||
'yu|za|zm|zw|arpa)(?![a-zA-Z0-9])|[Xx][Nn]--[-a-zA-Z0-9]+)' +
|
'yu|za|zm|zw|arpa)(?![a-zA-Z0-9])|[Xx][Nn]--[-a-zA-Z0-9]+)' +
|
||||||
|
|
||||||
// Optional arguments
|
// Optional arguments
|
||||||
'(?:[?][^/,.) ]+)?');
|
'(?:[?](?:(?![ \u00A0]|[,.)][ \u00A0]|[,.)]$).)*)?');
|
||||||
}
|
}
|
||||||
this.initializeElements(container);
|
this.initializeElements(container);
|
||||||
this.initializeAnsiColors();
|
this.initializeAnsiColors();
|
||||||
|
@ -980,7 +980,7 @@ VT100.prototype.truncateLines = function(width) {
|
||||||
if (line.tagName == 'DIV') {
|
if (line.tagName == 'DIV') {
|
||||||
var x = 0;
|
var x = 0;
|
||||||
|
|
||||||
// Traverse current line and truncate if once we saw "width" characters
|
// Traverse current line and truncate it once we saw "width" characters
|
||||||
for (var span = line.firstChild; span;
|
for (var span = line.firstChild; span;
|
||||||
span = span.nextSibling) {
|
span = span.nextSibling) {
|
||||||
var s = this.getTextContent(span);
|
var s = this.getTextContent(span);
|
||||||
|
@ -1000,7 +1000,7 @@ VT100.prototype.truncateLines = function(width) {
|
||||||
// Scan backwards looking for first non-space character
|
// Scan backwards looking for first non-space character
|
||||||
var s = this.getTextContent(span);
|
var s = this.getTextContent(span);
|
||||||
for (var i = s.length; i--; ) {
|
for (var i = s.length; i--; ) {
|
||||||
if (s.charAt(i) != ' ') {
|
if (s.charAt(i) != ' ' && s.charAt(i) != '\u00A0') {
|
||||||
if (i+1 != s.length) {
|
if (i+1 != s.length) {
|
||||||
this.setTextContent(s.substr(0, i+1));
|
this.setTextContent(s.substr(0, i+1));
|
||||||
}
|
}
|
||||||
|
@ -1253,7 +1253,7 @@ VT100.prototype.putString = function(x, y, text, style) {
|
||||||
// Scan backwards looking for first non-space character
|
// Scan backwards looking for first non-space character
|
||||||
s = this.getTextContent(span);
|
s = this.getTextContent(span);
|
||||||
for (var i = s.length; i--; ) {
|
for (var i = s.length; i--; ) {
|
||||||
if (s.charAt(i) != ' ') {
|
if (s.charAt(i) != ' ' && s.charAt(i) != '\u00A0') {
|
||||||
if (i+1 != s.length) {
|
if (i+1 != s.length) {
|
||||||
this.setTextContent(s.substr(0, i+1));
|
this.setTextContent(s.substr(0, i+1));
|
||||||
}
|
}
|
||||||
|
@ -1693,7 +1693,7 @@ VT100.prototype.toggleBell = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.about = function() {
|
VT100.prototype.about = function() {
|
||||||
alert("VT100 Terminal Emulator " + "2.9 (revision 142)" +
|
alert("VT100 Terminal Emulator " + "2.9 (revision 143)" +
|
||||||
"\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");
|
||||||
};
|
};
|
||||||
|
|
|
@ -104,7 +104,7 @@ function VT100(container) {
|
||||||
'(?:http|https|ftp)://' +
|
'(?:http|https|ftp)://' +
|
||||||
|
|
||||||
// Optionally allow username and passwords.
|
// Optionally allow username and passwords.
|
||||||
'(?:[^:@/ ]*(?::[^@/ ]*)?@)?' +
|
'(?:[^:@/ \u00A0]*(?::[^@/ \u00A0]*)?@)?' +
|
||||||
|
|
||||||
// Hostname.
|
// Hostname.
|
||||||
'(?:[1-9][0-9]{0,2}(?:[.][1-9][0-9]{0,2}){3}|' +
|
'(?:[1-9][0-9]{0,2}(?:[.][1-9][0-9]{0,2}){3}|' +
|
||||||
|
@ -115,12 +115,12 @@ function VT100(container) {
|
||||||
'(?::[1-9][0-9]*)?' +
|
'(?::[1-9][0-9]*)?' +
|
||||||
|
|
||||||
// Path.
|
// Path.
|
||||||
'(?:/[^/,.) ]*)*|' +
|
'(?:/(?:(?![/ \u00A0]|[,.)][ \u00A0]|[,.)]$).)*)*|' +
|
||||||
|
|
||||||
(linkifyURLs <= 1 ? '' :
|
(linkifyURLs <= 1 ? '' :
|
||||||
// Also support URLs without a protocol (assume "http").
|
// Also support URLs without a protocol (assume "http").
|
||||||
// Optional username and password.
|
// Optional username and password.
|
||||||
'(?:[^:@/ ]*(?::[^@/ ]*)?@)?' +
|
'(?:[^:@/ \u00A0]*(?::[^@/ \u00A0]*)?@)?' +
|
||||||
|
|
||||||
// Hostnames must end with a well-known top-level domain or must be
|
// Hostnames must end with a well-known top-level domain or must be
|
||||||
// numeric.
|
// numeric.
|
||||||
|
@ -146,7 +146,7 @@ function VT100(container) {
|
||||||
'(?::[1-9][0-9]{0,4})?' +
|
'(?::[1-9][0-9]{0,4})?' +
|
||||||
|
|
||||||
// Path.
|
// Path.
|
||||||
'(?:/[^/,.) ]*)*|') +
|
'(?:/(?:(?![/ \u00A0]|[,.)][ \u00A0]|[,.)]$).)*)*|') +
|
||||||
|
|
||||||
// In addition, support e-mail address. Optionally, recognize "mailto:"
|
// In addition, support e-mail address. Optionally, recognize "mailto:"
|
||||||
'(?:mailto:)' + (linkifyURLs <= 1 ? '' : '?') +
|
'(?:mailto:)' + (linkifyURLs <= 1 ? '' : '?') +
|
||||||
|
@ -171,7 +171,7 @@ function VT100(container) {
|
||||||
'yu|za|zm|zw|arpa)(?![a-zA-Z0-9])|[Xx][Nn]--[-a-zA-Z0-9]+)' +
|
'yu|za|zm|zw|arpa)(?![a-zA-Z0-9])|[Xx][Nn]--[-a-zA-Z0-9]+)' +
|
||||||
|
|
||||||
// Optional arguments
|
// Optional arguments
|
||||||
'(?:[?][^/,.) ]+)?');
|
'(?:[?](?:(?![ \u00A0]|[,.)][ \u00A0]|[,.)]$).)*)?');
|
||||||
}
|
}
|
||||||
this.initializeElements(container);
|
this.initializeElements(container);
|
||||||
this.initializeAnsiColors();
|
this.initializeAnsiColors();
|
||||||
|
@ -980,7 +980,7 @@ VT100.prototype.truncateLines = function(width) {
|
||||||
if (line.tagName == 'DIV') {
|
if (line.tagName == 'DIV') {
|
||||||
var x = 0;
|
var x = 0;
|
||||||
|
|
||||||
// Traverse current line and truncate if once we saw "width" characters
|
// Traverse current line and truncate it once we saw "width" characters
|
||||||
for (var span = line.firstChild; span;
|
for (var span = line.firstChild; span;
|
||||||
span = span.nextSibling) {
|
span = span.nextSibling) {
|
||||||
var s = this.getTextContent(span);
|
var s = this.getTextContent(span);
|
||||||
|
@ -1000,7 +1000,7 @@ VT100.prototype.truncateLines = function(width) {
|
||||||
// Scan backwards looking for first non-space character
|
// Scan backwards looking for first non-space character
|
||||||
var s = this.getTextContent(span);
|
var s = this.getTextContent(span);
|
||||||
for (var i = s.length; i--; ) {
|
for (var i = s.length; i--; ) {
|
||||||
if (s.charAt(i) != ' ') {
|
if (s.charAt(i) != ' ' && s.charAt(i) != '\u00A0') {
|
||||||
if (i+1 != s.length) {
|
if (i+1 != s.length) {
|
||||||
this.setTextContent(s.substr(0, i+1));
|
this.setTextContent(s.substr(0, i+1));
|
||||||
}
|
}
|
||||||
|
@ -1253,7 +1253,7 @@ VT100.prototype.putString = function(x, y, text, style) {
|
||||||
// Scan backwards looking for first non-space character
|
// Scan backwards looking for first non-space character
|
||||||
s = this.getTextContent(span);
|
s = this.getTextContent(span);
|
||||||
for (var i = s.length; i--; ) {
|
for (var i = s.length; i--; ) {
|
||||||
if (s.charAt(i) != ' ') {
|
if (s.charAt(i) != ' ' && s.charAt(i) != '\u00A0') {
|
||||||
if (i+1 != s.length) {
|
if (i+1 != s.length) {
|
||||||
this.setTextContent(s.substr(0, i+1));
|
this.setTextContent(s.substr(0, i+1));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue