From 5a8a3627d24d6ff1a91d3c9be85987f665436923 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 8 Mar 2014 16:04:22 -0500 Subject: [PATCH] bringing subfolder installations to v0.4.0 - JUST FOR @PLANNER --- public/src/app.js | 3 ++- src/meta.js | 2 +- src/routes/plugins.js | 8 ++++---- src/socket.io/index.js | 4 ++-- src/webserver.js | 11 +++++------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/public/src/app.js b/public/src/app.js index 2eac126888..2308f440b9 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -28,7 +28,8 @@ var socket, var reconnection_delay = 200; socket = io.connect('', { 'max reconnection attempts': max_reconnection_attemps, - 'reconnection delay': reconnection_delay + 'reconnection delay': reconnection_delay, + resource: RELATIVE_PATH.slice(1) + '/socket.io' }); var reconnecting = false, diff --git a/src/meta.js b/src/meta.js index 197351a11d..f8196c9fba 100644 --- a/src/meta.js +++ b/src/meta.js @@ -246,7 +246,7 @@ var fs = require('fs'), 'src/overrides.js', 'src/utils.js' ], - minFile: nconf.get('relative_path') + 'nodebb.min.js', + minFile: 'nodebb.min.js', get: function (callback) { plugins.fireHook('filter:scripts.get', this.scripts, function(err, scripts) { var ctime, diff --git a/src/routes/plugins.js b/src/routes/plugins.js index 00f37d8d02..1d6d9684cb 100644 --- a/src/routes/plugins.js +++ b/src/routes/plugins.js @@ -6,9 +6,10 @@ var nconf = require('nconf'), validator = require('validator'), _ = require('underscore'), async = require('async'), - plugins = require('../plugins'), + plugins = require('../plugins'); - PluginRoutes = function(app) { +(function(Plugins) { + Plugins.createRoutes = function(app) { app.get('/plugins/fireHook', function(req, res) { // GET = filter plugins.fireHook('filter:' + req.query.hook, req.query.args, function(err, returnData) { @@ -70,5 +71,4 @@ var nconf = require('nconf'), } }); }; - -module.exports = PluginRoutes; +})(exports); diff --git a/src/socket.io/index.js b/src/socket.io/index.js index c62fd2f9c6..d477273649 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -28,11 +28,11 @@ var io; Sockets.init = function(server) { - io = socketioWildcard(SocketIO).listen(server, { log: false, transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket'], - 'browser client minification': true + 'browser client minification': true, + resource: nconf.get('relative_path') + '/socket.io' }); Sockets.server = io; diff --git a/src/webserver.js b/src/webserver.js index e6013d0752..6c658974db 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -33,7 +33,8 @@ var path = require('path'), userRoute = require('./routes/user'), apiRoute = require('./routes/api'), feedsRoute = require('./routes/feeds'), - metaRoute = require('./routes/meta'); + metaRoute = require('./routes/meta'), + pluginsRoute = require('./routes/plugins'); if(nconf.get('ssl')) { server = require('https').createServer({ @@ -312,7 +313,7 @@ process.on('uncaughtException', function(err) { // Theme's static directory if (themeData['theme:staticDir']) { - app.use('/css/assets', express.static(path.join(nconf.get('themes_path'), themeData['theme:id'], themeData['theme:staticDir']), { + app.use(nconf.get('relative_path') + '/css/assets', express.static(path.join(nconf.get('themes_path'), themeData['theme:id'], themeData['theme:staticDir']), { maxAge: app.enabled('cache') ? 5184000000 : 0 })); if (process.env.NODE_ENV === 'development') { @@ -321,7 +322,7 @@ process.on('uncaughtException', function(err) { } if (themeData['theme:templates']) { - app.use('/templates', express.static(path.join(nconf.get('themes_path'), themeData['theme:id'], themeData['theme:templates']), { + app.use(nconf.get('relative_path') + '/templates', express.static(path.join(nconf.get('themes_path'), themeData['theme:id'], themeData['theme:templates']), { maxAge: app.enabled('cache') ? 5184000000 : 0 })); if (process.env.NODE_ENV === 'development') { @@ -493,6 +494,7 @@ process.on('uncaughtException', function(err) { userRoute.createRoutes(app); apiRoute.createRoutes(app); feedsRoute.createRoutes(app); + pluginsRoute.createRoutes(app); // Basic Routes (entirely client-side parsed, goal is to move the rest of the crap in this file into this one section) (function () { @@ -939,9 +941,6 @@ process.on('uncaughtException', function(err) { }); }); - // Other routes - require('./routes/plugins')(app); - // Debug routes if (process.env.NODE_ENV === 'development') { require('./routes/debug')(app);