Merge pull request #373 from sjones6/verify-fix

Verify fix
This commit is contained in:
Mark Nadal 2017-05-30 18:38:23 -07:00 committed by GitHub
commit edf0f01c3e
3 changed files with 8 additions and 8 deletions

2
gun.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -46,6 +46,11 @@ Gun.on('opt', function(context) {
var opt = context.opt || {};
var ws = opt.ws || {};
if (!opt.verify) {
this.to.next(context);
return;
}
/**
* verify when instantiating Gun can contain the following keys:
* allowOrigins: Array|RegExp|String
@ -53,12 +58,7 @@ Gun.on('opt', function(context) {
* authKey: String
* check: Function
*/
var verify = opt.verify || {};
if (!verify) {
this.to.next(context);
return;
}
var verify = opt.verify;
if (ws.verifyClient && !verify.override) {
throw Error('Cannot override existing verifyClient option in `ws` configuration.');
}

View File

@ -189,7 +189,7 @@ Gun._ = { // some reserved key words, these are not the only ones.
if(!obj_is(at.opt.peers)){ at.opt.peers = {}}
at.opt.peers = obj_to(tmp, at.opt.peers);
}
at.opt.wsc = at.opt.wsc || {protocols:null}
at.opt.wsc = at.opt.wsc || {protocols:''}
at.opt.peers = at.opt.peers || {};
obj_to(opt, at.opt); // copies options on to `at.opt` only if not already taken.
Gun.on('opt', at);