forked from GitHub/dbot
Merge git://github.com/reality/depressionbot
This commit is contained in:
commit
c8a1818c65
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user