Well the process starts, that's a start

This commit is contained in:
calzoneman 2013-08-17 18:51:10 -05:00
parent f4b32ad3ad
commit 492a50fb96
5 changed files with 12 additions and 12 deletions

4
api.js
View File

@ -514,7 +514,7 @@ module.exports = function (Server) {
return;
}
db.listUserChannels(name, function (err, res) {
db.listUserChannels(name, function (err, dbres) {
if(err) {
res.jsonp({
success: false,
@ -525,7 +525,7 @@ module.exports = function (Server) {
res.jsonp({
success: true,
channels: res
channels: dbres
});
});
});

View File

@ -479,6 +479,7 @@ Channel.prototype.getIPRank = function (ip, callback) {
for(var i in self.ip_aliases[ip2])
names.push(self.ip_aliases[ip2][i]);
}
}
next(names);
} else {
self.server.db.listAliases(ip, function (err, names) {

View File

@ -24,6 +24,7 @@ var Database = function (cfg) {
this.pool.getConnection(function (err, conn) {
if(err) {
Logger.errlog.log("! DB connection failed");
return;
}
conn.end();
});
@ -45,7 +46,6 @@ Database.prototype.query = function (query, sub, callback) {
self.pool.getConnection(function (err, conn) {
if(err) {
callback("Database failure", null);
conn.end();
} else {
function cback(err, res) {
if(err) {
@ -217,7 +217,7 @@ Database.prototype.init = function () {
});
// Refresh global IP bans
self.getGlobalIPBans();
self.listGlobalIPBans();
};
/* REGION global bans */

View File

@ -89,6 +89,10 @@ var Server = {
this.httpaccess.log([ipstr, req.method, url, status, req.headers["user-agent"]].join(" "));
},
init: function () {
// init database
var Database = require("./database");
this.db = new Database(this.cfg);
this.db.init();
this.actionlog = require("./actionlog")(this);
this.httpaccess = new Logger.Logger("httpaccess.log");
this.app = express();
@ -202,10 +206,6 @@ var Server = {
new User(socket, this);
}.bind(this));
// init database
var Database = require("./database");
this.db = new Database(this.cfg);
this.db.init();
// init ACP
this.acp = require("./acp")(this);

View File

@ -13,7 +13,6 @@ var Rank = require("./rank.js");
var Channel = require("./channel.js").Channel;
var formatTime = require("./media.js").formatTime;
var Logger = require("./logger.js");
var self.server.actionlog = require("./actionlog");
// Represents a client connected via socket.io
var User = function(socket, Server) {
@ -313,7 +312,7 @@ User.prototype.initCallbacks = function() {
self.socket.emit("searchResults", {
results: vids
});
}
});
}
}
}.bind(this));
@ -600,7 +599,7 @@ User.prototype.login = function(name, pw, session) {
self.channel.logger.log(self.ip + " signed in as " + name);
self.channel.broadcastNewUser(self);
}
}
});
} else {
self.server.db.userLogin(name, pw, session, function (err, row) {
if(err) {