mirror of
https://github.com/amark/gun.git
synced 2025-06-07 14:46:44 +00:00
fix @yokowasis bug found + house keeping.
This commit is contained in:
parent
c97ac0002c
commit
edf6c5f38d
1
axe.js
1
axe.js
@ -43,6 +43,7 @@
|
|||||||
tmp.id = tmp.url = id;
|
tmp.id = tmp.url = id;
|
||||||
tmp.retry = tmp.retry || 0; // BUG: Check 0?
|
tmp.retry = tmp.retry || 0; // BUG: Check 0?
|
||||||
console.log("AXE enabled: Trying to find network via (1) local peer (2) last used peers (3) hard coded peers.");
|
console.log("AXE enabled: Trying to find network via (1) local peer (2) last used peers (3) hard coded peers.");
|
||||||
|
console.log("Warning: AXE alpha became super slow & laggy, now in testing only mode!");
|
||||||
var last = JSON.parse((localStorage||'')[(opt.file||'')+'axe/']||null) || {};
|
var last = JSON.parse((localStorage||'')[(opt.file||'')+'axe/']||null) || {};
|
||||||
Object.keys(last.peers||'').forEach(function(key){
|
Object.keys(last.peers||'').forEach(function(key){
|
||||||
tmp = peers[id = key] = peers[id] || {};
|
tmp = peers[id = key] = peers[id] || {};
|
||||||
|
@ -25,16 +25,12 @@ a, button, input, textarea {
|
|||||||
text-decoration: inherit;
|
text-decoration: inherit;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
a:focus, button:focus, input[type=button]:focus, input[type=submit]:focus {
|
|
||||||
animation: pulse 2s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
input:not([type=button]):not([type=submit]), textarea {
|
input:not([type=button]):not([type=submit]), textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
::placeholder, .hint {
|
|
||||||
color: inherit;
|
a:focus, button:focus, input[type=button]:focus, input[type=submit]:focus {
|
||||||
opacity: 0.3;
|
animation: pulse 2s infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul, li {
|
ul, li {
|
||||||
@ -51,6 +47,10 @@ p + p {
|
|||||||
[contenteditable=true]:empty:before {
|
[contenteditable=true]:empty:before {
|
||||||
content: attr(placeholder);
|
content: attr(placeholder);
|
||||||
}
|
}
|
||||||
|
::placeholder, .hint {
|
||||||
|
color: inherit;
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
|
||||||
.model, .none { display: none }
|
.model, .none { display: none }
|
||||||
.hide {
|
.hide {
|
||||||
@ -59,11 +59,10 @@ p + p {
|
|||||||
transition: all 2s;
|
transition: all 2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.full, .page {
|
.full {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.max {
|
.max {
|
||||||
max-width: 48em;
|
max-width: 48em;
|
||||||
}
|
}
|
||||||
@ -77,6 +76,25 @@ p + p {
|
|||||||
min-width: 12em;
|
min-width: 12em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.row::after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.col {
|
||||||
|
max-width: 24em;
|
||||||
|
min-width: 12em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
.right {
|
.right {
|
||||||
float: right;
|
float: right;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@ -85,12 +103,6 @@ p + p {
|
|||||||
float: left;
|
float: left;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
.center {
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
.mid {
|
.mid {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
@ -111,12 +123,6 @@ p + p {
|
|||||||
.crack { margin-bottom: 1%; }
|
.crack { margin-bottom: 1%; }
|
||||||
.sit { margin-bottom: 0; }
|
.sit { margin-bottom: 0; }
|
||||||
|
|
||||||
.row { width: 100%; }
|
|
||||||
.col {
|
|
||||||
max-width: 24em;
|
|
||||||
min-width: 12em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.focus {
|
.focus {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
4
gun.js
4
gun.js
@ -347,7 +347,8 @@
|
|||||||
++ni; kl = null; pop(o);
|
++ni; kl = null; pop(o);
|
||||||
}());
|
}());
|
||||||
} Gun.on.put = put;
|
} Gun.on.put = put;
|
||||||
console.log("BEWARE: BETA VERSION OF NEW GUN! NOT ALL FEATURES FINISHED!"); // clock below, reconnect sync, SEA certify wire merge, User.auth taking multiple times, // msg put, put, say ack, hear loop...
|
// TODO: MARK!!! clock below, reconnect sync, SEA certify wire merge, User.auth taking multiple times, // msg put, put, say ack, hear loop...
|
||||||
|
// WASIS BUG! first .once( undef 2nd good. .off othe rpeople: .open
|
||||||
function ham(val, key, soul, state, msg){
|
function ham(val, key, soul, state, msg){
|
||||||
var ctx = msg._||'', root = ctx.root, graph = root.graph, lot, tmp;
|
var ctx = msg._||'', root = ctx.root, graph = root.graph, lot, tmp;
|
||||||
var vertex = graph[soul] || empty, was = state_is(vertex, key, 1), known = vertex[key];
|
var vertex = graph[soul] || empty, was = state_is(vertex, key, 1), known = vertex[key];
|
||||||
@ -1188,6 +1189,7 @@
|
|||||||
if(eve.stun){ return } if('' === one[id]){ return }
|
if(eve.stun){ return } if('' === one[id]){ return }
|
||||||
if(true === (tmp = Gun.valid(data))){ once(); return }
|
if(true === (tmp = Gun.valid(data))){ once(); return }
|
||||||
if('string' == typeof tmp){ return } // TODO: BUG? Will this always load?
|
if('string' == typeof tmp){ return } // TODO: BUG? Will this always load?
|
||||||
|
clearTimeout((cat.one||'')[id]); // clear "not found" since they only get set on cat.
|
||||||
clearTimeout(one[id]); one[id] = setTimeout(once, opt.wait||99); // TODO: Bug? This doesn't handle plural chains.
|
clearTimeout(one[id]); one[id] = setTimeout(once, opt.wait||99); // TODO: Bug? This doesn't handle plural chains.
|
||||||
function once(){
|
function once(){
|
||||||
if(!at.has && !at.soul){ at = {put: data, get: key} } // handles non-core messages.
|
if(!at.has && !at.soul){ at = {put: data, get: key} } // handles non-core messages.
|
||||||
|
@ -14,7 +14,7 @@ Gun.on('create', function(root){
|
|||||||
|
|
||||||
try{AWS = require('aws-sdk');
|
try{AWS = require('aws-sdk');
|
||||||
}catch(e){
|
}catch(e){
|
||||||
console.log("aws-sdk is no longer included by default, you must add it to your package.json! `npm install aws-sdk`.");
|
console.log("Please `npm install aws-sdk` or add it to your package.json !");
|
||||||
AWS_SDK_NOT_INSTALLED;
|
AWS_SDK_NOT_INSTALLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gun",
|
"name": "gun",
|
||||||
"version": "0.2020.1234",
|
"version": "0.2020.1235",
|
||||||
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
|
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
@ -62,7 +62,6 @@
|
|||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@peculiar/webcrypto": "^1.1.1",
|
"@peculiar/webcrypto": "^1.1.1",
|
||||||
"text-encoding": "^0.7.0",
|
|
||||||
"emailjs": "^2.2.0"
|
"emailjs": "^2.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
8
sea.js
8
sea.js
@ -47,7 +47,7 @@
|
|||||||
var u;
|
var u;
|
||||||
if(u+''== typeof btoa){
|
if(u+''== typeof btoa){
|
||||||
if(u+'' == typeof Buffer){
|
if(u+'' == typeof Buffer){
|
||||||
try{ global.Buffer = USE("buffer", 1).Buffer }catch(e){ console.log("Please add `buffer` to your package.json!") }
|
try{ global.Buffer = USE("buffer", 1).Buffer }catch(e){ console.log("Please `npm install buffer` or add it to your package.json !") }
|
||||||
}
|
}
|
||||||
global.btoa = function(data){ return Buffer.from(data, "binary").toString("base64") };
|
global.btoa = function(data){ return Buffer.from(data, "binary").toString("base64") };
|
||||||
global.atob = function(data){ return Buffer.from(data, "base64").toString("binary") };
|
global.atob = function(data){ return Buffer.from(data, "base64").toString("binary") };
|
||||||
@ -202,7 +202,7 @@
|
|||||||
api.ossl = api.subtle = new WebCrypto({directory: 'ossl'}).subtle // ECDH
|
api.ossl = api.subtle = new WebCrypto({directory: 'ossl'}).subtle // ECDH
|
||||||
}
|
}
|
||||||
catch(e){
|
catch(e){
|
||||||
console.log("Please add `@peculiar/webcrypto` to your package.json!");
|
console.log("Please `npm install @peculiar/webcrypto` or add it to your package.json !");
|
||||||
}}
|
}}
|
||||||
|
|
||||||
module.exports = api
|
module.exports = api
|
||||||
@ -1034,7 +1034,7 @@
|
|||||||
if(SEA.window && ((gun.back('user')._).opt||opt).remember){
|
if(SEA.window && ((gun.back('user')._).opt||opt).remember){
|
||||||
// TODO: this needs to be modular.
|
// TODO: this needs to be modular.
|
||||||
try{var sS = {};
|
try{var sS = {};
|
||||||
sS = window.sessionStorage;
|
sS = window.sessionStorage; // TODO: FIX BUG putting on `.is`!
|
||||||
sS.recall = true;
|
sS.recall = true;
|
||||||
sS.pair = JSON.stringify(pair); // auth using pair is more reliable than alias/pass
|
sS.pair = JSON.stringify(pair); // auth using pair is more reliable than alias/pass
|
||||||
}catch(e){}
|
}catch(e){}
|
||||||
@ -1111,7 +1111,7 @@
|
|||||||
if(SEA.window){
|
if(SEA.window){
|
||||||
try{
|
try{
|
||||||
var sS = {};
|
var sS = {};
|
||||||
sS = window.sessionStorage;
|
sS = window.sessionStorage; // TODO: FIX BUG putting on `.is`!
|
||||||
if(sS){
|
if(sS){
|
||||||
(root._).opt.remember = true;
|
(root._).opt.remember = true;
|
||||||
((gun.back('user')._).opt||opt).remember = true;
|
((gun.back('user')._).opt||opt).remember = true;
|
||||||
|
@ -3900,6 +3900,38 @@ describe('Gun', function(){
|
|||||||
},100);
|
},100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.skip('do not refire', function(done){ // for Wasis @yokowasis ! Thanks for finding.
|
||||||
|
var gun = Gun();
|
||||||
|
|
||||||
|
for (i=0;i<=100;i++) {
|
||||||
|
gun.get("something").get("level1").put({
|
||||||
|
[i]: i
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0;i<=100;i++) {
|
||||||
|
gun.get("something").get("level1").get("level2").put({
|
||||||
|
[i]: i
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var c = 0;
|
||||||
|
setTimeout(function(){
|
||||||
|
gun.get("something").get("level1").on(()=>{
|
||||||
|
c++;
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
gun.get("something").get("level1").once(function(x){
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
expect(c).to.be(1);
|
||||||
|
nopasstun(done, gun);
|
||||||
|
},100);
|
||||||
|
});
|
||||||
|
},100);
|
||||||
|
},100);
|
||||||
|
});
|
||||||
/*it.skip('Memory management', function(done){
|
/*it.skip('Memory management', function(done){
|
||||||
this.timeout(9999999);
|
this.timeout(9999999);
|
||||||
var gun = Gun(), c = 100000, big = "big";
|
var gun = Gun(), c = 100000, big = "big";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user