From 6191c7178cd980b299a6301dafeeb936f0ec91a1 Mon Sep 17 00:00:00 2001 From: BigBlueHat Date: Sat, 11 Apr 2015 09:49:14 -0400 Subject: [PATCH 1/6] Add .gitkeep to dist/ so it is there at build --- dist/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 dist/.gitkeep diff --git a/dist/.gitkeep b/dist/.gitkeep new file mode 100644 index 0000000..e69de29 From ea7deae0af26c69e13bc818c3f17d023968ab186 Mon Sep 17 00:00:00 2001 From: BigBlueHat Date: Sat, 11 Apr 2015 10:24:21 -0400 Subject: [PATCH 2/6] Add leveldown to dependencies since default --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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", From 911963e4fa126483204cf07c7399e9759113e3cf Mon Sep 17 00:00:00 2001 From: BigBlueHat Date: Sat, 11 Apr 2015 10:56:21 -0400 Subject: [PATCH 3/6] Add a space to `Token url for` message --- lib/server/janus.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server/janus.js b/lib/server/janus.js index 6223862..6a01750 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 || From 40ca43c2ddad1bf17da1ef078a6a121adbc4e541 Mon Sep 17 00:00:00 2001 From: BigBlueHat Date: Sat, 11 Apr 2015 10:57:22 -0400 Subject: [PATCH 4/6] Ignoring `data` and `dist/*` --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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/* From a5a291f5047265645ad3460256880cd3917b0021 Mon Sep 17 00:00:00 2001 From: BigBlueHat Date: Sat, 11 Apr 2015 10:57:49 -0400 Subject: [PATCH 5/6] Add basic DEVELOPMENT doc --- DEVELOPMENT.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 DEVELOPMENT.md diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..d52bbe2 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,20 @@ +# 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: + +*Note:* If testing on `localhost` you MAY need to change the generated validate +URL to use `localhost` rather than `127.0.0.1`. They aren't quite the same to +the validation system. From 32ab2ee09f7eae584e774bdaf7ab81b5b25c0686 Mon Sep 17 00:00:00 2001 From: BigBlueHat Date: Sun, 12 Apr 2015 14:05:44 -0400 Subject: [PATCH 6/6] Handle localhost/127.0.0.1 weirdness This can likely be done better, but it at least avoids the confusion fraught by 127.0.0.1 !== localhost various places. --- DEVELOPMENT.md | 4 ---- lib/server/janus.js | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d52bbe2..963925f 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -14,7 +14,3 @@ $ 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: - -*Note:* If testing on `localhost` you MAY need to change the generated validate -URL to use `localhost` rather than `127.0.0.1`. They aren't quite the same to -the validation system. diff --git a/lib/server/janus.js b/lib/server/janus.js index 6a01750..1d8dd95 100644 --- a/lib/server/janus.js +++ b/lib/server/janus.js @@ -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);