diff --git a/bin/installOnWindows.bat b/bin/installOnWindows.bat index b6f699de..0e3e2099 100644 --- a/bin/installOnWindows.bat +++ b/bin/installOnWindows.bat @@ -6,10 +6,6 @@ set JQUERY_VERSION=1.7 cd bin cd .. -echo _ -echo Setting up settings.json... -copy settings.json.template_windows settings.json - echo _ echo Updating node... curl -lo bin\node.exe http://nodejs.org/dist/v%NODE_VERSION%/node.exe @@ -23,13 +19,20 @@ echo Updating jquery... curl -lo "node_modules\ep_etherpad-lite\static\js\jquery.min.js" "http://code.jquery.com/jquery-%JQUERY_VERSION%.min.js" echo _ -echo Some other stuff... -copy node_modules\ep_etherpad-lite\static\custom\js.template node_modules\ep_etherpad-lite\static\custom\index.template -copy node_modules\ep_etherpad-lite\static\custom\js.template node_modules\ep_etherpad-lite\static\custom\pad.template -copy node_modules\ep_etherpad-lite\static\custom\js.template node_modules\ep_etherpad-lite\static\custom\timeslider.template -copy node_modules\ep_etherpad-lite\static\custom\css.template node_modules\ep_etherpad-lite\static\custom\index.template -copy node_modules\ep_etherpad-lite\static\custom\css.template node_modules\ep_etherpad-lite\static\custom\pad.template -copy node_modules\ep_etherpad-lite\static\custom\css.template node_modules\ep_etherpad-lite\static\custom\timeslider.template +echo Copying custom templates... +set custom_dir=node_modules\ep_etherpad-lite\static\custom +FOR %%f IN (index pad timeslider) DO ( + if NOT EXIST %custom_dir%\%%f.js copy %custom_dir%\js.template %custom_dir%\%%f.js + if NOT EXIST %custom_dir%\%%f.css copy %custom_dir%\css.template %custom_dir%\%%f.css +) + +echo _ +echo Clearing cache. +del /S var\minified* + +echo _ +echo Setting up settings.json... +IF NOT EXIST settings.json copy settings.json.template_windows settings.json echo _ echo Installed Etherpad-lite! \ No newline at end of file diff --git a/src/node/db/API.js b/src/node/db/API.js index e2b6f6f8..661b7859 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -48,6 +48,7 @@ exports.createGroupPad = groupManager.createGroupPad; exports.createAuthor = authorManager.createAuthor; exports.createAuthorIfNotExistsFor = authorManager.createAuthorIfNotExistsFor; exports.listPadsOfAuthor = authorManager.listPadsOfAuthor; +exports.padUsersCount = padMessageHandler.padUsersCount; /**********************/ /**SESSION FUNCTIONS***/ diff --git a/src/node/handler/APIHandler.js b/src/node/handler/APIHandler.js index 567a90d2..40c08441 100644 --- a/src/node/handler/APIHandler.js +++ b/src/node/handler/APIHandler.js @@ -65,7 +65,8 @@ var functions = { "getPublicStatus" : ["padID"], "setPassword" : ["padID", "password"], "isPasswordProtected" : ["padID"], - "listAuthorsOfPad" : ["padID"] + "listAuthorsOfPad" : ["padID"], + "padUsersCount" : ["padID"] }; /** diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index b356230c..9cf39669 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -1348,3 +1348,14 @@ function composePadChangesets(padId, startNum, endNum, callback) callback(null, changeset); }); } + +/** + * Get the number of users in a pad + */ +exports.padUsersCount = function (padID, callback) { + if (!pad2sessions[padID] || typeof pad2sessions[padID] != typeof []) { + callback(null, {padUsersCount: 0}); + } else { + callback(null, {padUsersCount: pad2sessions[padID].length}); + } +} diff --git a/src/node/hooks/express/padurlsanitize.js b/src/node/hooks/express/padurlsanitize.js index 229d013d..24ec2c3d 100644 --- a/src/node/hooks/express/padurlsanitize.js +++ b/src/node/hooks/express/padurlsanitize.js @@ -15,7 +15,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { //the pad id was sanitized, so we redirect to the sanitized version if(sanitizedPadId != padId) { - var real_url = req.url.replace(/^\/p\/[^\/]+/, '/p/' + sanitizedPadId); + var real_url = sanitizedPadId; var query = url.parse(req.url).query; if ( query ) real_url += '?' + query; res.header('Location', real_url); diff --git a/src/static/js/pluginfw/plugins.js b/src/static/js/pluginfw/plugins.js index 455dd203..7efcb49c 100644 --- a/src/static/js/pluginfw/plugins.js +++ b/src/static/js/pluginfw/plugins.js @@ -57,8 +57,8 @@ exports.loadFn = function (path, hookName) { var functionName , parts = path.split(":"); - // on windows - if(process.platform == 'win32') { + // on windows: C:\foo\bar:xyz + if(parts[0].length == 1) { if(parts.length == 3) functionName = parts.pop(); path = parts.join(":");