Merge branch 'develop' of github.com:ether/etherpad-lite into backend-tests

pull/2344/head
John McLear 2014-11-26 15:33:13 +00:00
commit 88b3d99fbd
7 changed files with 36 additions and 22 deletions

View File

@ -99,7 +99,7 @@ fi
echo "Clear minfified cache..."
rm -f var/minified*
echo "ensure custom css/js files are created..."
echo "Ensure custom css/js files are created..."
for f in "index" "pad" "timeslider"
do

View File

@ -32,7 +32,7 @@ fi
bin/installDeps.sh $* || exit 1
#Move to the node folder and start
echo "start..."
echo "Started Etherpad..."
SCRIPTPATH=`pwd -P`
node $SCRIPTPATH/node_modules/ep_etherpad-lite/node/server.js $*

View File

@ -234,7 +234,19 @@ exports.doImport = function(req, res, padId)
ERR(err);
//close the connection
res.send("<head><script type='text/javascript' src='../../static/js/jquery.js'></script><script type='text/javascript' src='../../static/js/browser.js'></script></head><script>$(window).load(function(){if ( (!browser.msie) && (!(browser.mozilla && browser.version.indexOf(\"1.8.\") == 0)) ){document.domain = document.domain;}var impexp = window.parent.padimpexp.handleFrameCall('" + status + "');})</script>", 200);
res.send(
"<head> \
<script type='text/javascript' src='../../static/js/jquery.js'></script> \
</head> \
<script> \
$(window).load(function(){ \
if(navigator.userAgent.indexOf('MSIE') === -1){ \
document.domain = document.domain; \
} \
var impexp = window.parent.padimpexp.handleFrameCall('" + status + "'); \
}) \
</script>"
, 200);
});
}

View File

@ -1,24 +1,22 @@
var log4js = require('log4js');
var settings = require('../../utils/Settings');
var socketio = require('socket.io');
var socketIORouter = require("../../handler/SocketIORouter");
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
var webaccess = require("ep_etherpad-lite/node/hooks/express/webaccess");
// there shouldn't be a browser that isn't compatible to all
// transports in this list at once
// e.g. XHR is disabled in IE by default, so in IE it should use jsonp-polling
var socketio = require('socket.io')({
transports: settings.socketTransportProtocols
});
var padMessageHandler = require("../../handler/PadMessageHandler");
var connect = require('connect');
exports.expressCreateServer = function (hook_name, args, cb) {
//init socket.io and redirect all requests to the MessageHandler
var io = socketio.listen(args.server);
// there shouldn't be a browser that isn't compatible to all
// transports in this list at once
// e.g. XHR is disabled in IE by default, so in IE it should use jsonp-polling
var io = socketio({
transports: settings.socketTransportProtocols
}).listen(args.server);
/* Require an express session cookie to be present, and load the
* session. See http://www.danielbaulig.de/socket-ioexpress for more

View File

@ -14,23 +14,22 @@
* limitations under the License.
*/
var jsdom = require('jsdom-nocontextifiy').jsdom;
var log4js = require('log4js');
var Changeset = require("ep_etherpad-lite/static/js/Changeset");
var contentcollector = require("ep_etherpad-lite/static/js/contentcollector");
var cheerio = require("cheerio");
function setPadHTML(pad, html, callback)
{
var apiLogger = log4js.getLogger("ImportHtml");
// Parse the incoming HTML with jsdom
try{
var doc = jsdom(html.replace(/>\n+</g, '><'));
}catch(e){
apiLogger.warn("Error importing, possibly caused by malformed HTML");
var doc = jsdom("<html><body><div>Error during import, possibly malformed HTML</div></body></html>");
}
var $ = cheerio.load(html);
// Appends a line break, used by Etherpad to ensure a caret is available
// below the last line of an import
$('body').append("<p></p>");
var doc = $('html')[0];
apiLogger.debug('html:');
apiLogger.debug(html);
@ -38,7 +37,7 @@ function setPadHTML(pad, html, callback)
// using the content collector object
var cc = contentcollector.makeContentCollector(true, null, pad.pool);
try{ // we use a try here because if the HTML is bad it will blow up
cc.collectContent(doc.childNodes[0]);
cc.collectContent(doc);
}catch(e){
apiLogger.warn("HTML was not properly formed", e);
return; // We don't process the HTML because it was bad..

View File

@ -25,7 +25,7 @@
"formidable" : "1.0.9",
"log4js" : "0.6.6",
"nodemailer" : "0.3.x",
"jsdom-nocontextifiy" : "0.2.10",
"cheerio" : "0.18.0",
"async-stacktrace" : "0.0.2",
"npm" : "1.4.x",
"ejs" : "0.6.1",

View File

@ -54,10 +54,14 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
},
nodeNumChildren: function(n)
{
if(n.childNodes == null) return 0;
return n.childNodes.length;
},
nodeChild: function(n, i)
{
if(n.childNodes.item == null){
return n.childNodes[i];
}
return n.childNodes.item(i);
},
nodeProp: function(n, p)
@ -66,6 +70,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
},
nodeAttr: function(n, a)
{
if(n.getAttribute == null) return null;
return n.getAttribute(a);
},
optNodeInnerHTML: function(n)