need to fix opt more, but hopefully quick fix on axe reconfig that @SunriseFox pointed out

This commit is contained in:
Mark Nadal
2019-07-17 05:57:31 -07:00
parent 3277ba4127
commit 68ba4dcc65
3 changed files with 18 additions and 10 deletions

24
as.js
View File

@@ -209,13 +209,12 @@
;$(function(){
$('.page').not(':first').hide();
$.as.route(location.hash.slice(1));
var opt = window.CONFIG || {};
opt.peers = opt.peers || ($('body').attr('peers') || (function(){
(console.warn || console.log)('Warning: No peer provided, defaulting to DEMO peer. Do not run in production, or your data will be regularly wiped, reset, or deleted. For more info, check https://github.com/eraeco/joydb#peers !');
return 'https://gunjs.herokuapp.com/gun';
}())).replace(', ', ',').split(',');
$.as(document, window.gun = window.gun || Gun(opt), null, opt);
$(JOY.start = JOY.start || function(){ $.as(document, gun, null, opt) });
if($('body').attr('peers')){ (console.warn || console.log)('Warning: Please upgrade <body peers=""> to https://github.com/eraeco/joydb#peers !') }
});
;(function(){ // need to isolate into separate module!
var joy = window.JOY = function(){};
joy.auth = function(a,b,cb,o){
if(!o){ o = cb ; cb = 0 }
@@ -225,7 +224,16 @@
}
gun.user().auth(a,b, cb,o);
}
var opt = window.CONFIG || {}, peers;
$('link[type=peer]').each(function(){ (peers || (peers = [])).push($(this).attr('href')) });
!window.gun && (opt.peers = opt.peers || peers || (function(){
(console.warn || console.log)('Warning: No peer provided, defaulting to DEMO peer. Do not run in production, or your data will be regularly wiped, reset, or deleted. For more info, check https://github.com/eraeco/joydb#peers !');
return ['https://gunjs.herokuapp.com/gun'];
}()));
window.gun = window.gun || Gun(opt);
gun.on('auth', function(ack){
console.log("Your namespace is publicly available at", ack.soul);
})
});
});
}());

2
axe.js
View File

@@ -140,7 +140,7 @@
tmp = tmp.peers;
if(!tmp || !Gun.text.is(tmp)){ return }
if(axe.up[tmp] || 6 <= Object.keys(axe.up).length){ return }
var o = {peers: tmp};
var o = tmp; //{peers: tmp};
at.$.opt(o);
o = peers[tmp];
if(!o){ return }

View File

@@ -1,6 +1,6 @@
{
"name": "gun",
"version": "0.2019.711",
"version": "0.2019.712",
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
"main": "index.js",
"browser": "gun.js",