3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 12:59:34 +01:00

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 // Lists the quote categories
app.get('/quotes', function(req, res) { 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 // Lists quotes in a category
app.get('/quotes/:key', function(req, res) { app.get('/quotes/:key', function(req, res) {
var key = req.params.key.toLowerCase(); var key = req.params.key.toLowerCase();
if(dbot.db.quoteArrs.hasOwnProperty(key)) { 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 { } 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 // Load random quote category page
app.get('/rq', function(req, res) { app.get('/rq', function(req, res) {
var rCategory = Object.keys(dbot.db.quoteArrs).random(); 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); app.listen(443);

View File

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