From d0e59387885525750e253e821ffd8e797f45e993 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 20 Jun 2013 16:39:11 -0400 Subject: [PATCH 1/2] merging in Peter Cellik's changes to allow NodeBB to work with a passworded Redis store. Fixes #11 --- app.js | 93 +++++++++++++++++++++++++++------------------------- src/redis.js | 4 +++ 2 files changed, 52 insertions(+), 45 deletions(-) diff --git a/app.js b/app.js index 39ae924cc0..d3b73178e4 100644 --- a/app.js +++ b/app.js @@ -110,56 +110,59 @@ fs.readFile(path.join(__dirname, 'config.json'), function(err, data) { ask('Will you be using a port number to access NodeBB? (y)', function(use_port) { ask('... the host IP or address of your Redis instance? (127.0.0.1)', function(redis_host) { ask('... the host port of your Redis instance? (6379)', function(redis_port) { - ask('... your NodeBB secret? (keyboard mash for a bit here)', function(secret) { - if (!base_url) base_url = 'http://localhost'; - if (!port) port = 4567; - if (!use_port) use_port = true; else use_port = (use_port === 'y' ? true : false); - if (!redis_host) redis_host = '127.0.0.1'; - if (!redis_port) redis_port = 6379; - if (!secret) secret = utils.generateUUID(); - - var fs = require('fs'), - path = require('path'), - config = { - secret: secret, - base_url: base_url, - port: port, - use_port: use_port, - upload_path: '/public/uploads/', - redis: { - host: redis_host, - port: redis_port + ask('... the password of your Redis database? (no password)', function(redis_password) { + ask('... your NodeBB secret? (keyboard mash for a bit here)', function(secret) { + if (!base_url) base_url = 'http://localhost'; + if (!port) port = 4567; + if (!use_port) use_port = true; else use_port = (use_port === 'y' ? true : false); + if (!redis_host) redis_host = '127.0.0.1'; + if (!redis_port) redis_port = 6379; + if (!secret) secret = utils.generateUUID(); + + var fs = require('fs'), + path = require('path'), + config = { + secret: secret, + base_url: base_url, + port: port, + use_port: use_port, + upload_path: '/public/uploads/', + redis: { + host: redis_host, + port: redis_port, + password: redis_password + } } - } - - // Server-side config - fs.writeFile(path.join(__dirname, 'config.json'), JSON.stringify(config, null, 4), function(err) { - if (err) throw err; - else { - process.stdout.write( - "\n\nConfiguration Saved OK\n\n" - ); - if (!args.setup) { + + // Server-side config + fs.writeFile(path.join(__dirname, 'config.json'), JSON.stringify(config, null, 4), function(err) { + if (err) throw err; + else { + process.stdout.write( + "\n\nConfiguration Saved OK\n\n" + ); + if (!args.setup) { + process.stdout.write( + "Please start NodeBB again and register a new user at " + + base_url + (use_port ? ':' + port : '') + "/register. This user will automatically become an administrator.\n\n" + ); + } process.stdout.write( - "Please start NodeBB again and register a new user at " + - base_url + (use_port ? ':' + port : '') + "/register. This user will automatically become an administrator.\n\n" + "If at any time you'd like to run this setup again, run the app with the \"--setup\" flag\n\n" ); + process.exit(); } - process.stdout.write( - "If at any time you'd like to run this setup again, run the app with the \"--setup\" flag\n\n" - ); - process.exit(); - } + }); + + // Client-side config + fs.writeFile(path.join(__dirname, 'public', 'config.json'), JSON.stringify({ + socket: { + address: base_url, + port: port + }, + api_url: base_url + (use_port ? ':' + port : '') + '/api/' + }, null, 4)) }); - - // Client-side config - fs.writeFile(path.join(__dirname, 'public', 'config.json'), JSON.stringify({ - socket: { - address: base_url, - port: port - }, - api_url: base_url + (use_port ? ':' + port : '') + '/api/' - }, null, 4)) }); }); }); diff --git a/src/redis.js b/src/redis.js index 5ac950f057..79a13da47d 100644 --- a/src/redis.js +++ b/src/redis.js @@ -7,6 +7,10 @@ RedisDB.exports = redis.createClient(global.config.redis.port, global.config.redis.host); + if( global.config.redis.password ) { + RedisDB.exports.auth(global.config.redis.password); + } + RedisDB.exports.handle = function(error) { if (error !== null) { if (PRODUCTION === false) { From 912664756fef14e3fd976af09b2c0befd18a194b Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 20 Jun 2013 16:45:53 -0400 Subject: [PATCH 2/2] categories admin continued --- public/templates/admin/categories.tpl | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/public/templates/admin/categories.tpl b/public/templates/admin/categories.tpl index d1f6dd8ed4..cfdb6d6012 100644 --- a/public/templates/admin/categories.tpl +++ b/public/templates/admin/categories.tpl @@ -8,17 +8,18 @@ - + +
    -
  • +
  • - +
    - - + - +
+ +