2013-04-18 13:06:13 +02:00
|
|
|
/**
|
2013-04-18 20:57:04 +02:00
|
|
|
* Module Name: Project
|
|
|
|
* Description: Web page which shows git status and other various stats about
|
|
|
|
* the dbot.
|
2013-04-18 13:06:13 +02:00
|
|
|
*/
|
|
|
|
|
2013-04-21 01:27:50 +02:00
|
|
|
_ = require('underscore'),
|
|
|
|
exec = require('child_process').exec;
|
2013-04-20 19:42:34 +02:00
|
|
|
|
2013-04-18 13:06:13 +02:00
|
|
|
var project = function(dbot) {
|
2013-04-18 20:57:04 +02:00
|
|
|
|
2013-04-20 22:00:59 +02:00
|
|
|
this.api = {
|
|
|
|
'configList' : function(callback){
|
2013-04-20 19:42:34 +02:00
|
|
|
var list = [];
|
|
|
|
if(_.has(dbot.modules,'dent')){
|
2013-04-20 22:00:59 +02:00
|
|
|
list.push(dbot.t("dent-account", {
|
2013-04-20 19:42:34 +02:00
|
|
|
"username": dbot.config.dent.username
|
|
|
|
}));
|
|
|
|
}
|
2013-04-21 01:27:50 +02:00
|
|
|
if(_.has(dbot.config.dent.dentQuotes)) {
|
2013-04-20 22:00:59 +02:00
|
|
|
list.push(dbot.t("dent-push"));
|
2013-04-20 19:42:34 +02:00
|
|
|
}
|
|
|
|
if(_.has(dbot.modules,'link')){
|
|
|
|
if(dbot.config.link.autoTitle){
|
2013-04-20 22:00:59 +02:00
|
|
|
list.push(dbot.t("link-autotitle"));
|
2013-04-20 19:42:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(_.has(dbot.modules,'quotes')){
|
2013-04-20 22:00:59 +02:00
|
|
|
list.push(dbot.t("quote-rmlimit", {
|
2013-04-20 19:42:34 +02:00
|
|
|
"limit": dbot.config.quotes.rmLimit
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
if(_.has(dbot.modules,'report')){
|
|
|
|
if(dbot.config.report.notifyVoice){
|
2013-04-20 22:00:59 +02:00
|
|
|
list.push(dbot.t("report-notifyvoice"));
|
2013-04-20 19:42:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(_.has(dbot.modules,'web')){
|
2013-04-20 22:00:59 +02:00
|
|
|
list.push(dbot.t("web-port", {
|
2013-04-20 19:42:34 +02:00
|
|
|
"port": dbot.config.web.webPort
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
return list;
|
2013-04-21 01:27:50 +02:00
|
|
|
},
|
2013-04-21 14:18:24 +02:00
|
|
|
'translationProgress' : function(callback){
|
2013-04-21 16:28:33 +02:00
|
|
|
var translation = [] ;
|
2013-04-21 14:18:24 +02:00
|
|
|
var str = _.values(dbot.strings);
|
|
|
|
for (var i = 0; i < str.length; i++){
|
|
|
|
var cur = _.keys(str[i]);
|
|
|
|
for (var j = 0; j < cur.length; j++) {
|
|
|
|
translation = translation.concat(cur[j]);
|
|
|
|
}
|
|
|
|
}
|
2013-04-21 16:28:33 +02:00
|
|
|
var t = {};
|
2013-04-21 18:12:14 +02:00
|
|
|
for (var k = 0; k < translation.length; k++) {
|
2013-04-21 14:18:24 +02:00
|
|
|
var curr = translation[k];
|
|
|
|
if (t[curr]) {
|
|
|
|
t[curr]["count"] += 1;
|
|
|
|
} else {
|
2013-04-21 16:28:33 +02:00
|
|
|
t[curr] = {};
|
|
|
|
t[curr]["iso"] = curr;
|
2013-04-21 14:18:24 +02:00
|
|
|
t[curr]["count"] = 1;
|
|
|
|
t[curr]["own"] = dbot.strings[curr][curr];
|
|
|
|
t[curr]["local"] = dbot.t(curr);
|
|
|
|
t[curr]["english"] = dbot.strings[curr]["en"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(t);
|
|
|
|
return t;
|
2013-04-20 22:00:59 +02:00
|
|
|
}
|
2013-04-21 14:18:24 +02:00
|
|
|
};
|
|
|
|
this.api['translationProgress'].external = true;
|
|
|
|
};
|
2013-04-21 01:27:50 +02:00
|
|
|
|
2013-04-20 19:42:34 +02:00
|
|
|
exports.fetch = function(dbot){
|
2013-04-18 13:06:13 +02:00
|
|
|
return new project(dbot);
|
2013-04-21 14:18:24 +02:00
|
|
|
};
|