diff --git a/as.js b/as.js index 48b75ba2..14ce6d09 100644 --- a/as.js +++ b/as.js @@ -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 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); - }) -}); \ No newline at end of file + }); +}()); \ No newline at end of file diff --git a/axe.js b/axe.js index 4705b366..bb7a2008 100644 --- a/axe.js +++ b/axe.js @@ -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 } diff --git a/package.json b/package.json index b68c321c..89b5b399 100644 --- a/package.json +++ b/package.json @@ -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",