mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
fix SEA shuffle to ignore good GUN data
Sea
This commit is contained in:
commit
41f45a97a4
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.9.999995",
|
||||
"version": "0.9.999996",
|
||||
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
|
||||
"main": "index.js",
|
||||
"browser": "gun.min.js",
|
||||
|
7
sea.js
7
sea.js
@ -1273,8 +1273,10 @@
|
||||
}
|
||||
SEA.opt.unpack = function(data, key, node){
|
||||
if(u === data){ return }
|
||||
if(data === node[key]){ return data }
|
||||
if(data && data['#'] && rel_is(data) === rel_is(node[key])){ return data }
|
||||
var tmp = data, soul = Gun.node.soul(node), s = Gun.state.is(node, key);
|
||||
if(tmp && 4 === tmp.length && soul === tmp[0] && key === tmp[1] && s === tmp[3]){
|
||||
if(tmp && 4 === tmp.length && soul === tmp[0] && key === tmp[1] && fl(s) === fl(tmp[3])){
|
||||
return tmp[2];
|
||||
}
|
||||
if(s < SEA.opt.shuffle_attack){
|
||||
@ -1283,6 +1285,9 @@
|
||||
}
|
||||
SEA.opt.shuffle_attack = 1546329600000; // Jan 1, 2019
|
||||
var noop = {}, u;
|
||||
var fl = Math.floor; // TODO: Still need to fix inconsistent state issue.
|
||||
var rel_is = Gun.val.rel.is;
|
||||
// TODO: Potential bug? If pub/priv key starts with `-`? IDK how possible.
|
||||
|
||||
})(USE, './index');
|
||||
}());
|
||||
|
@ -230,8 +230,10 @@
|
||||
}
|
||||
SEA.opt.unpack = function(data, key, node){
|
||||
if(u === data){ return }
|
||||
if(data === node[key]){ return data }
|
||||
if(data && data['#'] && rel_is(data) === rel_is(node[key])){ return data }
|
||||
var tmp = data, soul = Gun.node.soul(node), s = Gun.state.is(node, key);
|
||||
if(tmp && 4 === tmp.length && soul === tmp[0] && key === tmp[1] && s === tmp[3]){
|
||||
if(tmp && 4 === tmp.length && soul === tmp[0] && key === tmp[1] && fl(s) === fl(tmp[3])){
|
||||
return tmp[2];
|
||||
}
|
||||
if(s < SEA.opt.shuffle_attack){
|
||||
@ -240,5 +242,8 @@
|
||||
}
|
||||
SEA.opt.shuffle_attack = 1546329600000; // Jan 1, 2019
|
||||
var noop = {}, u;
|
||||
var fl = Math.floor; // TODO: Still need to fix inconsistent state issue.
|
||||
var rel_is = Gun.val.rel.is;
|
||||
// TODO: Potential bug? If pub/priv key starts with `-`? IDK how possible.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user