1ac87c7e by Jabis Sevón

gunshit

1 parent 3306413d
...@@ -1413,7 +1413,7 @@ ...@@ -1413,7 +1413,7 @@
1413 if(cat.jam){ return cat.jam.push([cb, as]) } 1413 if(cat.jam){ return cat.jam.push([cb, as]) }
1414 cat.jam = [[cb,as]]; 1414 cat.jam = [[cb,as]];
1415 gun.get(function go(msg, eve){ 1415 gun.get(function go(msg, eve){
1416 if(u === msg.put && (tmp = Object.keys(cat.root.opt.peers).length) && ++acks <= tmp){ 1416 if(u === msg.put && !cat.root.opt.super && (tmp = Object.keys(cat.root.opt.peers).length) && ++acks <= tmp){
1417 return; 1417 return;
1418 } 1418 }
1419 eve.rid(msg); 1419 eve.rid(msg);
...@@ -1811,7 +1811,7 @@ ...@@ -1811,7 +1811,7 @@
1811 } 1811 }
1812 if((tmp = eve.wait) && (tmp = tmp[at.id])){ clearTimeout(tmp) } 1812 if((tmp = eve.wait) && (tmp = tmp[at.id])){ clearTimeout(tmp) }
1813 eve.ack = (eve.ack||0)+1; 1813 eve.ack = (eve.ack||0)+1;
1814 if(!to && u === data && eve.ack <= (opt.acks || Object.keys(at.root.opt.peers).length)){ return } 1814 if(!to && u === data && !at.root.opt.super && eve.ack <= (opt.acks || Object.keys(at.root.opt.peers).length)){ return }
1815 if((!to && (u === data || at.soul || at.link || (link && !(0 < link.ack)))) 1815 if((!to && (u === data || at.soul || at.link || (link && !(0 < link.ack))))
1816 || (u === data && (tmp = Object.keys(at.root.opt.peers).length) && (!to && (link||at).ack < tmp))){ 1816 || (u === data && (tmp = Object.keys(at.root.opt.peers).length) && (!to && (link||at).ack < tmp))){
1817 tmp = (eve.wait = {})[at.id] = setTimeout(function(){ 1817 tmp = (eve.wait = {})[at.id] = setTimeout(function(){
...@@ -1819,7 +1819,7 @@ ...@@ -1819,7 +1819,7 @@
1819 }, opt.wait || 99); 1819 }, opt.wait || 99);
1820 return; 1820 return;
1821 } 1821 }
1822 if(link && u === link.put && (tmp = rel.is(data))){ data = Gun.node.ify({}, tmp) } 1822 if(link && u === link.put && !at.root.opt.super && (tmp = rel.is(data))){ data = Gun.node.ify({}, tmp) }
1823 eve.rid? eve.rid(msg) : eve.off(); 1823 eve.rid? eve.rid(msg) : eve.off();
1824 opt.ok.call(gun || opt.$, data, msg.get); 1824 opt.ok.call(gun || opt.$, data, msg.get);
1825 } 1825 }
...@@ -2062,7 +2062,7 @@ ...@@ -2062,7 +2062,7 @@
2062 Gun.log(err = (e || "localStorage failure") + " Consider using GUN's IndexedDB plugin for RAD for more storage space, https://gun.eco/docs/RAD#install"); 2062 Gun.log(err = (e || "localStorage failure") + " Consider using GUN's IndexedDB plugin for RAD for more storage space, https://gun.eco/docs/RAD#install");
2063 root.on('localStorage:error', {err: err, file: opt.prefix, flush: disk, retry: flush}); 2063 root.on('localStorage:error', {err: err, file: opt.prefix, flush: disk, retry: flush});
2064 } 2064 }
2065 //if(!err && !Gun.obj.empty(opt.peers)){ return } // only ack if there are no peers. 2065 if(!err && !Gun.obj.empty(opt.peers)){ return } // only ack if there are no peers.
2066 Gun.obj.map(ack, function(yes, id){ 2066 Gun.obj.map(ack, function(yes, id){
2067 if(yes){ 2067 if(yes){
2068 if(yes.more){ acks[id] = yes; return } 2068 if(yes.more){ acks[id] = yes; return }
......
1 function Nomem(){ 1 function Nomem(){
2 var opt = {}, u; 2 var opt = {}, u;
3 opt.put = function(file, data, cb){ cb(null, -9) }; // dev/null! 3 opt.put = function(file, data, cb){ cb(null, -9) }; // dev/null!
4 opt.get = function(file, cb){ cb(null,-9) }; 4 opt.get = function(file, cb){ cb(null) };
5 return opt; 5 return opt;
6 } 6 }
7 if(typeof window !== "undefined"){ 7 if(typeof window !== "undefined"){
8 window.Nomem = Nomem; 8 window.Nomem = Nomem;
9 } else { 9 } else {
10 try{ module.exports = Nomem }catch(e){} 10 try{ module.exports = Nomem }catch(e){}
11 } 11 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
6 const no = require('gun/lib/nomem')(); // no-memory storage adapter for RAD 6 const no = require('gun/lib/nomem')(); // no-memory storage adapter for RAD
7 const fs = require("fs"); 7 const fs = require("fs");
8 const url = require("url"); 8 const url = require("url");
9 const Gun = require("gun"); // load defaults 9 const Gun = require("../multigungun/gun"); // load defaults
10 //require("./gun-ws.js"); // required to allow external websockets into gun constructor 10 //require("./gun-ws.js"); // required to allow external websockets into gun constructor
11 //require("./mem.js"); // disable to allow file writing for debug 11 //require("./mem.js"); // disable to allow file writing for debug
12 require("gun/sea"); 12 //require("gun/sea");
13 require("gun/lib/then"); 13 //require("gun/lib/then");
14 const SEA = Gun.SEA; 14 const SEA = Gun.SEA;
15 const http = require("http"); 15 const http = require("http");
16 const https = require("https"); 16 const https = require("https");
...@@ -79,7 +79,7 @@ server.on("upgrade", async function(request, socket, head) { ...@@ -79,7 +79,7 @@ server.on("upgrade", async function(request, socket, head) {
79 let peers = []; // relaypeers.split(',').map(function(p){ return p+relaypath; }); 79 let peers = []; // relaypeers.split(',').map(function(p){ return p+relaypath; });
80 if(debug) console.log("peers",peers); 80 if(debug) console.log("peers",peers);
81 let g = gun.gun = Gun({ 81 let g = gun.gun = Gun({
82 axe:false, 82 //axe:false,
83 peers: peers, // should we use self as peer? 83 peers: peers, // should we use self as peer?
84 localStorage: false, 84 localStorage: false,
85 store: no, 85 store: no,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!