Merge pull request #2319 from ether/fix-socket-admin-etc

Fixing admin issues due to socket upgrade
This commit is contained in:
John McLear 2014-11-23 14:15:28 +00:00
commit b0872cc447
4 changed files with 9 additions and 6 deletions

View File

@ -14,7 +14,6 @@ exports.expressCreateServer = function (hook_name, args, cb) {
search_results: {},
errors: [],
};
res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins.html", render_args) );
});
args.app.get('/admin/plugins/info', function(req, res) {
@ -25,7 +24,8 @@ exports.expressCreateServer = function (hook_name, args, cb) {
exports.socketio = function (hook_name, args, cb) {
var io = args.io.of("/pluginfw/installer");
io.on('connection', function (socket) {
if (!socket.handshake.session.user || !socket.handshake.session.user.is_admin) return;
if (!socket.conn.request.session || !socket.conn.request.session.user || !socket.conn.request.session.user.is_admin) return;
socket.on("getInstalled", function (query) {
// send currently installed plugins
@ -107,4 +107,4 @@ function sortPluginList(plugins, property, /*ASC?*/dir) {
// a must be equal to b
return 0;
})
}
}

View File

@ -22,7 +22,8 @@ exports.expressCreateServer = function (hook_name, args, cb) {
exports.socketio = function (hook_name, args, cb) {
var io = args.io.of("/settings");
io.on('connection', function (socket) {
if (!socket.handshake.session.user || !socket.handshake.session.user.is_admin) return;
if (!socket.conn.request.session || !socket.conn.request.session.user || !socket.conn.request.session.user.is_admin) return;
socket.on("load", function (query) {
fs.readFile('settings.json', 'utf8', function (err,data) {

View File

@ -10,7 +10,8 @@ $(document).ready(function () {
resource = baseURL.substring(1) + "socket.io";
//connect
socket = io.connect(url, {resource : resource}).of("/pluginfw/installer");
var room = url + "pluginfw/installer";
socket = io.connect(room, {resource : resource});
function search(searchTerm, limit) {
if(search.searchTerm != searchTerm) {

View File

@ -9,7 +9,8 @@ $(document).ready(function () {
resource = baseURL.substring(1) + "socket.io";
//connect
socket = io.connect(url, {resource : resource}).of("/settings");
var room = url + "settings";
socket = io.connect(room, {resource : resource});
socket.on('settings', function (settings) {