2013-07-06 20:45:21 +02:00
|
|
|
var _ = require('underscore')._;
|
|
|
|
|
|
|
|
var pages = function(dbot) {
|
|
|
|
return {
|
2013-07-29 23:08:41 +02:00
|
|
|
'/report': function(req, res) {
|
2013-07-06 20:45:21 +02:00
|
|
|
res.render('servers', {
|
|
|
|
'name': dbot.config.name,
|
|
|
|
'servers': _.keys(dbot.config.servers)
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2013-07-29 23:08:41 +02:00
|
|
|
'/report/:server': function(req, res) {
|
2013-07-06 20:45:21 +02:00
|
|
|
var server = req.params.server;
|
|
|
|
res.render('channels', {
|
|
|
|
'name': dbot.config.name,
|
|
|
|
'server': server,
|
2013-07-06 20:49:34 +02:00
|
|
|
'channels': _.keys(dbot.instance.connections[server].channels)
|
2013-07-06 20:45:21 +02:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2013-08-17 23:04:42 +02:00
|
|
|
'/report/:server/missing': function(req, res) {
|
|
|
|
var server = req.params.server,
|
|
|
|
user = req.user,
|
|
|
|
notifies = this.pending[user.id];
|
|
|
|
|
|
|
|
res.render('missing_notifies', {
|
|
|
|
'name': dbot.config.name,
|
|
|
|
'user': user.primaryNick,
|
|
|
|
'notifies': notifies
|
|
|
|
});
|
2013-08-18 18:37:30 +02:00
|
|
|
|
|
|
|
if(_.has(dbot.modules, 'log')) {
|
|
|
|
dbot.api.log.log(server, user.primaryNick,
|
|
|
|
'Checked their missing notifications.');
|
|
|
|
}
|
2013-08-17 23:04:42 +02:00
|
|
|
},
|
|
|
|
|
2013-07-29 23:08:41 +02:00
|
|
|
'/report/:server/:channel': function(req, res) {
|
2013-07-06 20:45:21 +02:00
|
|
|
var server = req.params.server,
|
|
|
|
channel = req.params.channel,
|
|
|
|
notifies = [];
|
|
|
|
|
|
|
|
this.db.search('notifies', {
|
|
|
|
'server': server,
|
|
|
|
'channel': channel
|
|
|
|
}, function(notify) {
|
|
|
|
notifies.push(notify);
|
|
|
|
}, function(err) {
|
|
|
|
res.render('notifies', {
|
|
|
|
'name': dbot.config.name,
|
|
|
|
'server': server,
|
|
|
|
'notifies': notifies
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.fetch = function(dbot) {
|
|
|
|
return pages(dbot);
|
|
|
|
};
|