Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 04:33
    ndaidong closed #1292
  • Dec 01 16:01
    ameoba32 opened #1295
  • Dec 01 07:28

    amark on master

    toString must be stringy! (compare)

  • Dec 01 05:29
    amark commented #1287
  • Dec 01 05:21
    amark commented #1289
  • Dec 01 05:20
    amark commented #1293
  • Dec 01 05:12
    amark commented #1294
  • Nov 30 08:27
    soulofmischief commented #1294
  • Nov 28 23:07
    ViteOrder opened #1294
  • Nov 24 06:51
    expelledboy synchronize #1276
  • Nov 22 18:04
    BrendanDN commented #1290
  • Nov 22 18:04
    BrendanDN closed #1290
  • Nov 22 18:04
    BrendanDN commented #1290
  • Nov 22 17:59
    BrendanDN commented #1292
  • Nov 22 04:07
    ndaidong commented #1292
  • Nov 21 20:28
    verschmelzen opened #1293
  • Nov 21 19:44
    BrendanDN commented #1292
  • Nov 21 14:50
    ndaidong opened #1292
  • Nov 19 17:41
    estebanrfp commented #1080
  • Nov 18 21:26
    @rogowski banned @jesus:halogen.city
i001962
@i001962:matrix.org
[m]
that list should be frequently updating as peers come on and off line iirc - axe has been a bit fuzzy for me so I definiately could be wrong here
rococtz
@rococtz:matrix.org
[m]
i001962: at the moment it's stored in the code, but my guess is that it's only temporary. As soon as AXE is complete, we could have thousands of relays so that should work automatically
drunkod7
@drunkod7:matrix.org
[m]
Hi, please share the migration guide from neo4j to gun db? Tutorial on web?
rococtz
@rococtz:matrix.org
[m]
drunkod7: Do you know for sure someone made such a guide? Where did you hear about it?
^ ランナー▟
@shiftrunstop:matrix.org
[m]
I want to do some mixing of technologies has anyone tried to do authentication with metamask or something.
^ ランナー▟
@shiftrunstop:matrix.org
[m]
Never mind I got some tutorials thanks anyway.
1 reply
viteorder
@viteorder:matrix.org
[m]
Ronald Prato
@Ronald-Prato
Hi there! Reading the docs didnt find a filters application. Is there any way to apply filters to a map?
1 reply
do i have to map over the whole thing and filter by myself?
Muhammad Hassan Bilal
@hassan-bilal144
Hi, I'm implementing a simple user signup and login and upon signup, a new gun user is created (username and password taken from user input). Is there a way to get the record of all users (from gundb) that have signed up?
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
Most of my problems seem to stem from the fact that a put() will result in on() handlers being called even though they're both on the same peer.
1 reply
Lexi
@Lexi:matrix.org
[m]
Maybe save the author along with it and don't execute the function you're now using as callback if they author is the same as the viewer?
1 reply
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
Having said this...it's more than likely a more generic problem with my 'algorithm'.
In my current case, I was thinking it was easier to remove the contents of a 'folder' in gun, before writing new contents...but removing the contents resulted in gun telling the on() handler to remove them from the browser, which isn't what I wanted at all. It's a nightmare for race conditions.
1 reply
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
Yeah, I do that (everywhere, actually)...but in this case I'm only removing the folder contents before I create new contents...so that there aren't any left over that no longer exist. Like, 'rm -r folder/; cp -r newFolder/ folder'. .. except the 'rm -r' ends up removing stuff in 'newFolder' because that's what the 'on()' handler does.
I just have to have a most 'accurate' update algorithm and not be so lazy.
I wonder if it might be a good idea to 'batch' the put()s and to a single put({...updates}) on the parent object...I suspect that won't make any difference to the calls made to on() though, since there's a handler on all the items in gun (using get().map().on(...))
Lexi
@Lexi:matrix.org
[m]
You can also remove the listeners and readd them after finishing changing the data
1 reply
Lexi
@Lexi:matrix.org
[m]
I don't think so because you're readding the on listener which will automatically get changes when there are any available
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
but I do multiple put()s so some resulting from peers could also trigger the on() handler...so I can't disable the on() handler.
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
What seems to be working better, after some refactoring, is building an object of changes, and doing a single put() on the parent object with all the changes at once...it seems to result in the same calls to the on() handler, but there's no opportunity for them to happen between what was a sequence of put()s.
The code is a lot simpler like this too - I don't put() null only to put() a value later on...much cleaner.
Muhammad Hassan Bilal
@hassan-bilal144
Hi, is there a way to get the key pair ( the .sea object that gun.user().auth() returns) of the currently logged in user?
1 reply
Muhammad Hassan Bilal
@hassan-bilal144
Since user.pair() is deprecated, is there a workaround?
Bo
@worldpeaceenginelabs

What seems to be working better, after some refactoring, is building an object of changes, and doing a single put() on the parent object with all the changes at once...it seems to result in the same calls to the on() handler, but there's no opportunity for them to happen between what was a sequence of put()s.
The code is a lot simpler like this too - I don't put() null only to put() a value later on...much cleaner.

@davidmaxwaterman:mozilla.org

I think that is the way to go with Gun anyway. Processing everything local and only push the changes to Gun.

// Local processing end-result
var result = "result"

// Generate random ID
var randomid = nanoid(); 

// Save to Gun (new "row")                                        
db.get(graph).get(subgraph).get(randomid).put(result);

// Save to Gun (update "row")                                        
db.get(graph).get(subgraph).get(id123).put(result);
davidmaxwaterman
@davidmaxwaterman:mozilla.org
[m]
I'm not sure that relates to my issue :/
Previously, I was traversing the new state in the browser and trying to find changes, and when I did, I would put() the new value and continue looking for more. If there were several changes, then there would be several put()s. Since this code involves async tasks, it allows other async tasks to get between the individual put()s, and since each put() results in Gun calling an on() handler, those would be interleaved (and this code updates the browser state being traversed to find changes).
So, instead of doing lots of put()s, I create a single object with all the changes, and so a single put() once I'm done....then gun calls all the on() handlers and they don't get interleaved in my code that figures out the changes.
1 reply
Bo
@worldpeaceenginelabs

I think Gun is mighty in the way that you are able to write quasi-independent components with it.
The following few lines are a Gun form component. You are able to connect the component with every relay, just by exchanging or adding relay addresses. Then the component syncs out of the box. @davidmaxwaterman:mozilla.org (no ON handler neccessary here, but if i would like to fetch the input and show it my user on the "successfully sended" page, then i simply use a ON call on my "successfully sended" page)

I think we as devs take it to often for granted, that we are working with decentralization technology.
But we are playfully paving the way to a future decentralized, hopefully post-scarcity humanity.

My point is, you have to think like someone from the Star Trek universe, to actually gain Gun's full potential.

A Gun component is like a nanobot, which syncs with every other bot (component)
By adding addresses, its able to connect its functions to every other bot on the swarm. (thats today mindset like, which is ok)
But if you would give the nanobot (our Gun component) the ability to crawl addresses itself... And if you would give it hacker tools onboard, it could even hack into relays... (that is the Star Trek mindset for instance) 😁👍

Try to go crazy geeky in your mind, Gun is made for this!!!

@amark A really cool feature would be a visualization of the whole graph existing on command. (Maybe in the visual like of a relational database?)
Something like Gun to Excel maybe...

<script lang="ts">

import Gun from "gun";

// declaring variables
var longitude: number; 
var latitude: number;

// Initialize GUN and tell it we will be storing all data under the key 'test'.
var gun = Gun(['https://gunrelayeurope.herokuapp.com/gun']).get('test')

// Fetch the input fields from form
async function handleSubmit(event) {
        console.log(event);
        console.log(event.target);

//check if submit fills the values of the variables
        console.log(longitude)
        console.log(latitude)

        // Tell GUN to store an object
        gun.set({longitude, latitude});        

        // Show Gun data
        gun.on(data => console.log(data))
        }
</script>


<form on:submit|preventDefault="{handleSubmit}">
  <div>
    <label for="longitude">Longitude</label> 
    <input id="longitude" type="text" name="longitude" bind:value={longitude}>
    <br>
    <label for="latitude">Latitude</label>
    <input id="latitude" type="text" name="latitude" bind:value={latitude}>
  </div>

  <div>
    <input type="submit" value="Send">
  </div>
</form>


<style>
  :root {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
      Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  }
</style>
CB
@ameoba32
Hi All, GUN is amazing so far, however I face many non-trivial behaviours ). Can you help me to understand why next code does not really work? It only shows first char. Thank you

<!DOCTYPE html>

<style>html, body, textarea { width: 100%; height: 100%; padding: 0; margin: 0; }</style>

<textarea id="paste" placeholder="paste here!"></textarea>

<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script><script>
gun = Gun(['https://gun-manhattan.herokuapp.com/gun']);
copy = gun.get('test').get('paste947');
paste.oninput = () => { copy.put({serving:paste.value, next:'test'}) };
copy.on((data) => { paste.value = data.serving });
</script>

alecBeccaria
@alecBeccaria
Is there a way to delete a user by public key rather than alias, I messed up and have two users with the same alias and password, but different public keys
i001962
@i001962:matrix.org
[m]
Been messing around with Farecaster Hub recently and can't help but think about 'arming' it with gun. Anybody else diving into that? https://github.com/farcasterxyz/hub
Anas Abdullah Saber
@Anas2001
Hi, is there a way to revoke the certificate from one publicKey in gundb ?
1 reply
Anas Abdullah Saber
@Anas2001
Yes I thought that too but want only to see if there are another option but thanks for your reply to my question 😊
Manwë
@Manwe-777
Hey I am working on a project and I need some ideas.. its something like gun.
The idea is to have a DNS-like to find server peers (this part is already working trough trackers), so we can easily refer to servers using only a string/plain text name. The idea is for it to be agnostic of the current domain system of the internet.
The fun part begins when we start saving and getting data.. Ideally users should sign up within a hostname (like "servername@pupbkey.key.subkey", etc), this way users can pick where they want their data to be stored, and others can easily find this data by using that key simply by finding the host using the tracker/dns thing. All data would obviously be protected by keys, signatures and optionally encryption, to avoid any tampering.
Is there any point of failure within a system like this? Say you go into certain app and it might have data from multiple servers (since users can sign up at any host), users could migrate from one host to the other without issues, since its their data and they can reupload it anywhere else. Also, servers can set their own rules for admission of new users, or even limits in storage, propose premium plans, etc.
soulofmischief
@soulofmischief
I had the understanding that partials "just worked" but I am having race issues

my understanding is that

const childRef = getBlockRef( child )

  getBlockRef( parent )
    .get( 'children' )
    .set( childRef )

should just work

even if the parent's other data is not put until a later time
however, this usually fails and I have to resort to this:
const parentRef = getBlockRef( parent )
    // Wait for parent to be stored.
    .once(() => {

      const childRef = getBlockRef( child )
        // Wait for child to be stored.
        .once(() => {

          // Store child reference.
          parentRef
            .get( 'children' )
            .set( childRef )
        })
    })

all i'm doing to store the parent is

getBlockRef( block )
    .put({
      id: block.id,
      data: block.data,
    })

however I don't wait for it to complete, moving right to storing children. But it seems that if the parent has not been sucessfully stored before setting the child, I get a failure state.

getBlockRef is just defined as
function getBlockRef( block ) {
  return gun
    .user()
    .get( 'blocks' )
    .get( block.id )
}
soulofmischief
@soulofmischief
Specifically the error is silent, however the data is missing upon query.
Muhammad Hassan Bilal
@hassan-bilal144
Hi, I'm facing trouble in writing to other user space using certificate.
  • I create a certificate that allows any user to write to the 'chat' path given that the path/key has the writer's public key: { '': 'chat', '+': '' }
  • I put() the certificate on the chat path and also store it in the 'certificate' path so that the other user can get it using the pubkey
  • To send a message, I encrypt it first (different encryption key for sender and receiver) and then put the encrypted string on the sender user's space (chat/timestamp) path and then on the same path of the other user by using their certificate.
  • This works for the first two aur three message conversations on both sides (sender and receiver ) but then randomly the code gets stuck where it has to write on the other user's space using the certificate
3 replies
Muhammad Hassan Bilal
@hassan-bilal144
I'm using certificate so that the user is bound to include their pub key in the path while writing to other users space so it prevents one user to override another user's data
The timestamp string also makes sure that one message of same user doesn't override the other
@amark
Anas Abdullah Saber
@Anas2001
What this warning message mean "reusing same fs store and options as 1st" ?
phaze-jeff
@phaze-jeff:matrix.org
[m]
if two completely different apps happen to use the same key for the gun.get() function, wouldn't this cause problems? do keys need to be unique to avoid this?
Anas Abdullah Saber
@Anas2001
@phaze-jeff:matrix.org which problem? If you mean race condition you can prevent it if each app use the same key in their own private graph or you can use content address method