3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-25 12:12:35 +01:00

update web to use new express version

This commit is contained in:
reality 2014-09-04 14:19:23 +00:00
parent b18a61ebd1
commit 78057dca3c
2 changed files with 12 additions and 11 deletions

View File

@ -39,7 +39,7 @@ var pages = function(dbot) {
var server = req.params.server,
user = req.params.uid;
dbot.api.users.resolveUser(server, user, function(user) {
dbot.api.users.resolveUser(server, user, function(err, user) {
var warnings = [];
this.db.search('warnings', {
'server': server,
@ -54,7 +54,6 @@ var pages = function(dbot) {
callback(false);
});
}, function(err) {
console.log(warnings);
res.render('warnings', {
'name': dbot.config.name,
'server': server,

View File

@ -4,7 +4,11 @@ var express = require('express'),
flash = require('connect-flash'),
_ = require('underscore')._,
fs = require('fs'),
LocalStrategy = require('passport-local').Strategy;
LocalStrategy = require('passport-local').Strategy,
cookieParser = require('cookie-parser');
bodyParser = require('body-parser');
expressSession = require('express-session');
methodOverride = require('method-override');
var webInterface = function(dbot) {
this.config = dbot.config.modules.web;
@ -14,15 +18,14 @@ var webInterface = function(dbot) {
this.app.use(express.static(this.pub));
this.app.set('view engine', 'jade');
this.app.use(express.cookieParser());
this.app.use(express.bodyParser());
this.app.use(express.methodOverride());
this.app.use(express.session({ 'secret': 'wat' }));
this.app.use(cookieParser());
this.app.use(methodOverride());
this.app.use(expressSession({ 'secret': 'wat' }));
this.app.use(bodyParser());
this.app.use(flash());
this.app.use(passport.initialize());
this.app.use(passport.session());
this.app.use(this.app.router);
passport.serializeUser(function(user, done) {
done(null, user.id);
@ -46,7 +49,7 @@ var webInterface = function(dbot) {
'Please provide a valid server (Servers: ' +
_.keys(dbot.config.servers).join(', ') + ')' });
dbot.api.users.resolveUser(server, username, function(user) {
dbot.api.users.resolveUser(server, username, function(err, user) {
if(user) {
this.api.getWebUser(user.id, function(webUser) {
if(webUser) {
@ -95,8 +98,7 @@ var webInterface = function(dbot) {
this.onLoad = function() {
this.reloadPages();
var routes = _.pluck(dbot.modules.web.app.routes.get, 'path'),
var routes = _.pluck(_.without(_.pluck(this.app._router.stack, 'route'), undefined), 'path'),
moduleNames = _.keys(dbot.modules);
_.each(moduleNames, function(moduleName) {