barisusakli 11 years ago
commit 1568c50906

@ -28,7 +28,8 @@ var socket,
var reconnection_delay = 200; var reconnection_delay = 200;
socket = io.connect('', { socket = io.connect('', {
'max reconnection attempts': max_reconnection_attemps, 'max reconnection attempts': max_reconnection_attemps,
'reconnection delay': reconnection_delay 'reconnection delay': reconnection_delay,
resource: RELATIVE_PATH.length ? RELATIVE_PATH.slice(1) + '/socket.io' : 'socket.io'
}); });
var reconnecting = false, var reconnecting = false,

@ -246,7 +246,7 @@ var fs = require('fs'),
'src/overrides.js', 'src/overrides.js',
'src/utils.js' 'src/utils.js'
], ],
minFile: nconf.get('relative_path') + 'nodebb.min.js', minFile: 'nodebb.min.js',
get: function (callback) { get: function (callback) {
plugins.fireHook('filter:scripts.get', this.scripts, function(err, scripts) { plugins.fireHook('filter:scripts.get', this.scripts, function(err, scripts) {
var ctime, var ctime,

@ -6,9 +6,10 @@ var nconf = require('nconf'),
validator = require('validator'), validator = require('validator'),
_ = require('underscore'), _ = require('underscore'),
async = require('async'), 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) { app.get('/plugins/fireHook', function(req, res) {
// GET = filter // GET = filter
plugins.fireHook('filter:' + req.query.hook, req.query.args, function(err, returnData) { plugins.fireHook('filter:' + req.query.hook, req.query.args, function(err, returnData) {
@ -70,5 +71,4 @@ var nconf = require('nconf'),
} }
}); });
}; };
})(exports);
module.exports = PluginRoutes;

@ -28,11 +28,11 @@ var io;
Sockets.init = function(server) { Sockets.init = function(server) {
io = socketioWildcard(SocketIO).listen(server, { io = socketioWildcard(SocketIO).listen(server, {
log: false, log: false,
transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket'], 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; Sockets.server = io;

@ -33,7 +33,8 @@ var path = require('path'),
userRoute = require('./routes/user'), userRoute = require('./routes/user'),
apiRoute = require('./routes/api'), apiRoute = require('./routes/api'),
feedsRoute = require('./routes/feeds'), feedsRoute = require('./routes/feeds'),
metaRoute = require('./routes/meta'); metaRoute = require('./routes/meta'),
pluginsRoute = require('./routes/plugins');
if(nconf.get('ssl')) { if(nconf.get('ssl')) {
server = require('https').createServer({ server = require('https').createServer({
@ -247,7 +248,7 @@ process.on('uncaughtException', function(err) {
if (meta.config['brand:logo'] && validator.isURL(meta.config['brand:logo'])) { if (meta.config['brand:logo'] && validator.isURL(meta.config['brand:logo'])) {
return res.redirect(meta.config['brand:logo']); return res.redirect(meta.config['brand:logo']);
} else { } else {
return res.sendfile(path.join(__dirname, '../public', meta.config['brand:logo'] || nconf.get('relative_path') + '/logo.png'), { return res.sendfile(path.join(__dirname, '../public', meta.config['brand:logo'] || '/logo.png'), {
maxAge: app.enabled('cache') ? 5184000000 : 0 maxAge: app.enabled('cache') ? 5184000000 : 0
}); });
} }
@ -312,7 +313,7 @@ process.on('uncaughtException', function(err) {
// Theme's static directory // Theme's static directory
if (themeData['theme:staticDir']) { 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 maxAge: app.enabled('cache') ? 5184000000 : 0
})); }));
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
@ -321,7 +322,7 @@ process.on('uncaughtException', function(err) {
} }
if (themeData['theme:templates']) { 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 maxAge: app.enabled('cache') ? 5184000000 : 0
})); }));
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
@ -493,6 +494,7 @@ process.on('uncaughtException', function(err) {
userRoute.createRoutes(app); userRoute.createRoutes(app);
apiRoute.createRoutes(app); apiRoute.createRoutes(app);
feedsRoute.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) // Basic Routes (entirely client-side parsed, goal is to move the rest of the crap in this file into this one section)
(function () { (function () {
@ -939,9 +941,6 @@ process.on('uncaughtException', function(err) {
}); });
}); });
// Other routes
require('./routes/plugins')(app);
// Debug routes // Debug routes
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
require('./routes/debug')(app); require('./routes/debug')(app);

Loading…
Cancel
Save