Merge git://github.com/reality/depressionbot

This commit is contained in:
Psychedelic Squid 2012-03-10 17:51:33 +00:00
commit c8a1818c65
2 changed files with 5 additions and 5 deletions

View File

@ -18,23 +18,23 @@ var webInterface = function(dbot) {
// Lists the quote categories
app.get('/quotes', function(req, res) {
res.render('quotelist', { 'quotelist': Object.keys(dbot.db.quoteArrs) });
res.render('quotelist', { 'name': dbot.name, 'quotelist': Object.keys(dbot.db.quoteArrs) });
});
// Lists quotes in a category
app.get('/quotes/:key', function(req, res) {
var key = req.params.key.toLowerCase();
if(dbot.db.quoteArrs.hasOwnProperty(key)) {
res.render('quotes', { 'quotes': dbot.db.quoteArrs[key], locals: { 'url_regex': RegExp.prototype.url_regex() } });
res.render('quotes', { 'name': dbot.name, 'quotes': dbot.db.quoteArrs[key], locals: { 'url_regex': RegExp.prototype.url_regex() } });
} else {
res.render('error', { 'message': 'No quotes under that key.' });
res.render('error', { 'name': dbot.name, 'message': 'No quotes under that key.' });
}
});
// Load random quote category page
app.get('/rq', function(req, res) {
var rCategory = Object.keys(dbot.db.quoteArrs).random();
res.render('quotes', { 'quotes': dbot.db.quoteArrs[rCategory], locals: { 'url_regex': RegExp.prototype.url_regex() } });
res.render('quotes', { 'name': dbot.name, 'quotes': dbot.db.quoteArrs[rCategory], locals: { 'url_regex': RegExp.prototype.url_regex() } });
});
app.listen(443);

View File

@ -3,7 +3,7 @@ html(lang='en')
head
meta(charset='utf-8')
link(rel='stylesheet', type='text/css', href='/styles.css')
title Depressionbot web interface
title #{name} web interface
body
div#page
div#title