diff --git a/.gitignore b/.gitignore index 63f3cb3..650684d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ node_modules tmp -npm-debug.log \ No newline at end of file +npm-debug.log +data +dist/* diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..963925f --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,16 @@ +# Developing pouch.host + +## Install + +``` +$ npm install +$ export DEBUG=janus +$ export EMAIL_ADDRESS={from_address} +$ export EMAIL_PASSWORD={from_password} +$ export EMAIL_SMTP={smtp_server} +$ npm run dev +``` + +If you set set `DEBUG`, the login token will be added to the console output, so +the SMTP settings then are technically optional...unless you're testing them. +:grinning: diff --git a/dist/.gitkeep b/dist/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/server/janus.js b/lib/server/janus.js index 6223862..1d8dd95 100644 --- a/lib/server/janus.js +++ b/lib/server/janus.js @@ -39,7 +39,7 @@ var Janus = function(host, PouchDB) { Janus.prototype.sendToken = function(email, token, host, cb) { var url = this.tokenUrl(token, host, email); - debug('Token url for' + email + ' is: ' + url); + debug('Token url for ' + email + ' is: ' + url); if (!process.env.EMAIL_ADDRESS || !process.env.EMAIL_PASSWORD || @@ -61,6 +61,11 @@ Janus.prototype.sendToken = function(email, token, host, cb) { }; Janus.prototype.tokenUrl = function(token, host, uid) { + var authority = this.host; + // Handle 127.0.0.1 / localhost mismatch + if (this.host === 'http://127.0.0.1/' && host == 'http://localhost/') { + authority = host; + } return this.host + 'validate/?token=' + token + '&uid=' + encodeURIComponent(uid) + '&host=' + encodeURIComponent(host); diff --git a/package.json b/package.json index 8886ed5..39f7bb3 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "browserify": "^6.3.2", "lie": "^2.8.0", "pouchdb-express-router": "0.0.1", - "cookie-session": "^1.1.0" + "cookie-session": "^1.1.0", + "leveldown": "^0.10.4" }, "devDependencies": { "nodemon": "^1.2.1",