fix @yokowasis bug found + house keeping.

This commit is contained in:
Mark Nadal 2021-09-13 23:02:45 -07:00
parent c97ac0002c
commit edf6c5f38d
7 changed files with 69 additions and 29 deletions

1
axe.js
View File

@ -43,6 +43,7 @@
tmp.id = tmp.url = id;
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("Warning: AXE alpha became super slow & laggy, now in testing only mode!");
var last = JSON.parse((localStorage||'')[(opt.file||'')+'axe/']||null) || {};
Object.keys(last.peers||'').forEach(function(key){
tmp = peers[id = key] = peers[id] || {};

View File

@ -25,16 +25,12 @@ a, button, input, textarea {
text-decoration: inherit;
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 {
width: 100%;
}
::placeholder, .hint {
color: inherit;
opacity: 0.3;
a:focus, button:focus, input[type=button]:focus, input[type=submit]:focus {
animation: pulse 2s infinite;
}
ul, li {
@ -51,6 +47,10 @@ p + p {
[contenteditable=true]:empty:before {
content: attr(placeholder);
}
::placeholder, .hint {
color: inherit;
opacity: 0.3;
}
.model, .none { display: none }
.hide {
@ -59,11 +59,10 @@ p + p {
transition: all 2s;
}
.full, .page {
.full {
width: 100%;
min-height: 100vh;
}
.max {
max-width: 48em;
}
@ -77,6 +76,25 @@ p + p {
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 {
float: right;
text-align: right;
@ -85,12 +103,6 @@ p + p {
float: left;
text-align: left;
}
.center {
text-align: center;
vertical-align: middle;
margin-left: auto;
margin-right: auto;
}
.mid {
margin-left: auto;
margin-right: auto;
@ -111,12 +123,6 @@ p + p {
.crack { margin-bottom: 1%; }
.sit { margin-bottom: 0; }
.row { width: 100%; }
.col {
max-width: 24em;
min-width: 12em;
}
.focus {
margin-left: auto;
margin-right: auto;

4
gun.js
View File

@ -347,7 +347,8 @@
++ni; kl = null; pop(o);
}());
} 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){
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];
@ -1188,6 +1189,7 @@
if(eve.stun){ return } if('' === one[id]){ return }
if(true === (tmp = Gun.valid(data))){ once(); return }
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.
function once(){
if(!at.has && !at.soul){ at = {put: data, get: key} } // handles non-core messages.

View File

@ -14,7 +14,7 @@ Gun.on('create', function(root){
try{AWS = require('aws-sdk');
}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;
}

View File

@ -1,6 +1,6 @@
{
"name": "gun",
"version": "0.2020.1234",
"version": "0.2020.1235",
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
"types": "index.d.ts",
"main": "index.js",
@ -62,7 +62,6 @@
},
"optionalDependencies": {
"@peculiar/webcrypto": "^1.1.1",
"text-encoding": "^0.7.0",
"emailjs": "^2.2.0"
},
"devDependencies": {

8
sea.js
View File

@ -47,7 +47,7 @@
var u;
if(u+''== typeof btoa){
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.atob = function(data){ return Buffer.from(data, "base64").toString("binary") };
@ -202,7 +202,7 @@
api.ossl = api.subtle = new WebCrypto({directory: 'ossl'}).subtle // ECDH
}
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
@ -1034,7 +1034,7 @@
if(SEA.window && ((gun.back('user')._).opt||opt).remember){
// TODO: this needs to be modular.
try{var sS = {};
sS = window.sessionStorage;
sS = window.sessionStorage; // TODO: FIX BUG putting on `.is`!
sS.recall = true;
sS.pair = JSON.stringify(pair); // auth using pair is more reliable than alias/pass
}catch(e){}
@ -1111,7 +1111,7 @@
if(SEA.window){
try{
var sS = {};
sS = window.sessionStorage;
sS = window.sessionStorage; // TODO: FIX BUG putting on `.is`!
if(sS){
(root._).opt.remember = true;
((gun.back('user')._).opt||opt).remember = true;

View File

@ -3900,6 +3900,38 @@ describe('Gun', function(){
},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){
this.timeout(9999999);
var gun = Gun(), c = 100000, big = "big";