mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
8a36d0863a
@ -1,21 +1,21 @@
|
||||
;(function(){
|
||||
var cluster = require('cluster');
|
||||
if(cluster.isMaster){
|
||||
return cluster.fork() && cluster.on('exit', function(){ cluster.fork() });
|
||||
}
|
||||
|
||||
var fs = require('fs');
|
||||
var config = { port: process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765 };
|
||||
var Gun = require('../'); // require('gun')
|
||||
|
||||
if(process.env.HTTPS_KEY){
|
||||
config.key = fs.readFileSync(process.env.HTTPS_KEY);
|
||||
config.cert = fs.readFileSync(process.env.HTTPS_CERT);
|
||||
config.server = require('https').createServer(config, Gun.serve(__dirname));
|
||||
} else {
|
||||
config.server = require('http').createServer(Gun.serve(__dirname));
|
||||
}
|
||||
|
||||
var gun = Gun({web: config.server.listen(config.port) });
|
||||
console.log('Relay peer started on port ' + config.port + ' with /gun');
|
||||
}());
|
||||
;(function(){
|
||||
var cluster = require('cluster');
|
||||
if(cluster.isMaster){
|
||||
return cluster.fork() && cluster.on('exit', function(){ cluster.fork() });
|
||||
}
|
||||
|
||||
var fs = require('fs');
|
||||
var config = { port: process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765 };
|
||||
var Gun = require('../'); // require('gun')
|
||||
|
||||
if(process.env.HTTPS_KEY){
|
||||
config.key = fs.readFileSync(process.env.HTTPS_KEY);
|
||||
config.cert = fs.readFileSync(process.env.HTTPS_CERT);
|
||||
config.server = require('https').createServer(config, Gun.serve(__dirname));
|
||||
} else {
|
||||
config.server = require('http').createServer(Gun.serve(__dirname));
|
||||
}
|
||||
|
||||
var gun = Gun({web: config.server.listen(config.port)});
|
||||
console.log('Relay peer started on port ' + config.port + ' with /gun');
|
||||
}());
|
||||
|
17
examples/start.js.html
Normal file
17
examples/start.js.html
Normal file
@ -0,0 +1,17 @@
|
||||
/*<!DOCTYPE html>
|
||||
<html>
|
||||
<head></head>
|
||||
<body></body>
|
||||
<script>// */
|
||||
;(function(){try{
|
||||
if(typeof window == "undefined"){ return }
|
||||
var url = location.hash.slice(1);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function(e){
|
||||
if(4 != xhr.readyState){ return }
|
||||
document.write(xhr.responseText);
|
||||
};
|
||||
xhr.open('GET', url, true);
|
||||
xhr.send(null);
|
||||
}catch(e){document.write(''+e)}}());
|
||||
//</script></html>
|
@ -2,29 +2,25 @@ html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
font-size: 18pt;
|
||||
line-height: 1.5;
|
||||
font-size: 18pt;
|
||||
}
|
||||
|
||||
div, ul, ol, li, p, span, form, button, input, textarea {
|
||||
div, ul, ol, li, p, span, form, button, input, textarea, img {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
font-size: 1em;
|
||||
line-height: 1.5em;
|
||||
vertical-align: inherit;
|
||||
-webkit-transition: all 0.3s;
|
||||
transition: all 0.3s;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
button, input, textarea {
|
||||
background: white;
|
||||
border: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
a {
|
||||
color: white;
|
||||
a, button, input, textarea {
|
||||
background: inherit;
|
||||
border: inherit;
|
||||
color: inherit;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
@ -46,48 +42,75 @@ ul, li {
|
||||
transition: all 2s;
|
||||
}
|
||||
|
||||
.page {
|
||||
.full, .page {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.max {
|
||||
max-width: 48em;
|
||||
}
|
||||
.min {
|
||||
min-width: 12em;
|
||||
}
|
||||
.pad {
|
||||
margin: 5% auto;
|
||||
min-width: 250px;
|
||||
width: 95%;
|
||||
max-width: 50em;
|
||||
margin: 5% auto;
|
||||
max-width: 48em;
|
||||
min-width: 12em;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
.left {
|
||||
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;
|
||||
}
|
||||
.flush {
|
||||
line-height: 0em;
|
||||
}
|
||||
|
||||
.rim {
|
||||
margin: 2%;
|
||||
}
|
||||
.gap {
|
||||
padding: 3%;
|
||||
}
|
||||
.gully {
|
||||
margin-bottom: 1%;
|
||||
.top {
|
||||
vertical-align: top;
|
||||
}
|
||||
.low {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.rim { margin: 2%; }
|
||||
.gap { padding: 3%; }
|
||||
.stack { line-height: 0; }
|
||||
.crack { margin-bottom: 1%; }
|
||||
.sit { margin-bottom: 0; }
|
||||
|
||||
.row { width: 100%; }
|
||||
.col { max-width: 33em; }
|
||||
.col {
|
||||
max-width: 24em;
|
||||
min-width: 12em;
|
||||
}
|
||||
|
||||
.focus {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
float: none;
|
||||
clear: both;
|
||||
}
|
||||
.unit, .symbol {
|
||||
display: inline-block;
|
||||
vertical-align: inherit;
|
||||
}
|
||||
|
||||
.leak { overflow: visible; }
|
||||
.hold { overflow: hidden; }
|
||||
|
||||
.act {
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
@ -96,9 +119,9 @@ ul, li {
|
||||
transition: all 0.3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
.symbol {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.sap { border-radius: 0.1em; }
|
||||
.jot { border-bottom: 1px dashed #95B2CA; }
|
||||
|
||||
.loud {
|
||||
font-size: 150%;
|
||||
@ -107,66 +130,30 @@ ul, li {
|
||||
font-size: 36pt;
|
||||
font-size: 6.5vmax;
|
||||
}
|
||||
.jot {
|
||||
border-bottom: 1px dashed #95B2CA;
|
||||
}
|
||||
.sap {
|
||||
border-radius: 0.1em;
|
||||
}
|
||||
|
||||
|
||||
.red {
|
||||
background: #ea3224;
|
||||
}
|
||||
.green {
|
||||
background: #33cc33;
|
||||
}
|
||||
.blue {
|
||||
background: #4D79D8;
|
||||
}
|
||||
.yellow {
|
||||
background: #f2b919;
|
||||
}
|
||||
.black {
|
||||
background: black;
|
||||
}
|
||||
.white {
|
||||
background: white;
|
||||
}
|
||||
.red { background: #ea3224; }
|
||||
.green { background: #33cc33; }
|
||||
.blue { background: #4D79D8; }
|
||||
.yellow { background: #f2b919; }
|
||||
.black { background: black; }
|
||||
.white { background: white; }
|
||||
|
||||
.shade {
|
||||
background: rgba(0%, 0%, 0%, 0.1);
|
||||
}
|
||||
.tint {
|
||||
background: rgba(100%, 100%, 100%, 0.1);
|
||||
}
|
||||
.shade { background: rgba(0%, 0%, 0%, 0.1); }
|
||||
.tint { background: rgba(100%, 100%, 100%, 0.1); }
|
||||
|
||||
.redt {
|
||||
color: #ea3224;
|
||||
}
|
||||
.greent {
|
||||
color: #33cc33;
|
||||
}
|
||||
.bluet {
|
||||
color: #4D79D8;
|
||||
}
|
||||
.yellowt {
|
||||
color: #f2b919;
|
||||
}
|
||||
.blackt {
|
||||
color: black;
|
||||
}
|
||||
.whitet {
|
||||
color: white;
|
||||
}
|
||||
.redt { color: #ea3224; }
|
||||
.greent { color: #33cc33; }
|
||||
.bluet { color: #4D79D8; }
|
||||
.yellowt { color: #f2b919; }
|
||||
.blackt { color: black; }
|
||||
.whitet { color: white; }
|
||||
|
||||
.hue {
|
||||
background: #4D79D8;
|
||||
-webkit-animation: hue 900s infinite;
|
||||
animation: hue 900s infinite;
|
||||
}
|
||||
|
||||
@keyframes hue {
|
||||
} @keyframes hue {
|
||||
0% {background-color: #4D79D8;}
|
||||
25% {background-color: #33cc33;}
|
||||
50% {background-color: #f2b919;}
|
||||
@ -181,12 +168,10 @@ ul, li {
|
||||
}
|
||||
|
||||
.huet {
|
||||
color: #4D79D8;
|
||||
color: #4D79D8;
|
||||
-webkit-animation: huet 900s infinite;
|
||||
animation: huet 900s infinite;
|
||||
}
|
||||
|
||||
@keyframes huet {
|
||||
} @keyframes huet {
|
||||
0% {color: #4D79D8;}
|
||||
25% {color: #33cc33;}
|
||||
50% {color: #f2b919;}
|
||||
@ -204,9 +189,7 @@ ul, li {
|
||||
background: #ea3224;
|
||||
-webkit-animation: hue2 900s infinite;
|
||||
animation: hue2 900s infinite;
|
||||
}
|
||||
|
||||
@keyframes hue2 {
|
||||
} @keyframes hue2 {
|
||||
0% {background-color: #ea3224;}
|
||||
25% {background-color: #4D79D8;}
|
||||
50% {background-color: #33cc33;}
|
||||
@ -224,9 +207,7 @@ ul, li {
|
||||
color: #ea3224;
|
||||
-webkit-animation: huet2 900s infinite;
|
||||
animation: huet2 900s infinite;
|
||||
}
|
||||
|
||||
@keyframes huet2 {
|
||||
} @keyframes huet2 {
|
||||
0% {color: #ea3224;}
|
||||
25% {color: #4D79D8;}
|
||||
50% {color: #33cc33;}
|
||||
@ -244,9 +225,7 @@ ul, li {
|
||||
background: #33cc33;
|
||||
-webkit-animation: hue3 900s infinite;
|
||||
animation: hue3 900s infinite;
|
||||
}
|
||||
|
||||
@keyframes hue3 {
|
||||
} @keyframes hue3 {
|
||||
0% {background-color: #33cc33;}
|
||||
25% {background-color: #f2b919;}
|
||||
50% {background-color: #ea3224;}
|
||||
@ -264,9 +243,7 @@ ul, li {
|
||||
color: #33cc33;
|
||||
-webkit-animation: huet3 900s infinite;
|
||||
animation: huet3 900s infinite;
|
||||
}
|
||||
|
||||
@keyframes huet3 {
|
||||
} @keyframes huet3 {
|
||||
0% {color: #33cc33;}
|
||||
25% {color: #f2b919;}
|
||||
50% {color: #ea3224;}
|
||||
@ -284,9 +261,7 @@ ul, li {
|
||||
background: #f2b919;
|
||||
-webkit-animation: hue4 900s infinite;
|
||||
animation: hue4 900s infinite;
|
||||
}
|
||||
|
||||
@keyframes hue4 {
|
||||
} @keyframes hue4 {
|
||||
0% {background-color: #f2b919;}
|
||||
25% {background-color: #ea3224;}
|
||||
50% {background-color: #4D79D8;}
|
||||
@ -304,9 +279,7 @@ ul, li {
|
||||
color: #f2b919;
|
||||
-webkit-animation: huet4 900s infinite;
|
||||
animation: huet4 900s infinite;
|
||||
}
|
||||
|
||||
@keyframes huet4 {
|
||||
} @keyframes huet4 {
|
||||
0% {color: #f2b919;}
|
||||
25% {color: #ea3224;}
|
||||
50% {color: #4D79D8;}
|
||||
@ -322,16 +295,12 @@ ul, li {
|
||||
|
||||
.pulse {
|
||||
animation: pulse 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse
|
||||
{
|
||||
} @keyframes pulse {
|
||||
0% {opacity: 1;}
|
||||
50% {opacity: 0.5;}
|
||||
100% {opacity: 1;}
|
||||
}
|
||||
|
||||
|
||||
.joy {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
@ -341,12 +310,7 @@ ul, li {
|
||||
pointer-events: none;
|
||||
z-index: 999999999;
|
||||
animation: joy 1s steps(28);
|
||||
}
|
||||
@keyframes joy {
|
||||
0% {
|
||||
background-position: 0 0;
|
||||
}
|
||||
100% {
|
||||
background-position: -2800px 0;
|
||||
}
|
||||
} @keyframes joy {
|
||||
0% {background-position: 0 0;}
|
||||
100% {background-position: -2800px 0;}
|
||||
}
|
11
gun.js
11
gun.js
@ -1977,9 +1977,8 @@
|
||||
if(!raw){ return }
|
||||
var dup = ctx.dup, id, hash, msg, tmp = raw[0];
|
||||
if(opt.pack <= raw.length){ return mesh.say({dam: '!', err: "Message too big!"}, peer) }
|
||||
try{msg = JSON.parse(raw);
|
||||
}catch(e){opt.log('DAM JSON parse error', e)}
|
||||
if('{' === tmp){
|
||||
try{msg = JSON.parse(raw);}catch(e){opt.log('DAM JSON parse error', e)}
|
||||
if(!msg){ return }
|
||||
if(dup.check(id = msg['#'])){ return }
|
||||
dup.track(id, true).it = msg; // GUN core also dedups, so `true` is needed.
|
||||
@ -2005,6 +2004,7 @@
|
||||
return;
|
||||
} else
|
||||
if('[' === tmp){
|
||||
try{msg = JSON.parse(raw);}catch(e){opt.log('DAM JSON parse error', e)}
|
||||
if(!msg){ return }
|
||||
var i = 0, m;
|
||||
while(m = msg[i++]){
|
||||
@ -2064,11 +2064,12 @@
|
||||
function send(raw, peer){
|
||||
var wire = peer.wire;
|
||||
try{
|
||||
if(wire.send){
|
||||
wire.send(raw);
|
||||
} else
|
||||
if(peer.say){
|
||||
peer.say(raw);
|
||||
} else
|
||||
if(wire.send){
|
||||
if(wire.readyState && 1 != wire.readyState){ throw "socket not ready yet!" }
|
||||
wire.send(raw);
|
||||
}
|
||||
}catch(e){
|
||||
(peer.queue = peer.queue || []).push(raw);
|
||||
|
5
lib/hub.js
Normal file
5
lib/hub.js
Normal file
@ -0,0 +1,5 @@
|
||||
var fs = require('fs');
|
||||
|
||||
fs.watch('.', {persistent: false, recursive: true}, function(eve, name){
|
||||
console.log("changed!", eve, name);
|
||||
})
|
46
lib/ipfs.js
Normal file
46
lib/ipfs.js
Normal file
@ -0,0 +1,46 @@
|
||||
console.log("IPFS PLUGIN NOT OFFICIALLY MAINTAINED! PROBABLY WON'T WORK! USE AT YOUR OWN RISK! PLEASE CONTRIBUTE FIXES!");
|
||||
var opt = gun._.opt, u;
|
||||
if (u === opt.ipfs.directory) {
|
||||
opt.ipfs.directory = '/gun';
|
||||
}
|
||||
opt.store = {};
|
||||
opt.store.put = function(file, data, cb){
|
||||
var uri = opt.ipfs.directory + '/' + file;
|
||||
opt.ipfs.instance.files.write(uri, Buffer.from(JSON.stringify(data)), {create:true})
|
||||
.then(res => {
|
||||
console.log('File written to IPFS directory', uri, res);
|
||||
return opt.ipfs.instance.files.stat(opt.ipfs.directory, {hash:true});
|
||||
}).then(res => {
|
||||
console.log('Directory hash:', res.hash);
|
||||
return opt.ipfs.instance.name.publish(res.hash);
|
||||
// currently throws "This command must be run in online mode. Try running 'ipfs daemon' first." for some reason, maybe js-ipfs IPNS not ready yet
|
||||
}).then(res => {
|
||||
console.log('IPFS put request successful:', res);
|
||||
cb(undefined, 1);
|
||||
}).catch(error => {
|
||||
console.error('IPFS put request failed', error);
|
||||
});
|
||||
}
|
||||
opt.store.get = function(file, cb){
|
||||
var uri = opt.ipfs.directory + '/' + file;
|
||||
opt.ipfs.instance.files.read(uri, {})
|
||||
.then(res => {
|
||||
var data = JSON.parse(res.toString());
|
||||
console.log(uri + ' was loaded from ipfs:', data);
|
||||
cb(data);
|
||||
});
|
||||
}
|
||||
opt.store.list = function(cb){
|
||||
var stream = opt.ipfs.files.lsReadableStream(opt.ipfs.directory);
|
||||
|
||||
stream.on('data', (file) => {
|
||||
console.log('ls', file.name);
|
||||
if (cb(file.name)) {
|
||||
stream.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
stream.on('finish', () => {
|
||||
cb();
|
||||
});
|
||||
}
|
426
lib/meta.js
426
lib/meta.js
@ -1,63 +1,72 @@
|
||||
$(function(){
|
||||
var m = window.meta = {edit:[]}, u;
|
||||
var noop = function(){}, u;
|
||||
var m = window.meta = {edit:[]};
|
||||
var k = m.key = {};
|
||||
k.meta = {17:1, 91:1, 93:1, 224:1};
|
||||
k.meta = {17:17, 91:17, 93:17, 224:17};
|
||||
k.down = function(eve){
|
||||
if($(eve.target).is('input') || eve.repeat){ return }
|
||||
(k.eve = m.eve = eve).which = eve.which || eve.fake || eve.keyCode;
|
||||
if(!eve.fake && eve.which === k.last){ return }
|
||||
if(k.meta[(k.last = eve.which)]){ k.down.meta = m.flip(k.wipe()) || true }
|
||||
if(m.flip.is()){
|
||||
(k.combo || (k.combo = [])).push(eve.which);
|
||||
m.check('on', eve.which, k.at || (k.at = m.edit));
|
||||
if(eve.repeat){ return }
|
||||
var key = (k.eve = m.eve = eve).which = eve.which || eve.fake || eve.keyCode;
|
||||
if(!eve.fake && key === k.last){ return } k.last = key;
|
||||
if(!eve.fake && $(eve.target).closest('input, textarea, [contenteditable=true]').length){
|
||||
if(k.meta[key]){ k.down.meta = key = -1 }
|
||||
if(!k.down.meta){ return }
|
||||
}
|
||||
(k.combo || (k.combo = [])).push(key);
|
||||
m.check('on', key, k.at || (k.at = m.edit));
|
||||
if(k.meta[key]){
|
||||
m.list(k.at.back || m.edit);
|
||||
if(k.at && !k.at.back){ m.flip() }
|
||||
}
|
||||
if(eve.metaKey && (!k.meta[eve.which])){ k.up(eve) } // on some systems, meta hijacks keyup
|
||||
}
|
||||
k.up = function(eve){ var tmp;
|
||||
if($(eve.target).is('input')){ return }
|
||||
k.eve = m.eve = eve;
|
||||
k.last = null;
|
||||
eve.which = eve.which || eve.fake || eve.keyCode;
|
||||
if(m.flip.is()){ m.check('up', eve.which) }
|
||||
if(tmp = (k.meta[eve.which])){ k.down.meta = false }
|
||||
if(tmp && k.at === m.edit){ k.wipe() }
|
||||
if(27 === eve.which){ return m.flip(false) }
|
||||
}
|
||||
m.flip = function(tmp, aid){
|
||||
if(aid){
|
||||
m.flip.aid = true;
|
||||
setTimeout(function(){$(document).one('click',function(eve){m.flip(m.flip.aid = false)})},250); // ugly but important for visual aid.
|
||||
var key = (k.eve = m.eve = eve).which = eve.which || eve.fake || eve.keyCode;
|
||||
if(!eve.fake && $(eve.target).closest('input, textarea, [contenteditable=true]').length){
|
||||
if(k.meta[key]){
|
||||
k.down.meta = null;
|
||||
key = -1;
|
||||
} else
|
||||
if(!k.down.meta){ return }
|
||||
}
|
||||
k.last = null;
|
||||
if($(':focus').closest('#meta').length){ return }
|
||||
m.check('up', key);
|
||||
if(-1 === key || 27 === eve.which){ k.wipe() }
|
||||
}
|
||||
m.flip = function(tmp){
|
||||
var board = $('#meta .meta-menu');
|
||||
((tmp === false) || (!tmp && board.is(':visible')))?
|
||||
board.addClass('meta-none')
|
||||
: board.removeClass('meta-none');
|
||||
}
|
||||
m.flip.is = function(){
|
||||
if(m.flip.aid && ((m.eve||{}).fake || k.at !== m.edit)){ m.flip.aid = false }
|
||||
return !m.flip.aid && $('#meta .meta-menu').is(':visible');
|
||||
return $('#meta .meta-menu').is(':visible');
|
||||
}
|
||||
m.flip.wait = 500;
|
||||
m.check = function(how, key, at){
|
||||
at = k.at || m.edit;
|
||||
//m.list(at);
|
||||
var edit = at[key], tmp;
|
||||
var edit = at[key];
|
||||
if(!edit){ return }
|
||||
if(k.eve && k.eve.preventDefault){ k.eve.preventDefault() }
|
||||
var tmp = k.eve || noop;
|
||||
if(tmp.preventDefault){ tmp.preventDefault() }
|
||||
if(edit[how]){
|
||||
edit[how](m.eve);
|
||||
if(k.at !== m.edit && 'up' === how){
|
||||
if(k.down.meta){ m.list(k.at = m.edit) }
|
||||
else { k.wipe() }
|
||||
if(tmp.fake && !edit.fake){
|
||||
m.tap.edit = edit;
|
||||
} else {
|
||||
edit[how](m.eve);
|
||||
/*if(k.at !== m.edit && 'up' === how){
|
||||
if(k.down.meta){ m.list(k.at = m.edit) }
|
||||
else { k.wipe() }
|
||||
}*/
|
||||
}
|
||||
}
|
||||
if('up' != how){ return }
|
||||
edit.back = at;
|
||||
m.list(edit, at);
|
||||
if(at != edit){ edit.back = at }
|
||||
m.list(edit, true);
|
||||
}
|
||||
m.list = function(at){
|
||||
m.list = function(at, opt){
|
||||
if(!at){ return m.flip(false) }
|
||||
var l = [];
|
||||
$.each(at, function(i,k){ 'back' != i && k.combo && l.push(k) });
|
||||
$.each(at, function(i,k){ 'back' != i && k.combo && k.name && l.push(k) });
|
||||
if(!l.length){ return }
|
||||
k.at = at;
|
||||
l = l.sort(function(a,b){
|
||||
@ -72,8 +81,10 @@ $(function(){
|
||||
$.each(l, function(i, k){
|
||||
$ul.append($('<li>').text(k.name));
|
||||
});
|
||||
if(!at.back){ return }
|
||||
$ul.append($('<li>').html('←').one('click', function(){ m.list(k.at = at.back) }));
|
||||
if(opt){ m.flip(true) }
|
||||
$ul.append($('<li>').html('←').one('click', function(){
|
||||
m.list(k.at = at.back);
|
||||
}));
|
||||
}
|
||||
m.ask = function(help, cb){
|
||||
var $ul = $('#meta .meta-menu ul').empty();
|
||||
@ -86,34 +97,33 @@ $(function(){
|
||||
});
|
||||
var $li = $('<li>').append($form);
|
||||
$ul.append($li);
|
||||
m.flip(true);
|
||||
$put.focus();
|
||||
}
|
||||
k.wipe = function(){
|
||||
k.wipe = function(opt){
|
||||
k.down.meta = false;
|
||||
k.combo = [];
|
||||
m.flip(false);
|
||||
m.flip.aid = false;
|
||||
if(!opt){ m.flip(false) }
|
||||
m.list(k.at = m.edit);
|
||||
};
|
||||
$(document).on('keydown', k.down).on('keyup', k.up);
|
||||
m.tap = {};
|
||||
m.tap.select = function(eve){
|
||||
m.tap.range = null;
|
||||
if(!(m.tap.text()||'').trim()){
|
||||
if(m.tap.was){
|
||||
m.tap.was = null;
|
||||
m.flip(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
m.flip(m.tap.range = monotype((eve||{}).target), m.tap.was = true);
|
||||
}
|
||||
m.tap.text = function(tmp){
|
||||
return ((tmp = window.getSelection) && tmp().toString()) ||
|
||||
((tmp = document.selection) && tmp.createRange().text) || '';
|
||||
m.tap = function(){
|
||||
var on = $('.meta-on')
|
||||
.or($($(document.querySelectorAll(':hover')).get().reverse()).first())
|
||||
.or($(document.elementFromPoint(meta.tap.x, meta.tap.y)));
|
||||
return on;
|
||||
}
|
||||
$(window).on('blur', k.wipe).on('focus', k.wipe);
|
||||
$(document).on('select contextmenu keyup mouseup', '[contenteditable=true]', m.tap.select);
|
||||
//.on('keydown', '[contenteditable=true]', function(e){});
|
||||
$(document).on('mousedown mousemove mouseup', function(eve){
|
||||
m.tap.eve = eve;
|
||||
m.tap.x = eve.pageX||0;
|
||||
m.tap.y = eve.pageY||0;
|
||||
m.tap.on = $(eve.target);
|
||||
}).on('mousedown touchstart', function(eve){
|
||||
var tmp = m.tap.edit;
|
||||
if(!tmp || !tmp.on){ return }
|
||||
tmp.on(eve);
|
||||
m.tap.edit = null;
|
||||
});
|
||||
$(document).on('touchstart', '#meta .meta-start', function(eve){ m.tap.stun = true });
|
||||
$(document).on('click', '#meta .meta-menu li', function(eve){
|
||||
if(m.tap.stun){ return m.tap.stun = false }
|
||||
@ -122,10 +132,11 @@ $(function(){
|
||||
k.down(eve);
|
||||
k.up(eve);
|
||||
});
|
||||
$(document).on('keydown', k.down).on('keyup', k.up);
|
||||
meta.edit = function(edit){
|
||||
var tmp = edit.combow = [];
|
||||
$.each(edit.combo || (edit.combo = []), function(i,k){
|
||||
if(!k || !k.length){ return }
|
||||
if(!k || !k.length){ if('number' == typeof k){ tmp.push(k) } return }
|
||||
tmp.push(k.toUpperCase().charCodeAt(0));
|
||||
});
|
||||
var at = meta.edit, l = edit.combo.length;
|
||||
@ -133,37 +144,7 @@ $(function(){
|
||||
edit.combow = edit.combow.join(',');
|
||||
m.list(meta.edit);
|
||||
}
|
||||
meta.text = {zws: '​'};
|
||||
meta.text.editor = function(opt, as){ var tmp;
|
||||
if(!opt){ return }
|
||||
opt = (typeof opt == 'string')? {edit: opt} : opt.tag? opt : {tag: opt};
|
||||
var r = opt.range = opt.range || m.tap.range || monotype(), cmd = opt.edit;
|
||||
as = opt.as = opt.as || as;
|
||||
if(cmd && document.execCommand){
|
||||
r.restore();
|
||||
if(document.execCommand(cmd, null, as||null)){ return }
|
||||
}
|
||||
if(!opt.tag){ return }
|
||||
opt.tag = $(opt.tag);
|
||||
opt.name = opt.name || opt.tag.prop('tagName');
|
||||
if((tmp = $(r.get()).closest(opt.name)).length){
|
||||
if(r.s === r.e){
|
||||
tmp.after(meta.text.zws);
|
||||
r = r.select(monotype.next(tmp[0]),1);
|
||||
} else {
|
||||
tmp.contents().unwrap(opt.name);
|
||||
}
|
||||
} else
|
||||
if(r.s === r.e){
|
||||
r.insert(opt.tag);
|
||||
r = r.select(opt.tag);
|
||||
} else {
|
||||
r.wrap(opt.tag);
|
||||
}
|
||||
r.restore();
|
||||
opt.range = null;
|
||||
if(m.tap.range){ m.tap.range = monotype() }
|
||||
}
|
||||
$.fn.or = function(s){ return this.length ? this : $(s||'body') };
|
||||
;(function(){try{
|
||||
/* UI */
|
||||
if(meta.css){ return }
|
||||
@ -189,10 +170,12 @@ $(function(){
|
||||
width: '2em',
|
||||
height: '2em',
|
||||
opacity: 0.7,
|
||||
outline: 'none',
|
||||
color: '#000044',
|
||||
overflow: 'visible',
|
||||
transition: 'all 0.2s ease-in'
|
||||
},
|
||||
'#meta *': {outline: 'none'},
|
||||
'#meta .meta-none': {display: 'none'},
|
||||
'#meta span': {'line-height': '2em'},
|
||||
'#meta .meta-menu': {
|
||||
@ -253,130 +236,147 @@ $(function(){
|
||||
}
|
||||
}catch(e){}}());
|
||||
;(function(){
|
||||
// on fires when shortcut keydowns or on touch after command selected and then touchdown
|
||||
meta.edit({
|
||||
name: "Bold",
|
||||
combo: ['B'],
|
||||
on: function(e){
|
||||
meta.text.editor('bold');
|
||||
},
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "Italic",
|
||||
combo: ['I'],
|
||||
on: function(e){
|
||||
meta.text.editor('italic');
|
||||
},
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "Underline",
|
||||
combo: ['U'],
|
||||
on: function(e){
|
||||
meta.text.editor('underline');
|
||||
},
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "linK",
|
||||
combo: ['K'],
|
||||
up: function(e){
|
||||
var range = meta.tap.range || monotype();
|
||||
meta.ask('Paste or type link...', function(url){
|
||||
meta.text.editor({tag: $('<a href="'+url+'">link</a>'), edit: url? 'createLink' : 'unlink', as: url, range: range});
|
||||
})
|
||||
},
|
||||
on: function(){}
|
||||
});
|
||||
meta.edit({name: "aliGn", combo: ['G']});
|
||||
meta.edit({
|
||||
name: "Left",
|
||||
combo: ['G','L'],
|
||||
on: function(e){ meta.text.editor('justifyLeft') },
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "Right",
|
||||
combo: ['G','R'],
|
||||
on: function(e){ meta.text.editor('justifyRight') },
|
||||
up: function(){ }
|
||||
});
|
||||
meta.edit({
|
||||
name: "Middle",
|
||||
combo: ['G','M'],
|
||||
on: function(e){ meta.text.editor('justifyCenter') },
|
||||
up: function(){ }
|
||||
});
|
||||
meta.edit({
|
||||
name: "Justify",
|
||||
combo: ['G','J'],
|
||||
on: function(e){ meta.text.editor('justifyFull') },
|
||||
up: function(){}
|
||||
});
|
||||
// Align Number
|
||||
// Align Points
|
||||
// Align Strike
|
||||
meta.edit({name: "Size", combo: ['S']});
|
||||
meta.edit({
|
||||
name: "Small",
|
||||
combo: ['S','S'],
|
||||
on: function(e){ meta.text.editor('fontSize', 2) },
|
||||
up: function(){ }
|
||||
});
|
||||
meta.edit({
|
||||
name: "Normal",
|
||||
combo: ['S','N'],
|
||||
on: function(e){ meta.text.editor('fontSize', 5) },
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "Header",
|
||||
combo: ['S','H'],
|
||||
on: function(e){ meta.text.editor('fontSize', 6) },
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "Title",
|
||||
combo: ['S','T'],
|
||||
on: function(e){ meta.text.editor('fontSize', 7) },
|
||||
up: function(){}
|
||||
});
|
||||
// Size Spacing
|
||||
// Size Super
|
||||
// Size Sub
|
||||
/*
|
||||
meta.edit({name: "Edit", combo: ['E']});
|
||||
meta.edit({name: "Add", combo: ['E','A'],
|
||||
on: function(e){
|
||||
console.log(111);
|
||||
var r = m.tap.range || monotype();
|
||||
r.insert($('<div>hi</div>'));
|
||||
// include basic text editing by default.
|
||||
var monotype = window.monotype || function(){console.log("monotype needed")};
|
||||
var m = meta;
|
||||
m.text = {zws: '​'};
|
||||
m.text.on = function(eve){ var tmp;
|
||||
if($((eve||{}).target).closest('#meta').length){ return }
|
||||
m.text.range = null;
|
||||
if(!(m.text.copy()||'').trim()){
|
||||
m.flip(false);
|
||||
m.list(m.text.it);
|
||||
return;
|
||||
}
|
||||
m.text.range = monotype((eve||{}).target);
|
||||
m.text.it.on(eve);
|
||||
}
|
||||
});
|
||||
meta.edit({name: "Color", combo: ['E','C'],
|
||||
on: function(e){
|
||||
console.log(111);
|
||||
var r = m.tap.range || monotype();
|
||||
meta.ask('Color name or code?', function(color){
|
||||
r.get().closest('div').css({background: color});
|
||||
});
|
||||
m.text.copy = function(tmp){
|
||||
return ((tmp = window.getSelection) && tmp().toString()) ||
|
||||
((tmp = document.selection) && tmp.createRange().text) || '';
|
||||
}
|
||||
});
|
||||
meta.edit({name: "Width", combo: ['E','W'],
|
||||
on: function(e){
|
||||
var r = m.tap.range || monotype(), s = e.pageX||0, on = r.get().closest('div'), was = on.width();
|
||||
console.log(1);
|
||||
$(document).on('mousemove.tmp', function(eve){
|
||||
var w = was + ((eve.pageX||0) - was);
|
||||
console.log(w);
|
||||
on.css({width: w});
|
||||
})
|
||||
}, up: function(){
|
||||
console.log(0);
|
||||
$(document).off('mousemove.tmp');
|
||||
$(document).on('select contextmenu keyup mouseup', '[contenteditable=true]', m.text.on);
|
||||
m.text.editor = function(opt, as){ var tmp;
|
||||
if(!opt){ return }
|
||||
opt = (typeof opt == 'string')? {edit: opt} : opt.tag? opt : {tag: opt};
|
||||
var r = opt.range = opt.range || m.text.range || monotype(), cmd = opt.edit;
|
||||
as = opt.as = opt.as || as;
|
||||
if(cmd && document.execCommand){
|
||||
r.restore();
|
||||
if(document.execCommand(cmd, null, as||null)){
|
||||
if(m.text.range){ m.text.range = monotype() }
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!opt.tag){ return }
|
||||
opt.tag = $(opt.tag);
|
||||
opt.name = opt.name || opt.tag.prop('tagName');
|
||||
if((tmp = $(r.get()).closest(opt.name)).length){
|
||||
if(r.s === r.e){
|
||||
tmp.after(m.text.zws);
|
||||
r = r.select(monotype.next(tmp[0]),1);
|
||||
} else {
|
||||
tmp.contents().unwrap(opt.name);
|
||||
}
|
||||
} else
|
||||
if(r.s === r.e){
|
||||
r.insert(opt.tag);
|
||||
r = r.select(opt.tag);
|
||||
} else {
|
||||
r.wrap(opt.tag);
|
||||
}
|
||||
r.restore();
|
||||
opt.range = null;
|
||||
if(m.text.range){ m.text.range = monotype() }
|
||||
}
|
||||
});
|
||||
*/
|
||||
meta.edit(meta.text.it = {combo: [-1], on: function(){ m.list(this, true) }, back: meta.edit}); // -1 is key for typing.
|
||||
meta.text.it[-1] = meta.text.it;
|
||||
meta.edit({
|
||||
name: "Bold",
|
||||
combo: [-1,'B'], fake: -1,
|
||||
on: function(eve){
|
||||
meta.text.editor('bold');
|
||||
},
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "Italic",
|
||||
combo: [-1,'I'], fake: -1,
|
||||
on: function(eve){
|
||||
meta.text.editor('italic');
|
||||
},
|
||||
up: function(){}
|
||||
});
|
||||
/*meta.edit({
|
||||
name: "Underline",
|
||||
combo: [-1,'U'], fake: -1,
|
||||
on: function(eve){
|
||||
meta.text.editor('underline');
|
||||
},
|
||||
up: function(){}
|
||||
});*/
|
||||
meta.edit({
|
||||
name: "linK",
|
||||
combo: [-1,'K'], fake: -1,
|
||||
on: function(eve){
|
||||
var range = meta.text.range || monotype();
|
||||
meta.ask('Paste or type link...', function(url){
|
||||
meta.text.editor({tag: $('<a href="'+url+'">link</a>'), edit: url? 'createLink' : 'unlink', as: url, range: range});
|
||||
})
|
||||
}
|
||||
});
|
||||
//meta.edit({name: "aliGn", combo: [-1,'G']}); // MOVE TO ADVANCED MENu!
|
||||
meta.edit({
|
||||
name: "Left",
|
||||
combo: [-1,'G','L'], fake: -1,
|
||||
on: function(eve){ meta.text.editor('justifyLeft') },
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "Right",
|
||||
combo: [-1,'G','R'], fake: -1,
|
||||
on: function(eve){ meta.text.editor('justifyRight') },
|
||||
up: function(){ }
|
||||
});
|
||||
meta.edit({
|
||||
name: "Middle",
|
||||
combo: [-1,'G','M'], fake: -1,
|
||||
on: function(eve){ meta.text.editor('justifyCenter') },
|
||||
up: function(){ }
|
||||
});
|
||||
meta.edit({
|
||||
name: "Justify",
|
||||
combo: [-1,'G','J'], fake: -1,
|
||||
on: function(eve){ meta.text.editor('justifyFull') },
|
||||
up: function(){}
|
||||
});
|
||||
// Align Number
|
||||
// Align Points
|
||||
// Align Strike
|
||||
meta.edit({name: "Size", combo: [-1,'S'], on: function(){ m.list(this, true) }});
|
||||
meta.edit({
|
||||
name: "Small",
|
||||
combo: [-1,'S','S'], fake: -1,
|
||||
on: function(eve){ meta.text.editor('fontSize', 2) },
|
||||
up: function(){ }
|
||||
});
|
||||
meta.edit({
|
||||
name: "Normal",
|
||||
combo: [-1,'S','N'], fake: -1,
|
||||
on: function(eve){ meta.text.editor('fontSize', 5) },
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "Header",
|
||||
combo: [-1,'S','H'], fake: -1,
|
||||
on: function(eve){ meta.text.editor('fontSize', 6) },
|
||||
up: function(){}
|
||||
});
|
||||
meta.edit({
|
||||
name: "Title",
|
||||
combo: [-1,'S','T'], fake: -1,
|
||||
on: function(eve){ meta.text.editor('fontSize', 7) },
|
||||
up: function(){}
|
||||
});
|
||||
}());
|
||||
});
|
63
lib/multicast.js
Normal file
63
lib/multicast.js
Normal file
@ -0,0 +1,63 @@
|
||||
var Gun = (typeof window !== "undefined")? window.Gun : require('../gun');
|
||||
|
||||
Gun.on('create', function(root){
|
||||
this.to.next(root);
|
||||
var opt = root.opt;
|
||||
if(false === opt.multicast){ return }
|
||||
|
||||
var udp = opt.multicast = opt.multicast || {};
|
||||
udp.address = udp.address || '233.255.255.255';
|
||||
udp.pack = udp.pack || 50000; // UDP messages limited to 65KB.
|
||||
udp.port = udp.port || 23456;
|
||||
|
||||
var noop = function(){}, port;
|
||||
|
||||
var dgram = require("dgram");
|
||||
var socket = dgram.createSocket({type: "udp4", reuseAddr: true});
|
||||
socket.bind(udp.port);
|
||||
|
||||
socket.on("listening", function() {
|
||||
socket.addMembership(udp.address);
|
||||
udp.peer = {url: udp.address + ':' + udp.port, wire: socket};
|
||||
|
||||
udp.peer.say = function(raw){
|
||||
var buf = Buffer.from(raw, 'utf8');
|
||||
if(udp.pack <= buf.length){ // message too big!!!
|
||||
return;
|
||||
}
|
||||
socket.send(buf, 0, buf.length, udp.port, udp.address, noop);
|
||||
}
|
||||
opt.mesh.hi(udp.peer);
|
||||
|
||||
console.log('multicasting on', udp.peer.url);
|
||||
return; // below code only needed for when WebSocket connections desired!
|
||||
setInterval(function broadcast(){
|
||||
port = port || (opt.web && opt.web.address()||{}).port;
|
||||
if(!port){ return }
|
||||
udp.peer.say(JSON.stringify({id: opt.pid || (opt.pid = Math.random().toString(36).slice(2)), port: port}));
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
socket.on("message", function(raw, info) { try {
|
||||
if(!raw){ return }
|
||||
raw = raw.toString('utf8');
|
||||
opt.mesh.hear(raw, udp.peer);
|
||||
|
||||
return; // below code only needed for when WebSocket connections desired!
|
||||
var message;
|
||||
message = JSON.parse(raw.toString('utf8'));
|
||||
|
||||
if(opt.pid === message.id){ return } // ignore self
|
||||
|
||||
var url = 'http://' + info.address + ':' + (port || (opt.web && opt.web.address()||{}).port) + '/gun';
|
||||
if(root.opt.peers[url]){ return }
|
||||
|
||||
console.log('discovered', url, message, info);
|
||||
root.$.opt(url);
|
||||
|
||||
} catch(e){
|
||||
console.log('multicast error', e, raw);
|
||||
return;
|
||||
} });
|
||||
|
||||
});
|
@ -1,8 +1,11 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var dot = /\.\.+/g;
|
||||
var slash = /\/\/+/g;
|
||||
|
||||
function CDN(dir){
|
||||
return function(req, res){
|
||||
req.url = (req.url||'').replace(dot,'').replace(slash,'/');
|
||||
if(serve(req, res)){ return } // filters GUN requests!
|
||||
fs.createReadStream(path.join(dir, req.url)).on('error',function(tmp){ // static files!
|
||||
try{ tmp = fs.readFileSync(path.join(dir, 'index.html')) }catch(e){}
|
||||
|
@ -16,6 +16,7 @@
|
||||
//try{require('../axe');}catch(e){}
|
||||
require('./file');
|
||||
require('./evict');
|
||||
require('./multicast');
|
||||
if('debug' === process.env.GUN_ENV){ require('./debug') }
|
||||
module.exports = Gun;
|
||||
}());
|
||||
}());
|
||||
|
10
lib/store.js
10
lib/store.js
@ -35,21 +35,21 @@ Gun.on('create', function(root){
|
||||
|
||||
root.on('get', function(msg){
|
||||
this.to.next(msg);
|
||||
var id = msg['#'], get = msg.get, soul = msg.get['#'], has = msg.get['.']||'', opt = {}, graph, lex, key, tmp;
|
||||
var id = msg['#'], get = msg.get, soul = msg.get['#'], has = msg.get['.']||'', opt = {}, graph, lex, key, tmp, force;
|
||||
if(typeof soul == 'string'){
|
||||
key = soul;
|
||||
} else
|
||||
if(soul){
|
||||
if(tmp = soul['*']){ opt.limit = 1 }
|
||||
key = tmp || soul['='];
|
||||
if(u !== (tmp = soul['*'])){ opt.limit = force = 1 }
|
||||
key = force? (''+tmp) : tmp || soul['='];
|
||||
}
|
||||
if(key && !opt.limit){ // a soul.has must be on a soul, and not during soul*
|
||||
if(typeof has == 'string'){
|
||||
key = key+esc+(opt.atom = has);
|
||||
} else
|
||||
if(has){
|
||||
if(tmp = has['*']){ opt.limit = 1 }
|
||||
if(key){ key = key+esc + (tmp || (opt.atom = has['='])) }
|
||||
if(u !== (tmp = has['*'])){ opt.limit = force = 1 }
|
||||
if(key){ key = key+esc + (force? (''+tmp) : tmp || (opt.atom = has['='])) }
|
||||
}
|
||||
}
|
||||
if((tmp = get['%']) || opt.limit){
|
||||
|
24
package-lock.json
generated
24
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.9.9999991",
|
||||
"version": "0.2019.416",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -724,9 +724,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz",
|
||||
"integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==",
|
||||
"version": "2.13.2",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz",
|
||||
"integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==",
|
||||
"optional": true
|
||||
},
|
||||
"negotiator": {
|
||||
@ -736,15 +736,15 @@
|
||||
"dev": true
|
||||
},
|
||||
"node-webcrypto-ossl": {
|
||||
"version": "1.0.39",
|
||||
"resolved": "https://registry.npmjs.org/node-webcrypto-ossl/-/node-webcrypto-ossl-1.0.39.tgz",
|
||||
"integrity": "sha512-cEq67y6GJ5jcKdANi5XqejqMvM/eIGxuOOE8F+c0XS950jSpvOcjUNHLmIe3/dN/UKyUkb+dri0BU4OgmCJd2g==",
|
||||
"version": "1.0.43",
|
||||
"resolved": "https://registry.npmjs.org/node-webcrypto-ossl/-/node-webcrypto-ossl-1.0.43.tgz",
|
||||
"integrity": "sha512-AavMGbUB2MaTzli0+swjSAr4aLqf9M5jHIrs5VP9EUDXyEaIOyyio3H1z3pZCxKpaDD9coKWD3bWAiaIBuN8wg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"mkdirp": "^0.5.1",
|
||||
"nan": "^2.11.1",
|
||||
"nan": "^2.12.1",
|
||||
"tslib": "^1.9.3",
|
||||
"webcrypto-core": "^0.1.25"
|
||||
"webcrypto-core": "^0.1.26"
|
||||
}
|
||||
},
|
||||
"object-assign": {
|
||||
@ -1246,9 +1246,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"ws": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.0.tgz",
|
||||
"integrity": "sha512-c18dMeW+PEQdDFzkhDsnBAlS4Z8KGStBQQUcQ5mf7Nf689jyGk0594L+i9RaQuf4gog6SvWLJorz2NfSaqxZ7w==",
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.2019.331",
|
||||
"version": "0.2019.416",
|
||||
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
|
||||
"main": "index.js",
|
||||
"browser": "gun.js",
|
||||
@ -51,11 +51,11 @@
|
||||
"node": ">=0.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"ws": "~>5.2.0"
|
||||
"ws": "~>6.2.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"text-encoding": "^0.7.0",
|
||||
"node-webcrypto-ossl": "^1.0.39"
|
||||
"node-webcrypto-ossl": "^1.0.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"aws-sdk": ">=2.153.0",
|
||||
|
@ -48,7 +48,7 @@ Gun.chain.put = function(data, cb, as){
|
||||
}
|
||||
if(Gun.is(data)){
|
||||
data.get(function(soul, o, msg){
|
||||
if(!soul && Gun.val.is(msg.put)){
|
||||
if(!soul){
|
||||
return Gun.log("The reference you are saving is a", typeof msg.put, '"'+ msg.put +'", not a node (object)!');
|
||||
}
|
||||
gun.put(Gun.val.link.ify(soul), cb, as);
|
||||
|
@ -16,8 +16,8 @@
|
||||
</ul>
|
||||
<div id='debug'></div>
|
||||
<script>
|
||||
try{localStorage.clear()}catch(e){};
|
||||
indexedDB.deleteDatabase('radata');
|
||||
//try{localStorage.clear()}catch(e){};
|
||||
//indexedDB.deleteDatabase('radata');
|
||||
//var gun = Gun('http://localhost:8765/gun');
|
||||
var gun = Gun({localStorage: false});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user