Add cache TTL option; fixes

This commit is contained in:
calzoneman 2013-07-28 17:10:35 -04:00
parent 2fb28f4d43
commit 6899186600
4 changed files with 14 additions and 8 deletions

8
api.js
View File

@ -286,7 +286,7 @@ module.exports = function (Server) {
text: msg
};
var api = this;
cfg["nodemailer"].sendMail(mail, function(err, response) {
Server.cfg["nodemailer"].sendMail(mail, function(err, response) {
if(err) {
Logger.errlog.log("Mail fail: " + err);
api.sendJSON(res, {
@ -317,12 +317,12 @@ module.exports = function (Server) {
name: info[0],
pw: info[1]
});
ActionLog.record(ip, name, "password-recover-success");
Logger.syslog.log(ip + " recovered password for " + name);
ActionLog.record(ip, info[0], "password-recover-success");
Logger.syslog.log(ip + " recovered password for " + info[0]);
return;
}
catch(e) {
ActionLog.record(ip, name, "password-recover-failure");
ActionLog.record(ip, "", "password-recover-failure");
this.sendJSON(res, {
success: false,
error: e

View File

@ -39,7 +39,12 @@ var defaults = {
}
function save(cfg, file) {
fs.writeFile(file, JSON.stringify(cfg, null, 4), function (err) {
var x = {};
for(var k in cfg) {
if(k !== "nodemailer")
x[k] = cfg[k];
}
fs.writeFile(file, JSON.stringify(x, null, 4), function (err) {
if(err) {
Logger.errlog.log("Failed to save config");
Logger.errlog.log(err);

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "2.1.2",
"version": "2.1.3",
"repository": {
"url": "http://github.com/calzoneman/sync"
},

View File

@ -5,7 +5,7 @@ var Logger = require("./logger");
var Channel = require("./channel");
var User = require("./user");
const VERSION = "2.1.2";
const VERSION = "2.1.3";
function getIP(req) {
var raw = req.connection.remoteAddress;
@ -95,6 +95,7 @@ var Server = {
this.app.get("/:thing(*)", function (req, res, next) {
var opts = {
root: __dirname + "/www",
maxAge: this.cfg["asset-cache-ttl"]
}
res.sendfile(req.params.thing, opts, function (err) {
if(err) {
@ -114,7 +115,7 @@ var Server = {
}
}
});
});
}.bind(this));
// fallback
this.app.use(function (err, req, res, next) {