Skip to content

Commit

Permalink
better sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
Xananax committed Jun 27, 2016
1 parent edd5c71 commit d7cc825
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
npm-debug.log
sessions
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
npm-debug.log
sessions
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "calibre-serve",
"version": "0.6.0",
"version": "0.6.1",
"description": "A calibre API and server",
"main": "index.js",
"bin": "cli.js",
Expand All @@ -17,6 +17,7 @@
"express-session": "^1.13.0",
"moment": "^2.13.0",
"serve-favicon": "^2.3.0",
"session-file-store": "^0.2.0",
"sqlite3": "^3.1.4",
"squel": "^5.3.2"
},
Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function log(req,res,next){

function errorLog(err,req,res,next){
const url = URL.parse(req.url).pathname;
console.error(formatLog(req,url)+`ERROR: ${err.message}`);
return next();
console.error(formatLog(req,url)+`\nERROR: ${err.message}`);
return next(err);
}

function startServer(root,title='Calibre Server',port=3000,tokens=false,footer='',ga=null,verbose=true){
Expand Down
4 changes: 3 additions & 1 deletion src/authentication.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var session = require('express-session')
const session = require('express-session')
const FileStore = require('session-file-store')(session);

module.exports = function createAuth(app,tokens,skip){

Expand All @@ -10,6 +11,7 @@ module.exports = function createAuth(app,tokens,skip){
{ secret: Math.random()+'calibre-server'
, resave: false
, saveUninitialized: true
, store:new FileStore()
})
);

Expand Down

0 comments on commit d7cc825

Please sign in to comment.