Skip to content

Commit

Permalink
Version 0.1.44
Browse files Browse the repository at this point in the history
* Changes in impress.passport.js plugin: urls moved to config, no mixin
to appication if no passport.js in application config
* Prevent application from log files creating and rotation if
"applicationLog" is false in application config/log.js
* Added wcl.js to example page and other minor fixes
  • Loading branch information
tshemsedinov committed Jun 17, 2014
1 parent 3c88203 commit 1742e64
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 65 deletions.
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.1.44 / 2014-06-17
==================

* Changes in impress.passport.js plugin: urls moved to config, no mixin to appication if no passport.js in application config
* Prevent application from log files creating and rotation if "applicationLog" is false in application config/log.js
* Added wcl.js to example page and other minor fixes

0.1.43 / 2014-06-16
==================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,4 +735,24 @@ br.clear { clear:both; }
.slick-cell .editor-text {
border: none;
width: 100%;
}
}




svg {
font: 10px sans-serif;
}

.line {
fill: none;
stroke: #000;
stroke-width: 1.5px;
}

.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
<script type="text/javascript" src="/js/eventsource.js"></script>
<script type="text/javascript" src="/js/global.js"></script>
<script type="text/javascript" src="/js/mobilization.js"></script>
<script type="text/javascript" src="/js/wcl.js"></script>
<script type="text/javascript" src="/js/scroller/scroller.js"></script>
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/js/jquery.hotkeys.js"></script>
<script type="text/javascript" src="/js/jstree/jquery.jstree.js"></script>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>

<script type="text/javascript" src="/js/slickgrid/lib/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="/js/slickgrid/lib/jquery.event.drag-2.2.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ if (global.passport) {
}

} catch (e) { console.trace(); }
}
},
successRedirect: '/api/auth/userInfo.json',
failureRedirect: '/'

}
}
};
Expand Down
1 change: 1 addition & 0 deletions examples/copyContentToProjectFolder/config/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
'require',
'console',
'process',
'impress',
'db',
'cms',
'os',
Expand Down
1 change: 0 additions & 1 deletion examples/copyContentToProjectFolder/config/servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module.exports = {
protocol: "http",
address: "127.0.0.1",
port: 80,
applications: ["example"], // virtual hosts for this server (see hosts definitions below)
nagle: true, // Nagle algorithm, default true, set to false for latency optimization
slowTime: "1s"
},
Expand Down
60 changes: 32 additions & 28 deletions lib/impress.log.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,28 @@
// Open log files
//
application.log.open = function(callback) {
impress.mkdirp(application.log.dir, function(err) {
if (err) console.error(err);
else {
var now = new Date(),
date = nowDate(now),
fileType,
cbCount = application.log.fileTypes.length,
cbIndex = 0,
cb = function() { if (++cbIndex>=cbCount && callback) callback(); };
for (var i = 0; i < application.log.fileTypes.length; i++) {
fileType = application.log.fileTypes[i];
application.log.openFile(fileType, cb);
if (application === impress || applicationLog) {
impress.mkdirp(application.log.dir, function(err) {
if (err) console.error(err);
else {
var now = new Date(),
date = nowDate(now),
fileType,
cbCount = application.log.fileTypes.length,
cbIndex = 0,
cb = function() { if (++cbIndex>=cbCount && callback) callback(); };
for (var i = 0; i < application.log.fileTypes.length; i++) {
fileType = application.log.fileTypes[i];
application.log.openFile(fileType, cb);
}
var nextDate = new Date();
nextDate.setUTCHours(0, 0, 0, 0);
var nextReopen = nextDate - now + dayMilliseconds;
setTimeout(application.log.open, nextReopen);
if (keepDays && impress.cluster.isMaster) application.log.deleteOldFiles();
}
var nextDate = new Date();
nextDate.setUTCHours(0, 0, 0, 0);
var nextReopen = nextDate - now + dayMilliseconds;
setTimeout(application.log.open, nextReopen);
if (keepDays && impress.cluster.isMaster) application.log.deleteOldFiles();
}
});
});
} else callback();
};

// Open log files
Expand All @@ -104,15 +106,17 @@
// Close log files
//
application.log.close = function(callback) {
var cbCount = application.log.fileTypes.length,
cbIndex = 0,
fileType;
for (var i = 0; i < application.log.fileTypes.length; i++) {
fileType = application.log.fileTypes[i];
application.log.closeFile(fileType, function() {
if (++cbIndex>=cbCount && callback) callback();
});
}
if (application === impress || applicationLog) {
var cbCount = application.log.fileTypes.length,
cbIndex = 0,
fileType;
for (var i = 0; i < application.log.fileTypes.length; i++) {
fileType = application.log.fileTypes[i];
application.log.closeFile(fileType, function() {
if (++cbIndex>=cbCount && callback) callback();
});
}
} else callback();
};

// Close log file of specified type
Expand Down
68 changes: 35 additions & 33 deletions lib/impress.passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,43 @@
impress.passport = impress.passport || {};

impress.passport.mixinApplication = function (application) {
application.passport = {};
var passport = application.config.passport.lib,
strategies = {},
handlers = [passport.initialize(), passport.session()],
providers = application.config.passport.strategies;
if (providers) {
var provider, providerId;
for (var providerName in providers) {
provider = providers[providerName];
providerId = application.name+'/'+providerName;
providers[providerName].param.passReqToCallback = true;
passport.use(providerId, new provider.strategy(provider.param, provider.authenticate));
strategies[providerName] = {
authenticate: passport.authenticate(providerId, { scope: "profile" }),
authenticateCallback: passport.authenticate(providerId, {
successRedirect: '/api/auth/userInfo.json',
failureRedirect: '/'
})
if (application.config.passport) {
application.passport = {};
var passport = application.config.passport.lib,
strategies = {},
handlers = [passport.initialize(), passport.session()],
providers = application.config.passport.strategies;
if (providers) {
var provider, providerId;
for (var providerName in providers) {
provider = providers[providerName];
providerId = application.name+'/'+providerName;
provider.param.passReqToCallback = true;
passport.use(providerId, new provider.strategy(provider.param, provider.authenticate));
strategies[providerName] = {
authenticate: passport.authenticate(providerId, { scope: "profile" }),
authenticateCallback: passport.authenticate(providerId, {
successRedirect: provider.successRedirect,
failureRedirect: provider.failureRedirect
})
};
}
application.passport.mixinClient = function(client) {
client.passport = {};
client.passport.strategies = strategies;
client.req.query = client.query;
client.res.redirect = function (url) { client.redirect(url); client.res.end(); };
client.passport.init = function() {
if (!client.session) client.startSession();
client.req.session = client.application.sessions[client.session];
impress.async.eachSeries(handlers, function(handler, callback) {
handler(client.req, client.res, callback);
}, function(err) {
client.processing();
});
}
};
}
application.passport.mixinClient = function(client) {
client.passport = {};
client.passport.strategies = strategies;
client.req.query = client.query;
client.res.redirect = function (url) { client.redirect(url); client.res.end(); };
client.passport.init = function() {
if (!client.session) client.startSession();
client.req.session = client.application.sessions[client.session];
impress.async.eachSeries(handlers, function(handler, callback) {
handler(client.req, client.res, callback);
}, function(err) {
client.processing();
});
}
};
}
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "impress",
"version": "0.1.43",
"version": "0.1.44",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",
"description": "Impressive Totalitarian-style Multipurpose Application Server for node.js. All decisions are made. Ready for applied development",
"keywords": [
Expand Down

0 comments on commit 1742e64

Please sign in to comment.