Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
tmp
npm-debug.log
npm-debug.log
data
dist/*
16 changes: 16 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -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:
Empty file added dist/.gitkeep
Empty file.
7 changes: 6 additions & 1 deletion lib/server/janus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down