From fe6141ea81b60a733b2c59a4cfaa372cd5e4e4b3 Mon Sep 17 00:00:00 2001 From: reality Date: Sun, 18 Aug 2013 20:23:13 +0000 Subject: [PATCH] web part for ban list [#557] --- modules/kick/config.json | 3 ++- modules/kick/pages.js | 29 +++++++++++++++++++++++++++++ views/kick/bans.jade | 23 +++++++++++++++++++++++ views/kick/servers.jade | 10 ++++++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 modules/kick/pages.js create mode 100644 views/kick/bans.jade create mode 100644 views/kick/servers.jade diff --git a/modules/kick/config.json b/modules/kick/config.json index fb9ed4c..4df5b5b 100644 --- a/modules/kick/config.json +++ b/modules/kick/config.json @@ -8,5 +8,6 @@ }, "chanserv": "ChanServ", "document_bans": false, - "dbType": "redis" + "dbType": "redis", + "webAccess": "power_users" } diff --git a/modules/kick/pages.js b/modules/kick/pages.js new file mode 100644 index 0000000..a16c91d --- /dev/null +++ b/modules/kick/pages.js @@ -0,0 +1,29 @@ +var _ = require('underscore')._; + +var pages = function(dbot) { + return { + '/kick': function(req, res) { + res.render('servers', { + 'servers': _.keys(dbot.config.servers) + }); + }, + + '/kick/:server': function(req, res) { + var server = req.params.server, + bans = []; + + this.db.search('nbans', { 'server': server }, function(ban) { + bans.push(ban); + }, function() { + res.render('bans', { + 'server': server, + 'bans': bans + }); + }); + } + } +}; + +exports.fetch = function(dbot) { + return pages(dbot); +}; diff --git a/views/kick/bans.jade b/views/kick/bans.jade new file mode 100644 index 0000000..6d0d090 --- /dev/null +++ b/views/kick/bans.jade @@ -0,0 +1,23 @@ +extends ../layout + +block content + div#backlink + a(href='/warning/'+server) « Server Bans + p + div#profile_datatable + table.table.table-hover.data + thead + tr + th Date + th Banner + th Banee + th Host + th Reason + tbody + each ban, key in bans + tr + td #{new Date(ban.time)} + td #{ban.banner} + td #{ban.banee} + td #{ban.host} + td #{ban.reason} diff --git a/views/kick/servers.jade b/views/kick/servers.jade new file mode 100644 index 0000000..eec1403 --- /dev/null +++ b/views/kick/servers.jade @@ -0,0 +1,10 @@ +extends ../layout + +block content + h3 Servers + div#backlink + a(href='/') « Home + ul#quotelist + -each server in servers + a(href='/kick/'+server) + li.quotes #{server}