mirror of https://github.com/calzoneman/sync.git
Add cache TTL option; fixes
This commit is contained in:
parent
2fb28f4d43
commit
6899186600
8
api.js
8
api.js
|
@ -286,7 +286,7 @@ module.exports = function (Server) {
|
||||||
text: msg
|
text: msg
|
||||||
};
|
};
|
||||||
var api = this;
|
var api = this;
|
||||||
cfg["nodemailer"].sendMail(mail, function(err, response) {
|
Server.cfg["nodemailer"].sendMail(mail, function(err, response) {
|
||||||
if(err) {
|
if(err) {
|
||||||
Logger.errlog.log("Mail fail: " + err);
|
Logger.errlog.log("Mail fail: " + err);
|
||||||
api.sendJSON(res, {
|
api.sendJSON(res, {
|
||||||
|
@ -317,12 +317,12 @@ module.exports = function (Server) {
|
||||||
name: info[0],
|
name: info[0],
|
||||||
pw: info[1]
|
pw: info[1]
|
||||||
});
|
});
|
||||||
ActionLog.record(ip, name, "password-recover-success");
|
ActionLog.record(ip, info[0], "password-recover-success");
|
||||||
Logger.syslog.log(ip + " recovered password for " + name);
|
Logger.syslog.log(ip + " recovered password for " + info[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
ActionLog.record(ip, name, "password-recover-failure");
|
ActionLog.record(ip, "", "password-recover-failure");
|
||||||
this.sendJSON(res, {
|
this.sendJSON(res, {
|
||||||
success: false,
|
success: false,
|
||||||
error: e
|
error: e
|
||||||
|
|
|
@ -39,7 +39,12 @@ var defaults = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(cfg, file) {
|
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) {
|
if(err) {
|
||||||
Logger.errlog.log("Failed to save config");
|
Logger.errlog.log("Failed to save config");
|
||||||
Logger.errlog.log(err);
|
Logger.errlog.log(err);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "2.1.2",
|
"version": "2.1.3",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,7 +5,7 @@ var Logger = require("./logger");
|
||||||
var Channel = require("./channel");
|
var Channel = require("./channel");
|
||||||
var User = require("./user");
|
var User = require("./user");
|
||||||
|
|
||||||
const VERSION = "2.1.2";
|
const VERSION = "2.1.3";
|
||||||
|
|
||||||
function getIP(req) {
|
function getIP(req) {
|
||||||
var raw = req.connection.remoteAddress;
|
var raw = req.connection.remoteAddress;
|
||||||
|
@ -95,6 +95,7 @@ var Server = {
|
||||||
this.app.get("/:thing(*)", function (req, res, next) {
|
this.app.get("/:thing(*)", function (req, res, next) {
|
||||||
var opts = {
|
var opts = {
|
||||||
root: __dirname + "/www",
|
root: __dirname + "/www",
|
||||||
|
maxAge: this.cfg["asset-cache-ttl"]
|
||||||
}
|
}
|
||||||
res.sendfile(req.params.thing, opts, function (err) {
|
res.sendfile(req.params.thing, opts, function (err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
|
@ -114,7 +115,7 @@ var Server = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}.bind(this));
|
||||||
|
|
||||||
// fallback
|
// fallback
|
||||||
this.app.use(function (err, req, res, next) {
|
this.app.use(function (err, req, res, next) {
|
||||||
|
|
Loading…
Reference in New Issue