diff --git a/app.js b/app.js index ea714e7..54157e3 100644 --- a/app.js +++ b/app.js @@ -25,7 +25,6 @@ var Server = function(params) { user = require('./routes/user'), index = require('./routes/index'), sign = require('./routes/sign'), - admin = require('./routes/admin'), errhandler = require('./lib/error'); // all environments @@ -48,8 +47,8 @@ var Server = function(params) { }) })); app.use(function(req, res, next) { - if (!res.locals.App) { - res.locals.App = self; + if (!res.locals.Server) { + res.locals.Server = self; } next(); }); @@ -72,7 +71,7 @@ var Server = function(params) { app.get('/signout', sign.out); // thread - app.get('/thread/new', sign.check, thread.new); + app.get('/submit', sign.check, thread.submit); app.post('/thread/new', sign.checkJSON, thread.create); app.get('/thread/list', sign.checkJSON, thread.ls); app.get('/thread/:id', sign.passport, thread.read); diff --git a/model.js b/model.js index e452c34..6a09907 100644 --- a/model.js +++ b/model.js @@ -45,6 +45,10 @@ var threadModel = new Schema({ name: String, content: String, url: String, + topic: { + type: String, + default: 'normal' + }, score: { type: Number, default: 0 diff --git a/routes/admin.js b/routes/admin.js deleted file mode 100644 index eb111c0..0000000 --- a/routes/admin.js +++ /dev/null @@ -1,29 +0,0 @@ -// admin panel -var admin = require('../ctrlers/admin'); - -// PAGE: 管理后台首页 -exports.page = function(req, res, next) { - admin.read(function(err, info) { - if (!err) { - res.render('admin/index', info); - } else { - next(err) - } - }) -}; - -// API: 更新网站设置 -exports.update = function(req, res, next) { - if (req.body.setting) { - admin.update(req.body.setting, function(err, site) { - if (!err) { - res.locals.App.app.locals.site = site; - res.json(site) - } else { - next(err) - } - }); - } else { - next(new Error('缺少表单')) - } -}; \ No newline at end of file diff --git a/routes/thread.js b/routes/thread.js index fbee839..2610e7c 100644 --- a/routes/thread.js +++ b/routes/thread.js @@ -24,7 +24,7 @@ exports.ls = function(req, res, next) { } // 新增话题页面 -exports.new = function(req, res, next) { +exports.submit = function(req, res, next) { // 需要添加识别默认板块的逻辑 if (req.query.bid) { board.brief(req.query.bid, function(err, b) {