added motd support

v1.18.x
Julian Lam 12 years ago
parent 26781157b3
commit ec463ce3d3

@ -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 = { var config = {
// The "secret" is used to encrypt cookie sessions, change this to any random string // The "secret" is used to encrypt cookie sessions, change this to any random string
"secret": 'nodebb-secret', "secret": 'nodebb-secret',

@ -1,11 +1,5 @@
<div class="hero-unit"> <div class="hero-unit">
<h1>NodeBB</h1> {motd}
<p>Welcome to NodeBB, the discussion platform of the future.</p>
<p>
<a target="_blank" href="http://www.nodebb.org" class="btn btn-large"><i class="icon-comment"></i> Get NodeBB</a>
<a target="_blank" href="https://github.com/psychobunny/NodeBB" class="btn btn-large"><i class="icon-github-alt"></i> Fork us on Github</a>
<a target="_blank" href="https://twitter.com/dcplabs" class="btn btn-large"><i class="icon-twitter"></i> @dcplabs</a>
</p>
</div> </div>
<div class="row category-row"> <div class="row category-row">

@ -6,9 +6,9 @@ var express = require('express'),
config = require('../config.js'), config = require('../config.js'),
redis = require('redis'), redis = require('redis'),
redisServer = redis.createClient(config.redis.port, config.redis.host, config.redis.options), redisServer = redis.createClient(config.redis.port, config.redis.host, config.redis.options),
marked = require('marked'),
user = require('./user.js'), user = require('./user.js'),
categories = require('./categories.js'), categories = require('./categories.js'),
posts = require('./posts.js'), posts = require('./posts.js'),
topics = require('./topics.js'), topics = require('./topics.js'),
@ -18,7 +18,6 @@ var express = require('express'),
userRoute = require('./routes/user.js'), userRoute = require('./routes/user.js'),
auth = require('./routes/authentication.js'); auth = require('./routes/authentication.js');
(function(app) { (function(app) {
var templates = null; var templates = null;
@ -115,6 +114,7 @@ var express = require('express'),
break; break;
case 'home' : case 'home' :
categories.getAllCategories(function(data) { categories.getAllCategories(function(data) {
data.motd = marked(config.motd || "# NodeBB v0.1\nWelcome to NodeBB, the discussion platform of the future.\n\n<a target=\"_blank\" href=\"http://www.nodebb.org\" class=\"btn btn-large\"><i class=\"icon-comment\"></i> Get NodeBB</a> <a target=\"_blank\" href=\"https://github.com/psychobunny/NodeBB\" class=\"btn btn-large\"><i class=\"icon-github-alt\"></i> Fork us on Github</a> <a target=\"_blank\" href=\"https://twitter.com/dcplabs\" class=\"btn btn-large\"><i class=\"icon-twitter\"></i> @dcplabs</a>");
res.send(JSON.stringify(data)); res.send(JSON.stringify(data));
}, (req.user) ? req.user.uid : 0); }, (req.user) ? req.user.uid : 0);
break; break;
@ -191,6 +191,7 @@ var express = require('express'),
break; break;
case 'popular' : case 'popular' :
categories.get(function(data) { categories.get(function(data) {
console.log(data);
if(!data) { if(!data) {
res.send(false); res.send(false);
return; return;
@ -239,7 +240,7 @@ var express = require('express'),
app.get('/test', function(req, res) { app.get('/test', function(req, res) {
categories.get(function(category) { categories.get(function(category) {
res.send(JSON.stringify(category, null, 4)); res.send(JSON.stringify(category, null, 4));
}, 2, 2, null, null); }, null, 2, null, null);
}); });

Loading…
Cancel
Save