From ec463ce3d3aabec16e5fcfb576b4ccac80b2e562 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 22 May 2013 12:06:23 -0400 Subject: [PATCH] added motd support --- config.default.js | 9 +++++++++ public/templates/home.tpl | 8 +------- src/webserver.js | 7 ++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/config.default.js b/config.default.js index e7a662b76b..8c5ad2ac63 100644 --- a/config.default.js +++ b/config.default.js @@ -1,3 +1,12 @@ +/** + * READ ME! + * The config directives here are all different based on where NodeBB is installed. + * This config file system will be deprecated soon, and all configs will be moved + * to the redis db, under the hash "config" + * + * As of May 22nd, 2013, this migration hasn't started yet + */ + var config = { // The "secret" is used to encrypt cookie sessions, change this to any random string "secret": 'nodebb-secret', diff --git a/public/templates/home.tpl b/public/templates/home.tpl index 736b993be5..f52cd436c7 100644 --- a/public/templates/home.tpl +++ b/public/templates/home.tpl @@ -1,11 +1,5 @@
-

NodeBB

-

Welcome to NodeBB, the discussion platform of the future.

-

- Get NodeBB - Fork us on Github - @dcplabs -

+ {motd}
diff --git a/src/webserver.js b/src/webserver.js index 9f6c500a32..e19f50e77f 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -6,9 +6,9 @@ var express = require('express'), config = require('../config.js'), redis = require('redis'), redisServer = redis.createClient(config.redis.port, config.redis.host, config.redis.options), + marked = require('marked'), user = require('./user.js'), - categories = require('./categories.js'), posts = require('./posts.js'), topics = require('./topics.js'), @@ -18,7 +18,6 @@ var express = require('express'), userRoute = require('./routes/user.js'), auth = require('./routes/authentication.js'); - (function(app) { var templates = null; @@ -115,6 +114,7 @@ var express = require('express'), break; case 'home' : categories.getAllCategories(function(data) { + data.motd = marked(config.motd || "# NodeBB v0.1\nWelcome to NodeBB, the discussion platform of the future.\n\n Get NodeBB Fork us on Github @dcplabs"); res.send(JSON.stringify(data)); }, (req.user) ? req.user.uid : 0); break; @@ -191,6 +191,7 @@ var express = require('express'), break; case 'popular' : categories.get(function(data) { + console.log(data); if(!data) { res.send(false); return; @@ -239,7 +240,7 @@ var express = require('express'), app.get('/test', function(req, res) { categories.get(function(category) { res.send(JSON.stringify(category, null, 4)); - }, 2, 2, null, null); + }, null, 2, null, null); });