support for correct paths and for plugins without client hooks

This commit is contained in:
John McLear 2015-06-21 12:14:15 +01:00
parent c866f7ac77
commit 4840e7ed58

View file

@ -103,9 +103,11 @@ function sendPadHeaderFiles(res, callback){
if(key === "ep_etherpad-lite") return;
var plugin = plugins[key];
var client_hooks = plugin.parts[0].client_hooks;
if(client_hooks){
Object.keys(client_hooks).forEach(function(k){
pluginPaths.push(client_hooks[k]);
});
}
});
// Now we need to uniquify the array so we only have unique paths
@ -114,12 +116,14 @@ function sendPadHeaderFiles(res, callback){
})
// Next to join the array into a string so we can add it to the link value
var uniquePluginString = "'";
var uniquePluginString = "";
for (var i = 0; i < uniquePaths.length; i++) {
uniquePluginString += "<"+uniquePaths[i]+".js>; rel=prefetch\,";
uniquePluginString += "<static/plugins/"+uniquePaths[i]+".js>; rel=prefetch\, ";
}
// console.log("unique plugin string...", uniquePluginString)
res.set('Link', uniquePluginString + " <static/js/require-kernel.js>; rel=prefetch\, \
<javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define>; rel=prefetch\, \
<javascripts/lib/ep_etherpad-lite/static/js/ace2_common.js?callback=require.define>; rel=prefetch\, \
@ -133,6 +137,6 @@ function sendPadHeaderFiles(res, callback){
<static/css/iframe_editor.css>; rel=prefetch\, \
<pluginfw/plugin-definitions.json>; rel=prefetch\, \
<locales.json>; rel=prefetch\, \
<static/font/fontawesome-etherpad.woff>; rel=prefetch'");
<static/font/fontawesome-etherpad.woff>; rel=prefetch");
callback();
}