mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	closes #171
This commit is contained in:
		
							
								
								
									
										4
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								app.js
									
									
									
									
									
								
							| @@ -18,10 +18,10 @@ | |||||||
|  |  | ||||||
| var fs = require('fs'), | var fs = require('fs'), | ||||||
| 	winston = require('winston'), | 	winston = require('winston'), | ||||||
| 	nconf = require('nconf'), |  | ||||||
| 	pkg = require('./package.json'), | 	pkg = require('./package.json'), | ||||||
| 	url = require('url'); | 	url = require('url'); | ||||||
|  |  | ||||||
|  | nconf = require('nconf'); | ||||||
| // Runtime environment | // Runtime environment | ||||||
| global.env = process.env.NODE_ENV || 'production', | global.env = process.env.NODE_ENV || 'production', | ||||||
|  |  | ||||||
| @@ -54,7 +54,7 @@ if(nconf.get('upgrade')) { | |||||||
| } else if (!nconf.get('setup') && nconf.get('base_url')) { | } else if (!nconf.get('setup') && nconf.get('base_url')) { | ||||||
| 	nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path') + '/'); | 	nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path') + '/'); | ||||||
| 	nconf.set('upload_url', nconf.get('url') + 'uploads/'); | 	nconf.set('upload_url', nconf.get('url') + 'uploads/'); | ||||||
| 	global.nconf = nconf; |  | ||||||
|  |  | ||||||
| 	winston.info('Initializing NodeBB v' + pkg.version + ', on port ' + nconf.get('port') + ', using Redis store at ' + nconf.get('redis:host') + ':' + nconf.get('redis:port') + '.'); | 	winston.info('Initializing NodeBB v' + pkg.version + ', on port ' + nconf.get('port') + ', using Redis store at ' + nconf.get('redis:host') + ':' + nconf.get('redis:port') + '.'); | ||||||
| 	winston.info('Base Configuration OK.'); | 	winston.info('Base Configuration OK.'); | ||||||
|   | |||||||
| @@ -181,7 +181,7 @@ | |||||||
| 			if (!templates[tpl_url] || !template_data) return; | 			if (!templates[tpl_url] || !template_data) return; | ||||||
| 			 | 			 | ||||||
| 			if(typeof global !== "undefined") | 			if(typeof global !== "undefined") | ||||||
| 				template_data['relative_path'] = global.nconf.get('relative_path'); | 				template_data['relative_path'] = nconf.get('relative_path'); | ||||||
| 			else  | 			else  | ||||||
| 				template_data['relative_path'] = RELATIVE_PATH; | 				template_data['relative_path'] = RELATIVE_PATH; | ||||||
| 			 | 			 | ||||||
|   | |||||||
| @@ -31,7 +31,10 @@ | |||||||
| 		"unread": "unread", | 		"unread": "unread", | ||||||
| 		"popular": "category", | 		"popular": "category", | ||||||
| 		"active": "category", | 		"active": "category", | ||||||
| 		"search": "search" | 		"search": "search", | ||||||
|  | 		"reset/[^]*": "reset_code", | ||||||
|  | 		"reset": "reset" | ||||||
|  | 		 | ||||||
| 	}, | 	}, | ||||||
| 	"force_refresh": { | 	"force_refresh": { | ||||||
| 		"logout": true | 		"logout": true | ||||||
|   | |||||||
| @@ -39,9 +39,9 @@ var	RDB = require('./redis.js'), | |||||||
| 					'category_id': category_id, | 					'category_id': category_id, | ||||||
| 					'active_users': [], | 					'active_users': [], | ||||||
| 					'topics' : [], | 					'topics' : [], | ||||||
| 					'twitter-intent-url': 'https://twitter.com/intent/tweet?url=' + encodeURIComponent(global.nconf.get('url') + 'category/' + category_slug) + '&text=' + encodeURIComponent(category_name), | 					'twitter-intent-url': 'https://twitter.com/intent/tweet?url=' + encodeURIComponent(nconf.get('url') + 'category/' + category_slug) + '&text=' + encodeURIComponent(category_name), | ||||||
| 					'facebook-share-url': 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(global.nconf.get('url') + 'category/' + category_slug), | 					'facebook-share-url': 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(nconf.get('url') + 'category/' + category_slug), | ||||||
| 					'google-share-url': 'https://plus.google.com/share?url=' + encodeURIComponent(global.nconf.get('url') + 'category/' + category_slug) | 					'google-share-url': 'https://plus.google.com/share?url=' + encodeURIComponent(nconf.get('url') + 'category/' + category_slug) | ||||||
| 				}; | 				}; | ||||||
|  |  | ||||||
| 				function getTopics(next) { | 				function getTopics(next) { | ||||||
|   | |||||||
| @@ -48,9 +48,9 @@ var utils = require('./../public/src/utils.js'), | |||||||
| 								if (exists) { | 								if (exists) { | ||||||
| 									fs.readFile(themeConfPath, function(err, conf) { | 									fs.readFile(themeConfPath, function(err, conf) { | ||||||
| 										conf = JSON.parse(conf); | 										conf = JSON.parse(conf); | ||||||
| 										conf.src = global.nconf.get('url') + 'themes/' + themeDir + '/' + conf.src; | 										conf.src = nconf.get('url') + 'themes/' + themeDir + '/' + conf.src; | ||||||
| 										if (conf.screenshot) conf.screenshot = global.nconf.get('url') + 'themes/' + themeDir + '/' + conf.screenshot; | 										if (conf.screenshot) conf.screenshot = nconf.get('url') + 'themes/' + themeDir + '/' + conf.screenshot; | ||||||
| 										else conf.screenshot = global.nconf.get('url') + 'images/themes/default.png'; | 										else conf.screenshot = nconf.get('url') + 'images/themes/default.png'; | ||||||
| 										themeArr.push(conf); | 										themeArr.push(conf); | ||||||
| 										next(); | 										next(); | ||||||
| 									}); | 									}); | ||||||
|   | |||||||
| @@ -169,7 +169,7 @@ var	RDB = require('./redis.js'), | |||||||
|  |  | ||||||
| 		if (md && md.length > 0) { | 		if (md && md.length > 0) { | ||||||
| 			var	parsedContentDOM = cheerio.load(marked(md)); | 			var	parsedContentDOM = cheerio.load(marked(md)); | ||||||
| 			var	domain = global.nconf.get('url'); | 			var	domain = nconf.get('url'); | ||||||
| 			 | 			 | ||||||
| 			parsedContentDOM('a').each(function() { | 			parsedContentDOM('a').each(function() { | ||||||
| 				this.attr('rel', 'nofollow'); | 				this.attr('rel', 'nofollow'); | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ var	RDB = require('./redis.js'), | |||||||
| 			post.user_rep = userData.reputation || 0; | 			post.user_rep = userData.reputation || 0; | ||||||
| 			post.user_postcount = userData.postcount || 0; | 			post.user_postcount = userData.postcount || 0; | ||||||
| 			post.user_banned = userData.banned || '0'; | 			post.user_banned = userData.banned || '0'; | ||||||
| 			post.picture = userData.picture || require('gravatar').url('', {}, https=global.nconf.get('https')); | 			post.picture = userData.picture || require('gravatar').url('', {}, https=nconf.get('https')); | ||||||
| 			post.signature = postTools.markdownToHTML(userData.signature, true); | 			post.signature = postTools.markdownToHTML(userData.signature, true); | ||||||
|  |  | ||||||
| 			if(post.editor !== '') { | 			if(post.editor !== '') { | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ var user = require('./../user.js'), | |||||||
| 	Admin.build_header = function(res) { | 	Admin.build_header = function(res) { | ||||||
| 		return templates['admin/header'].parse({ | 		return templates['admin/header'].parse({ | ||||||
| 			csrf:res.locals.csrf_token, | 			csrf:res.locals.csrf_token, | ||||||
| 			relative_path: global.nconf.get('relative_path') | 			relative_path: nconf.get('relative_path') | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -161,11 +161,11 @@ var user = require('./../user.js'), | |||||||
| 			if (url) { | 			if (url) { | ||||||
| 				res.json({ | 				res.json({ | ||||||
| 					url: url, | 					url: url, | ||||||
| 					home: global.nconf.get('url') | 					home: nconf.get('url') | ||||||
| 				}); | 				}); | ||||||
| 			} else { | 			} else { | ||||||
| 				res.status(404); | 				res.status(404); | ||||||
| 				res.redirect(global.nconf.get('relative_path') + '/404'); | 				res.redirect(nconf.get('relative_path') + '/404'); | ||||||
| 			} | 			} | ||||||
| 		});	 | 		});	 | ||||||
|  |  | ||||||
| @@ -224,6 +224,14 @@ var user = require('./../user.js'), | |||||||
| 			}); | 			}); | ||||||
| 		}); | 		}); | ||||||
| 		 | 		 | ||||||
|  | 		app.get('/api/reset', function(req, res) { | ||||||
|  | 			res.json({}); | ||||||
|  | 		}); | ||||||
|  |  | ||||||
|  | 		app.get('/api/reset/:code', function(req, res) { | ||||||
|  | 			res.json({ reset_code: req.params.code }); | ||||||
|  | 		}); | ||||||
|  |  | ||||||
| 		app.get('/api/404', function(req, res) { | 		app.get('/api/404', function(req, res) { | ||||||
| 			res.json({}); | 			res.json({}); | ||||||
| 		}); | 		}); | ||||||
|   | |||||||
| @@ -127,13 +127,13 @@ | |||||||
|  |  | ||||||
| 		app.get('/reset/:code', function(req, res) { | 		app.get('/reset/:code', function(req, res) { | ||||||
| 			app.build_header({ req: req, res: res }, function(err, header) { | 			app.build_header({ req: req, res: res }, function(err, header) { | ||||||
| 				res.send(header + templates['reset_code'].parse({ reset_code: req.params.code }) + templates['footer']); | 				res.send(header + app.create_route('reset/'+req.params.code) + templates['footer']); | ||||||
| 			}); | 			}); | ||||||
| 		}); | 		}); | ||||||
|  |  | ||||||
| 		app.get('/reset', function(req, res) { | 		app.get('/reset', function(req, res) { | ||||||
| 			app.build_header({ req: req, res: res }, function(err, header) { | 			app.build_header({ req: req, res: res }, function(err, header) { | ||||||
| 				res.send(header + templates['reset'] + templates['footer']); | 				res.send(header + app.create_route('reset') + templates['footer']); | ||||||
| 			}); | 			}); | ||||||
| 		}); | 		}); | ||||||
| 		 | 		 | ||||||
| @@ -160,10 +160,10 @@ | |||||||
| 					req.login({ | 					req.login({ | ||||||
| 						uid: uid | 						uid: uid | ||||||
| 					}, function() { | 					}, function() { | ||||||
| 						res.redirect(global.nconf.get('relative_path') + '/'); | 						res.redirect(nconf.get('relative_path') + '/'); | ||||||
| 					}); | 					}); | ||||||
| 				} else { | 				} else { | ||||||
| 					res.redirect(global.nconf.get('relative_path') + '/register'); | 					res.redirect(nconf.get('relative_path') + '/register'); | ||||||
| 				} | 				} | ||||||
| 			}); | 			}); | ||||||
| 		}); | 		}); | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ var	path = require('path'), | |||||||
| 			async.parallel([sitemap.getStaticUrls, sitemap.getDynamicUrls], function(err, urls) { | 			async.parallel([sitemap.getStaticUrls, sitemap.getDynamicUrls], function(err, urls) { | ||||||
| 				var urls = urls[0].concat(urls[1]), | 				var urls = urls[0].concat(urls[1]), | ||||||
| 					map = sm.createSitemap({ | 					map = sm.createSitemap({ | ||||||
| 						hostname: global.nconf.get('url'), | 						hostname: nconf.get('url'), | ||||||
| 						cacheTime: 600000, | 						cacheTime: 600000, | ||||||
| 						urls: urls | 						urls: urls | ||||||
| 					}), | 					}), | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								src/user.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/user.js
									
									
									
									
									
								
							| @@ -376,7 +376,7 @@ var utils = require('./../public/src/utils.js'), | |||||||
| 			options.forcedefault = 'y'; | 			options.forcedefault = 'y'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return require('gravatar').url(email, options, https=global.nconf.get('https')); | 		return require('gravatar').url(email, options, https=nconf.get('https')); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	User.hashPassword = function(password, callback) { | 	User.hashPassword = function(password, callback) { | ||||||
| @@ -589,7 +589,7 @@ var utils = require('./../public/src/utils.js'), | |||||||
| 				topics.getTopicField(tid, 'slug', function(err, slug) { | 				topics.getTopicField(tid, 'slug', function(err, slug) { | ||||||
| 					var message = username + ' made a new post'; | 					var message = username + ' made a new post'; | ||||||
|  |  | ||||||
| 					notifications.create(message, 5, global.nconf.get('url') + 'topic/' + slug + '#' + pid, 'notification_'+ Date.now(), function(nid) { | 					notifications.create(message, 5, nconf.get('url') + 'topic/' + slug + '#' + pid, 'notification_'+ Date.now(), function(nid) { | ||||||
| 		 				notifications.push(nid, followers); | 		 				notifications.push(nid, followers); | ||||||
| 					}); | 					}); | ||||||
| 				}); | 				}); | ||||||
| @@ -792,6 +792,7 @@ var utils = require('./../public/src/utils.js'), | |||||||
|  |  | ||||||
| 	User.reset = { | 	User.reset = { | ||||||
| 		validate: function(socket, code, callback) { | 		validate: function(socket, code, callback) { | ||||||
|  | 			 | ||||||
| 			if (typeof callback !== 'function') { | 			if (typeof callback !== 'function') { | ||||||
| 				callback = null; | 				callback = null; | ||||||
| 			} | 			} | ||||||
| @@ -841,13 +842,13 @@ var utils = require('./../public/src/utils.js'), | |||||||
| 					RDB.set('reset:' + reset_code + ':uid', uid); | 					RDB.set('reset:' + reset_code + ':uid', uid); | ||||||
| 					RDB.set('reset:' + reset_code + ':expiry', (60*60)+new Date()/1000|0);	// Active for one hour | 					RDB.set('reset:' + reset_code + ':expiry', (60*60)+new Date()/1000|0);	// Active for one hour | ||||||
|  |  | ||||||
| 					var reset_link = config.url + 'reset/' + reset_code, | 					var reset_link = nconf.get('url') + 'reset/' + reset_code, | ||||||
| 						reset_email = global.templates['emails/reset'].parse({'RESET_LINK': reset_link}), | 						reset_email = global.templates['emails/reset'].parse({'RESET_LINK': reset_link}), | ||||||
| 						reset_email_plaintext = global.templates['emails/reset_plaintext'].parse({ 'RESET_LINK': reset_link }); | 						reset_email_plaintext = global.templates['emails/reset_plaintext'].parse({ 'RESET_LINK': reset_link }); | ||||||
|  |  | ||||||
| 					var message = emailjs.message.create({ | 					var message = emailjs.message.create({ | ||||||
| 						text: reset_email_plaintext, | 						text: reset_email_plaintext, | ||||||
| 						from: config.mailer.from, | 						from: config.mailer?config.mailer.from:'localhost@example.org', | ||||||
| 						to: email, | 						to: email, | ||||||
| 						subject: 'Password Reset Requested', | 						subject: 'Password Reset Requested', | ||||||
| 						attachment: [ | 						attachment: [ | ||||||
| @@ -884,14 +885,17 @@ var utils = require('./../public/src/utils.js'), | |||||||
| 			}); | 			}); | ||||||
| 		}, | 		}, | ||||||
| 		commit: function(socket, code, password) { | 		commit: function(socket, code, password) { | ||||||
| 			this.validate(code, function(validated) { | 			this.validate(socket, code, function(validated) { | ||||||
| 				if (validated) { | 				if (validated) { | ||||||
| 					RDB.get('reset:' + code + ':uid', function(err, uid) { | 					RDB.get('reset:' + code + ':uid', function(err, uid) { | ||||||
| 						if (err) { | 						if (err) { | ||||||
| 							RDB.handle(err); | 							RDB.handle(err); | ||||||
| 						} | 						} | ||||||
|  |  | ||||||
| 						User.setUserField(uid, 'password', password); | 						User.hashPassword(password, function(hash) { | ||||||
|  | 							User.setUserField(uid, 'password', hash); | ||||||
|  | 						}); | ||||||
|  |  | ||||||
| 						RDB.del('reset:' + code + ':uid'); | 						RDB.del('reset:' + code + ':uid'); | ||||||
| 						RDB.del('reset:' + code + ':expiry'); | 						RDB.del('reset:' + code + ':expiry'); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ var express = require('express'), | |||||||
| 	RedisStore = require('connect-redis')(express), | 	RedisStore = require('connect-redis')(express), | ||||||
| 	path = require('path'), | 	path = require('path'), | ||||||
| 	redis = require('redis'), | 	redis = require('redis'), | ||||||
| 	redisServer = redis.createClient(global.nconf.get('redis:port'), global.nconf.get('redis:host')), | 	redisServer = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host')), | ||||||
| 	marked = require('marked'), | 	marked = require('marked'), | ||||||
| 	utils = require('../public/src/utils.js'), | 	utils = require('../public/src/utils.js'), | ||||||
| 	pkg = require('../package.json'), | 	pkg = require('../package.json'), | ||||||
| @@ -40,11 +40,11 @@ var express = require('express'), | |||||||
| 			], | 			], | ||||||
| 			metaString = utils.buildMetaTags(defaultMetaTags.concat(options.metaTags || [])), | 			metaString = utils.buildMetaTags(defaultMetaTags.concat(options.metaTags || [])), | ||||||
| 			templateValues = { | 			templateValues = { | ||||||
| 				cssSrc: global.config['theme:src'] || global.nconf.get('relative_path') + '/vendor/bootstrap/css/bootstrap.min.css', | 				cssSrc: global.config['theme:src'] || nconf.get('relative_path') + '/vendor/bootstrap/css/bootstrap.min.css', | ||||||
| 				title: global.config['title'] || 'NodeBB', | 				title: global.config['title'] || 'NodeBB', | ||||||
| 				browserTitle: global.config['title'] || 'NodeBB', | 				browserTitle: global.config['title'] || 'NodeBB', | ||||||
| 				csrf: options.res.locals.csrf_token, | 				csrf: options.res.locals.csrf_token, | ||||||
| 				relative_path: global.nconf.get('relative_path'), | 				relative_path: nconf.get('relative_path'), | ||||||
| 				meta_tags: metaString | 				meta_tags: metaString | ||||||
| 			}; | 			}; | ||||||
|  |  | ||||||
| @@ -60,7 +60,7 @@ var express = require('express'), | |||||||
| 	// Middlewares | 	// Middlewares | ||||||
| 	app.use(express.favicon(path.join(__dirname, '../', 'public', 'favicon.ico'))); | 	app.use(express.favicon(path.join(__dirname, '../', 'public', 'favicon.ico'))); | ||||||
| 	app.use(require('less-middleware')({ src: path.join(__dirname, '../', 'public') })); | 	app.use(require('less-middleware')({ src: path.join(__dirname, '../', 'public') })); | ||||||
| 	app.use(global.nconf.get('relative_path'), express.static(path.join(__dirname, '../', 'public'))); | 	app.use(nconf.get('relative_path'), express.static(path.join(__dirname, '../', 'public'))); | ||||||
| 	app.use(express.bodyParser());	// Puts POST vars in request.body | 	app.use(express.bodyParser());	// Puts POST vars in request.body | ||||||
| 	app.use(express.cookieParser());	// If you want to parse cookies (res.cookies) | 	app.use(express.cookieParser());	// If you want to parse cookies (res.cookies) | ||||||
| 	app.use(express.compress()); | 	app.use(express.compress()); | ||||||
| @@ -69,7 +69,7 @@ var express = require('express'), | |||||||
| 			client: redisServer, | 			client: redisServer, | ||||||
| 			ttl: 60*60*24*14 | 			ttl: 60*60*24*14 | ||||||
| 		}), | 		}), | ||||||
| 		secret: global.nconf.get('secret'), | 		secret: nconf.get('secret'), | ||||||
| 		key: 'express.sid' | 		key: 'express.sid' | ||||||
| 	})); | 	})); | ||||||
| 	app.use(express.csrf()); | 	app.use(express.csrf()); | ||||||
| @@ -86,7 +86,7 @@ var express = require('express'), | |||||||
| 	 | 	 | ||||||
| 	app.use(function(req, res, next) { | 	app.use(function(req, res, next) { | ||||||
| 		 | 		 | ||||||
| 		global.nconf.set('https', req.secure); | 		nconf.set('https', req.secure); | ||||||
| 		 | 		 | ||||||
| 		// Don't bother with session handling for API requests | 		// Don't bother with session handling for API requests | ||||||
| 		if (/^\/api\//.test(req.url)) return next(); | 		if (/^\/api\//.test(req.url)) return next(); | ||||||
| @@ -109,7 +109,7 @@ var express = require('express'), | |||||||
| 		// respond with html page | 		// respond with html page | ||||||
| 		if (req.accepts('html')) { | 		if (req.accepts('html')) { | ||||||
| 			//res.json('404', { url: req.url }); | 			//res.json('404', { url: req.url }); | ||||||
| 			res.redirect(global.nconf.get('relative_path') + '/404'); | 			res.redirect(nconf.get('relative_path') + '/404'); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -141,7 +141,7 @@ var express = require('express'), | |||||||
| 	}; | 	}; | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
| 	app.namespace(global.nconf.get('relative_path'), function() { | 	app.namespace(nconf.get('relative_path'), function() { | ||||||
|  |  | ||||||
| 		auth.create_routes(app); | 		auth.create_routes(app); | ||||||
| 		admin.create_routes(app); | 		admin.create_routes(app); | ||||||
| @@ -243,7 +243,7 @@ var express = require('express'), | |||||||
| 							{ name: "title", content: topicData.topic_name }, | 							{ name: "title", content: topicData.topic_name }, | ||||||
| 							{ property: 'og:title', content: topicData.topic_name + ' | ' + (global.config.title || 'NodeBB') }, | 							{ property: 'og:title', content: topicData.topic_name + ' | ' + (global.config.title || 'NodeBB') }, | ||||||
| 							{ property: "og:type", content: 'article' }, | 							{ property: "og:type", content: 'article' }, | ||||||
| 							{ property: "og:url", content: global.nconf.get('url') + 'topic/' + topicData.slug }, | 							{ property: "og:url", content: nconf.get('url') + 'topic/' + topicData.slug }, | ||||||
| 							{ property: 'og:image', content: topicData.main_posts[0].picture }, | 							{ property: 'og:image', content: topicData.main_posts[0].picture }, | ||||||
| 							{ property: "article:published_time", content: new Date(parseInt(topicData.main_posts[0].timestamp, 10)).toISOString() }, | 							{ property: "article:published_time", content: new Date(parseInt(topicData.main_posts[0].timestamp, 10)).toISOString() }, | ||||||
| 							{ property: 'article:modified_time', content: new Date(lastMod).toISOString() }, | 							{ property: 'article:modified_time', content: new Date(lastMod).toISOString() }, | ||||||
| @@ -338,7 +338,7 @@ var express = require('express'), | |||||||
| 			res.send(	"User-agent: *\n" + | 			res.send(	"User-agent: *\n" + | ||||||
| 						"Disallow: \n" + | 						"Disallow: \n" + | ||||||
| 						"Disallow: /admin/\n" + | 						"Disallow: /admin/\n" + | ||||||
| 						"Sitemap: " + global.nconf.get('url') + "sitemap.xml"); | 						"Sitemap: " + nconf.get('url') + "sitemap.xml"); | ||||||
| 		}); | 		}); | ||||||
|  |  | ||||||
| 		app.get('/cid/:cid', function(req, res) { | 		app.get('/cid/:cid', function(req, res) { | ||||||
|   | |||||||
| @@ -16,12 +16,12 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }), | |||||||
| 	async = require('async'), | 	async = require('async'), | ||||||
| 	RedisStoreLib = require('connect-redis')(express), | 	RedisStoreLib = require('connect-redis')(express), | ||||||
| 	redis = require('redis'), | 	redis = require('redis'), | ||||||
| 	redisServer = redis.createClient(global.nconf.get('redis:port'), global.nconf.get('redis:host')), | 	redisServer = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host')), | ||||||
| 	RedisStore = new RedisStoreLib({ | 	RedisStore = new RedisStoreLib({ | ||||||
| 		client: redisServer, | 		client: redisServer, | ||||||
| 		ttl: 60*60*24*14 | 		ttl: 60*60*24*14 | ||||||
| 	}), | 	}), | ||||||
| 	socketCookieParser = express.cookieParser(global.nconf.get('secret')), | 	socketCookieParser = express.cookieParser(nconf.get('secret')), | ||||||
| 	admin = { | 	admin = { | ||||||
| 		'categories': require('./admin/categories.js'), | 		'categories': require('./admin/categories.js'), | ||||||
| 		'user': require('./admin/user.js') | 		'user': require('./admin/user.js') | ||||||
| @@ -187,7 +187,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }), | |||||||
| 					uid:0, | 					uid:0, | ||||||
| 					username: "Anonymous User", | 					username: "Anonymous User", | ||||||
| 					email: '', | 					email: '', | ||||||
| 					picture: require('gravatar').url('', {s:'24'}, https=global.nconf.get('https')) | 					picture: require('gravatar').url('', {s:'24'}, https=nconf.get('https')) | ||||||
| 				}); | 				}); | ||||||
| 			} | 			} | ||||||
| 				 | 				 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user