Open fitouch opened 2 years ago
i thought the same but you dont necessarily need Content-Addressing in a user graph. as the content is protected by the hash.
so hash it like normal. and save it like normal.. put/store the hash's "soul" in the user graph that points to the hashed content
you may just want to store the soul
to have it map/link to it.
I thought about hash it normal, but sometimes I want to edit or delete the message from my own user graph and save soul in the room (user graph). LEX is not working in user graph without hash, is it?
https://gun.eco/docs/SEA.certify#5-there-are-ways-to-get-a-list-of-links-added-by-a-particular-user
Is the code broken or outdated?
@bmatusiak I kept testing. LEX does not work in user graph at all. How can we fix it?
use lex in map, not in get, as per @amark
@bmatusiak https://jsfiddle.net/c04fnro3/24/
The operator "=" does not work in user graph, only public graph. Can you test?
@bmatusiak @amark
Here's my fix for LEX in user graph. It works for me, I tested it in public graph, content-addressing in public graph, user graph, and user graph with cerify.
The only thing is that the operator "=" does not work well with content-addressing (key + hash) in user graph and public graph. I'm sure we can fix that but for now I want LEX to work in user graph. Let me know what you think of the code below.
gun.js lines 25 - 41
var ms = ""; String.match = function(t, o){ var tmp, u; if(t) {if (t.split("/").length > 1) ms = t.split("/").pop();} if('string' !== typeof t){ return false } if('string' == typeof o){ o = {'=': o} } o = o || {}; tmp = (o['='] || o['*'] || o['>'] || o['<']); if(o["="] && (ms === tmp || t === tmp)){ return true } else if(o["*"] && (ms.startsWith(tmp) || t.startsWith(tmp))){ return true } else if(o[">"] && (ms > tmp || t > tmp)){ return true } else if(o["<"] && (ms < tmp || t < tmp)){ return true } if(u !== o['=']){ return false; } tmp = (o['*'] || o['>']); if(t.slice(0, (tmp||'').length) === tmp){ return true } if(u !== o['*']){ return false; } if(u !== o['>'] && u !== o['<']){ return (t >= o['>'] && t <= o['<'])? true : false; } if(u !== o['>'] && t >= o['>']){ return true } if(u !== o['<'] && t <= o['<']){ return true } return false; }
@bmatusiak @amark
I spent more time testing with the current code in gun.js and I found that gun.user(Bob.pub).get('list').map().get({'.': { "=": new Date().toISOString() }})
works. Is that expected?
@bmatusiak @amark @Orimay
I have a fix for LEX issue. I ran "npm run test" and all passed. Can one of you give me an access to commit my fix and review it?
@amark https://github.com/amark/gun/pull/1268 is ready for review!
https://gun.eco/docs/SEA.certify#5-there-are-ways-to-get-a-list-of-links-added-by-a-particular-user
// 1. We may use a LEX query to get all links for a particular user gun .user(room.pub) .get('#links') .get({'.': {'*': Bob.pub}}) .map() .once((d,k)=> { bobLinks[k]= JSON.parse(d) })
It works only without gun.user(room.pub). Is it a bug? I really want this part for my project.