mirror of
https://github.com/amark/gun.git
synced 2025-07-03 11:22:32 +00:00
Added seatest to package.json
This commit is contained in:
parent
4fb5b64596
commit
4e46e5e4c4
@ -68,8 +68,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<script src="/jquery.js"></script>
|
<script src="/jquery.js"></script>
|
||||||
<script src="/gun.js"></script>
|
<script src="/gun.js"></script>
|
||||||
|
<!--
|
||||||
|
<script src="/gun/lib/cryptomodules.js" type="text/javascript"></script>
|
||||||
|
<script src="/gun/sea.js"></script>
|
||||||
|
-->
|
||||||
<script>
|
<script>
|
||||||
var gun = Gun(location.origin+'/gun');
|
var gun = Gun(location.origin+'/gun');
|
||||||
|
var user = gun.user && gun.user();
|
||||||
|
if(user){
|
||||||
|
// 1st: call create. 2nd call auth. After that, call recall
|
||||||
|
// user.create('dude', 'my secret').then(function(ack) { console.log('created ack:', ack) });
|
||||||
|
// user.recall().then(function(ack){
|
||||||
|
// if (!ack || !ack.sea){
|
||||||
|
// console.log('user.recall not bootstrapping...');
|
||||||
|
// user.auth('dude', 'my secret', {pin: 'PIN'}).then(function(user) { console.log('authenticated user:', user) });
|
||||||
|
// // user.auth('dude', 'my secret', {pin: 'PIN', newpass: 'my new secret'}).then(function(user) { console.log('authenticated user:', user) });
|
||||||
|
// } else {
|
||||||
|
// // gun.get('pub/' + ack.pub).put({ hello: 'world' });
|
||||||
|
// gun.get('pub/' + ack.pub).get('hello').val((val, key) => console.log('READ:', val, key));
|
||||||
|
// console.log('user.recall authenticated user:', ack.alias);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
var chat = gun.get('converse');
|
var chat = gun.get('converse');
|
||||||
chat.map().val(function(msg, field){
|
chat.map().val(function(msg, field){
|
||||||
var ul = $('ul'), last = sort(field, ul.children('li').last()), li;
|
var ul = $('ul'), last = sort(field, ul.children('li').last()), li;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"start": "node examples/http.js 8080",
|
"start": "node examples/http.js 8080",
|
||||||
"prepublish": "npm run unbuild",
|
"prepublish": "npm run unbuild",
|
||||||
"test": "mocha",
|
"test": "mocha",
|
||||||
|
"testsea": "mocha test/sea.js",
|
||||||
"e2e": "mocha e2e/distributed.js",
|
"e2e": "mocha e2e/distributed.js",
|
||||||
"docker": "hooks/build",
|
"docker": "hooks/build",
|
||||||
"unbuild": "node lib/unbuild.js && uglifyjs gun.js -o gun.min.js -c -m"
|
"unbuild": "node lib/unbuild.js && uglifyjs gun.js -o gun.min.js -c -m"
|
||||||
|
6
sea.js
6
sea.js
@ -811,13 +811,13 @@
|
|||||||
};
|
};
|
||||||
each.pubs = function(val, key, node, soul){
|
each.pubs = function(val, key, node, soul){
|
||||||
if(!val){ return on.to('end', {err: "Alias must exist!"}) } // data MUST exist
|
if(!val){ return on.to('end', {err: "Alias must exist!"}) } // data MUST exist
|
||||||
if(key === Gun.val.rel.is(val)){ return check['pubs'+soul+key] = 0 } // and the ID must be EXACTLY equal to its property
|
if(key === Gun.val.rel.is(val)){ return (check['pubs'+soul+key] = 0) } // and the ID must be EXACTLY equal to its property
|
||||||
return on.to('end', {err: "Alias must match!"}); // that way nobody can tamper with the list of public keys.
|
return on.to('end', {err: "Alias must match!"}); // that way nobody can tamper with the list of public keys.
|
||||||
};
|
};
|
||||||
each.pub = function(val, key, node, soul, pub){
|
each.pub = function(val, key, node, soul, pub){
|
||||||
//console.log("WE ARE HERE", key, val, soul, node, pub);
|
//console.log("WE ARE HERE", key, val, soul, node, pub);
|
||||||
if('pub' === key){
|
if('pub' === key){
|
||||||
if(val === pub){ return check['pub'+soul+key] = 0 } // the account MUST have a `pub` property that equals the ID of the public key.
|
if(val === pub){ return (check['pub'+soul+key] = 0) } // the account MUST have a `pub` property that equals the ID of the public key.
|
||||||
return on.to('end', {err: "Account must match!"});
|
return on.to('end', {err: "Account must match!"});
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -859,7 +859,7 @@
|
|||||||
console.log('NO!', each.err);
|
console.log('NO!', each.err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Gun.obj.map(check, function(no){
|
if(Gun.obj.map(check, function(no, key){
|
||||||
if(no){ return true }
|
if(no){ return true }
|
||||||
})){ return }
|
})){ return }
|
||||||
to.next(msg);
|
to.next(msg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user