mirror of https://github.com/calzoneman/sync.git
Do a bit of intermediate database work
This commit is contained in:
parent
b889f7b4c8
commit
cfd1b0618d
371
lib/database.js
371
lib/database.js
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,12 @@
|
||||||
//var db = require("../database");
|
//var db = require("../database");
|
||||||
var $util = require("../utilities");
|
var $util = require("../utilities");
|
||||||
var bcrypt = require("bcrypt");
|
var bcrypt = require("bcrypt");
|
||||||
|
var db = require("../database");
|
||||||
|
|
||||||
var registrationLock = {};
|
var registrationLock = {};
|
||||||
var blackHole = function () { };
|
var blackHole = function () { };
|
||||||
|
|
||||||
module.exports = function (db) {
|
module.exports = {
|
||||||
return {
|
|
||||||
/**
|
/**
|
||||||
* Initialize the accounts table
|
* Initialize the accounts table
|
||||||
*/
|
*/
|
||||||
|
@ -495,4 +495,3 @@ module.exports = function (db) {
|
||||||
callback(new Error("recoverPassword is not implemented"), null);
|
callback(new Error("recoverPassword is not implemented"), null);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
|
@ -67,13 +67,26 @@ var Server = function (cfg) {
|
||||||
|
|
||||||
// database init ------------------------------------------------------
|
// database init ------------------------------------------------------
|
||||||
var Database = require("./database");
|
var Database = require("./database");
|
||||||
self.db = new Database(self.cfg);
|
self.db = Database;
|
||||||
|
self.db.init(self.cfg);
|
||||||
|
|
||||||
// webserver init -----------------------------------------------------
|
// webserver init -----------------------------------------------------
|
||||||
self.httplog = new Logger.Logger(path.join(__dirname,
|
self.httplog = new Logger.Logger(path.join(__dirname,
|
||||||
"../httpaccess.log"));
|
"../httpaccess.log"));
|
||||||
self.express = express();
|
self.express = express();
|
||||||
require("./web/webserver").init(self.express);
|
require("./web/webserver").init(self.express);
|
||||||
|
self.express.get("/old/:channel(*)", function (req, res, next) {
|
||||||
|
var c = req.params.channel;
|
||||||
|
if (!$util.isValidChannelName(c)) {
|
||||||
|
res.redirect("/" + c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.logHTTP(req);
|
||||||
|
res.sendfile("channel.html", {
|
||||||
|
root: path.join(__dirname, "../www")
|
||||||
|
});
|
||||||
|
});
|
||||||
/*
|
/*
|
||||||
self.express.use(express.urlencoded());
|
self.express.use(express.urlencoded());
|
||||||
self.express.use(express.json());
|
self.express.use(express.json());
|
||||||
|
|
|
@ -478,7 +478,7 @@ $(window).resize(function() {
|
||||||
/* load channel */
|
/* load channel */
|
||||||
|
|
||||||
var loc = document.location+"";
|
var loc = document.location+"";
|
||||||
var m = loc.match(/\/r\/([a-zA-Z0-9-_]+)$/);
|
var m = loc.match(/\/old\/([a-zA-Z0-9-_]+)$/);
|
||||||
if(m) {
|
if(m) {
|
||||||
CHANNEL.name = m[1];
|
CHANNEL.name = m[1];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue