Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Jabis Sevon
@jabis
now to sleep bbl ->
pszabop
@pszabop
ok will file issue. An array is fine
pszabop
@pszabop
Is it possible to change a user alias after creation? I have an idea on how to create the user pubkey identity first (i.e. offline first), and add an alias later when negotiating with a server, since an alias is a global namespace the alias has to be negotiated to eliminate collisions, check for sybil attacks, alias theft, etc
pszabop
@pszabop
@amark @jabis @Dletta thanks for all your help, I have promise-based tests using Tape and nodejs that can test multiple databases in one process. I can now start attacking my business logic. I basically made a thin wrapper around your API to encapsulate some idiosyncracies and confusing documentation. If you are interested I can put the result in a public repo. Meanwhile here's a gist that encapsulates some of the stuff I learned. https://gist.github.com/pszabop/61c3b7c36aa5fe866834fda4531d9219
@jabis there's already a catch-all documentation bug that discusses the peers syntax: amark/gun#70
Jachen Duschletta
@Dletta
[D]RavenHawkTech:
[D]Dyno: Welcome <@489487350108258308>!!! GUN (https://github.com/amark/gun) is a P2P protocol for syncing data used by 8M+ people monthly across Internet Archive, HackerNoon, DTube (decentralized youtube), Notabug (p2p reddit), & more. Please try the 5min tutorial (https://gun.eco/docs/Todo-Dapp) to get started!
Jachen Duschletta
@Dletta

[D]anoxy: @pszabop in fact it is possible to have aliases exactly as it works in Discord like anoxy#4831. <@280426612900757504> have implemented it in his platform https://www.peersocial.io/

So by doing it that way there won't be any name collisions

Jachen Duschletta
@Dletta
[D]anoxy: @Stefdv the GUN tagg plugin seems to be really cool, thanks for that ;)
Jachen Duschletta
@Dletta
[D]bmatusiak: yea i found to hash the public key to sha256 then converted into a number and then using using that number to id the alias, so far the most promising unique id
Klemen
@KINKCreative
@Stefdv I am tagging items and then when I get to a view of one item (say, post), I’d like to get the tags for this item only. I made a custom getter for it as written but you may have a better solution to get all tags on a node (not all tags that exist in the system). I use it also to favorite items (eg tag with ‘like/userid’) and will use it for user “playlists” of items.
Klemen
@KINKCreative


Anyone else - is there a way to mutate a value without referencing it (e.g. gun.get(‘someitem’).get(‘views’).inc() to increment? Maybe a custom chain method that will call a method on a node with itself as a parameter? That possibly is already written, I’m just thinking out loud here:

Gun.prototype.call( function( Function cb ) {
this.put(cb(this))
})

And then we could do:

Gun.prototype.inc( function() {
    this.call( function(x) { return x++ } )
})
Klemen
@KINKCreative
And maybe for a list, you map & call the callback on each item
Jabis Sevon
@jabis
@Klemen, maybe something along the lines:
Gun.chain.inc = function () {
  let self = this;
  this.get('.').once(function(data,key){
    console.log("data",data,"key",key);
    if(!data) data = 0;
    data = data+1;
    console.log("data",data,"key",key);
    return self.put({[key]:data});
  });
}
// usage: 
gun.get('something').get('views').inc();
// read count
gun.get('something').get('views').get('.').once(function(count){ // count should be now 1 });
wrapper for the count could be
Gun.chain.curval = async function(){
  return await this.get('.').then();
}

//usage: 
let views= await gun.get("whatever").get("inc2").curval();
// should return whatever was incremented
Jabis Sevon
@jabis
ofc you could use callbacks passed instead of async/await
Jachen Duschletta
@Dletta
[D]Dyno: Welcome <@664252972355813377>!!! GUN (https://github.com/amark/gun) is a P2P protocol for syncing data used by 8M+ people monthly across Internet Archive, HackerNoon, DTube (decentralized youtube), Notabug (p2p reddit), & more. Please try the 5min tutorial (https://gun.eco/docs/Todo-Dapp) to get started!
[D]go-rusty:
[D]oneezy:
[D]Dyno: Welcome <@248978062786428928>!!! GUN (https://github.com/amark/gun) is a P2P protocol for syncing data used by 8M+ people monthly across Internet Archive, HackerNoon, DTube (decentralized youtube), Notabug (p2p reddit), & more. Please try the 5min tutorial (https://gun.eco/docs/Todo-Dapp) to get started!
Jachen Duschletta
@Dletta
Jachen Duschletta
@Dletta
[D]mhelander: 👍
Jachen Duschletta
@Dletta
[D]mmalmi: http://localhost:8765/ should perhaps show /examples directory index instead of chat example? 🤔
Jachen Duschletta
@Dletta
[D]datashaman:
[D]Dyno: Welcome <@664436103578779648>!!! GUN (https://github.com/amark/gun) is a P2P protocol for syncing data used by 8M+ people monthly across Internet Archive, HackerNoon, DTube (decentralized youtube), Notabug (p2p reddit), & more. Please try the 5min tutorial (https://gun.eco/docs/Todo-Dapp) to get started!
Stefdv
@Stefdv

@KINKCreative ah, i see... you want the tags per node. While the purpose of gun-tag is to get all nodes tagged to something, you want it the other way around ;)
Well , whenever a node is tagged, the tag is added to the property 'tags' ( as you noticed ) the difference between tag and untag is 1 (tagged) or 0 (untagged).
So (using my example provided in my github comment )

gun.get('alex').get('tags').once(tags=>{
  var t = Gun.obj.copy(tags)
   delete t._
  console.log(t)   // {member:0,paid:1} 
})

So alex is untagged from 'member' but tagged to 'paid'
Does this answer your question ?

Jachen Duschletta
@Dletta
[D]xenister: hi can i store gun.user() information on indexedDB ?
Jachen Duschletta
@Dletta
[D]sirpy: <@!178314946201780224> a working react-native asyncstorage https://github.com/GoodDollar/gun-asyncstorage
Klemen
@KINKCreative

@Stefdv Yes that much I figured, thanks!

I was wondering if it would be a huge workaround the difference between tag and untag is not 1 & 0 but instead an int number of total numbers of such tag? (say, I have 10 people tagging an item with ‘like’, wouldn’t it be cool if the response would say { like: 10 }

btw I notice you do .obj.copy(…) - is that different from open() or load() ?
Jachen Duschletta
@Dletta
[D]marknadal: <@!506274864089268235> I'll check it out, been swamped.
@pszabop yeah, AXE code, Stats, and garbage collector, etc. are all on setIntervals, you're right, they should cancel/close, good observation.
Gun('peer' Gun(['peer', 'peer Gun({peers: [ Gun({peers: { etc. guessing somebody else already helped.
NOTE (this should be in docs already) GUN works offline but if you specify a peer(s), it will error, since it assumes you intend to be online with it.
For instance, if you have no peers, you can still create/auth Users offline/locally.
Creating key pairs always works no matter what await SEA.pair()
But yeah, like <@!612728945313316904> said syncing users best if at least online once. <@!280426612900757504> also ^
<@!407331962269728768> fun!!! you've already used it with people??? What was the audience?
<@!103660564651212800> yes what <@!506274864089268235> said, whatever the storage engine supports, yayy thanks for helping others out, I love seeing that! 🙂 Also note RAM limit: GUN values are atomic, so limit of an individual key/value pair should be SMALLER than the RAM of the smallest device you support.
<@!447932418477916160> <@!612728945313316904> so close! sorry gun.on('auth versus Gun.on('auth I think it is just that your phone auto capitalizes stuff 😛 but important subtle difference. I want to make user.on('auth' work but lol it is buggy.
user.leave() is synchronous, no event for it currently.
Oh wow, you already saw my code comments, nice!!!! Impressive.
Hmm, maybe I'm not calling to.next(e in auth when I need to, it should support multiple, if not, that is a bug. Should be easy fix, wanna try?
<@!447932418477916160> there is SEA.opt.pub('asdf~lol.yay.what') which returns the PubKey portion of that "soul" or undefined. Does that help?
[D]marknadal: <@!635601430413049859> yes 😄 😄 😄 still use PANIC and it is EPIC, docs are here: https://github.com/gundb/panic-server and alsoc heck out https://github.com/amark/gun/blob/master/test/panic/load.js for a tutorial.
Also... I test/debug a lot in production haha, woops!
  • @KINKCreative how is the Tagging library going? + <@!366349503265112074>
    <@!648558515463651338> 👏 you also jumping in and helping as well, love it!
    Yeah, peers will Array -> Object upgrade for you.
    @pszabop I gave a manual example how to add another alias to a user a ? week ago ? discord search should pull it up. Yay <@!366349503265112074> + <@!280426612900757504> help! 😄 :D
    w000h00, you have the test working?? YAAAAYyy!! THanks to all the help of the others too.
    Maybe you can create a https://github.com/amark/gun/wiki/Testing page for us??? Even if just stub to start.
    @KINKCreative Gun.chain.myExtension = function(){ var gun = this; return gun } super easy to make custom extensions 😄 goal is to wrap even app-specific logic into little "macros" you reuse in your app instead of GUN's core API. Things like increment/decrement require a special CRDT, can be done in like 12 LOC, see this page: https://gun.eco/docs/Counter + <@!648558515463651338> if you're curious too (what is curval?).
    <@!491228220520136704> w00h00 clicks thanks for the mention, and excited for getting React Native stuff more official.
    OOOO yay and you're helping with more official React Native storage ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ YOU ARE AWESOME!!!!!!!!!!!! ⚡ ⚡ ⚡ ⚡
    <@!636489182214357002> been meaning to improve the example app yeah, but that homepage is also the homepage of all default deploys, so I want it to also be useful apps, not example-only.
    <@!103660564651212800> should via https://gun.eco/docs/RAD#install but I think there is a BUG someone listed that Users aren't working with IndexedDB or something odd like that? I need to look into it.
[D]marknadal: <@!547550778257309697> <@!489487350108258308> <@!664252972355813377> <@!248978062786428928> <@!664436103578779648> !!!!!!!!!!!! WELCOME WELCOME WELCOME TO THE COMMUNITY!!!!!!!!!!! ⭐ ⚡ 👏 ⭐ 👏 ⚡ how'd you hear about us? What are you working on???
Mark Nadal
@amark
still some gitter discord missing messages.
@KINKCreative I think @Stefdv was working around stuff (way back when) when load/open didn't exist. :)
Jachen Duschletta
@Dletta
[D]marknadal: <@!612728945313316904> still do me a favor and update your gitter dletta profile avatar with an obvious (maybe solid color) unique image, so it is easier to scan (?) thank you!!!
[D]marknadal: <@!664252972355813377> I take it you've got some good rust/go experience, wanna help with a RUST port of GUN?
[D]marknadal: <@!547550778257309697> <@!489487350108258308> <@!664252972355813377> <@!248978062786428928> <@!664436103578779648> did you all land here because of <@!491228220520136704> 's article? Seems like you all came in at same time. 🙂 Did I miss something?
  • what are your skills? Or things you're passionate wanting to learn?
[D]jabis: <@!178314946201780224> was just example how to implement a counter for a node
Gun.chain.incrval = function () {
  let self = this;
  this.get('.').once(function(data,key){ 
    if(typeof data === "undefined") data = 0;
    data = data+1;
    return self.put({[key]:data});
  });
}
Gun.chain.decrval = function(){
  let self = this;
  this.get('.').once(function(data,key){
    if(typeof data === "undefined") data = 0;
    data = data-1;
    return self.put({[key]:data});
  });
}
Gun.chain.currval = async function(){
  let curr = await this.get('.').then();
  if(!curr) curr = 0;
  return curr;
}
//usage:
gun.get("stuff").get("views").incrval() // data is 0+1
gun.get("stuff").get("views").currval() // 1
gun.get("stuff").get("views").incrval() // data is 1+1
gun.get("stuff").get("views").currval() // 2
gun.get("stuff").get("views").decrval() // data is 2-1
//etc
Klemen
@KINKCreative
@amark yeah it’s so great - what I was curious if you would put any custom logic (eg update verification etc) on the server’s gun instance and run them in the .on() hook vs keeping business logic also in frontend code where it can be looked at? Because the question I have is how to keep some of this data that’s “tamper-safe” eg I keep being paranoid about someone just running gun, and changing some keys or tagging things “for” others… yknow. Intentionally mess with stuff.
Jachen Duschletta
@Dletta
[D]Yakulu: <@!178314946201780224> Hello Mark. I was on Gitter several months ago. Had to report my project and hope to start in several weeks... 😉
[D]jabis: <@!178314946201780224> the problem pszabop had was that if you provide Gun({peers:{"url-address/gun":{}}) to the constructor, it doesn't work
Jachen Duschletta
@Dletta
[D]jabis: <@!178314946201780224>, i have in my non-authenticated gun aka Nug a call for if(gun && !Nug) Nug = new Gun({peers:Object.keys(gun._.opt.peers)}); to get it working, so there should be checking whether it's an array or an object, as the obj_map(tmp... fails miserably with object constructor on opts.peers 🙂
Jachen Duschletta
@Dletta
[D]go-rusty: <@!178314946201780224> We met at Draper yesterday 😉 ... and yes, lets get gun turn into a gatling gun with rust! We need it for our browser, so for launch probably we will go with the js version and work with the community to port it to rust. We will commit resources to it. Will certainly need some architecture help from you and other awesome folks that you recommend.
Jachen Duschletta
@Dletta
[D]marknadal: <@!664252972355813377> oh awesome, nice, yes https://gun.eco/docs/Porting-GUN is 30min I rebuild GUN from scratch on stage 😄 happy to sit down with anybody for Rust port, definitely let me know, that'd be huge contrib back to community!
[D]marknadal: <@!648558515463651338> ah thanks for catching that, maybe should make docs officially just string or array then 😛
[D]marknadal: <@!547550778257309697> nice, excited to see!!
[D]jabis: <@!178314946201780224> nah - a simple check if object but an empty one is passed and decorate it properly should do it, now passing an array just for it to construct and decorate the object seems silly
Jachen Duschletta
@Dletta
[D]jabis: <@!178314946201780224> docs say it should be in the form of peers:{'url/gun':{},...} should work, but it does not, has to be array/string for is_list to do the iteration over [url1/gun] to constructing {'url1/gun':{url:'url1/gun'}} 🙂
[D]hannabawab:
[D]Dyno: Welcome <@577672326947012629>!!! GUN (https://github.com/amark/gun) is a P2P protocol for syncing data used by 8M+ people monthly across Internet Archive, HackerNoon, DTube (decentralized youtube), Notabug (p2p reddit), & more. Please try the 5min tutorial (https://gun.eco/docs/Todo-Dapp) to get started!