Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 03:50
    resession updated the wiki
  • 03:49
    resession updated the wiki
  • Oct 19 22:32
    resession commented #404
  • Oct 19 02:55
    mimiza commented #1137
  • Oct 17 02:47
    rococtz updated the wiki
  • Oct 17 01:22
    cryptoboid updated the wiki
  • Oct 16 11:59
    Choko256 opened #1152
  • Oct 16 11:50
    Choko256 commented #972
  • Oct 16 03:41
    amark updated the wiki
  • Oct 16 02:37
    amark updated the wiki
  • Oct 16 02:28
    amark updated the wiki
  • Oct 15 23:36
    amark updated the wiki
  • Oct 15 19:22
    noctisatrae commented #1141
  • Oct 15 19:20
    noctisatrae synchronize #1141
  • Oct 15 19:18
    noctisatrae synchronize #1141
  • Oct 15 19:16
    noctisatrae synchronize #1141
  • Oct 15 09:23
    ruslanjan commented #1145
  • Oct 15 09:04
    amark closed #1149
  • Oct 15 09:04
    amark commented #1149
  • Oct 15 09:03

    amark on master

    Update README.md (compare)

Jabis Sevon
@jabis

@jabis can you connect to peers https://fire-gun.herokuapp.com/gun and run this command

gunHeroku.get('chat2').get({'.': {'*': '2021/06'}}).map().once(s=>{
  console.log (s);
})

Well, I expected undefined and got undefined lol

writing to ./testdb/ef9oOX406VUVK0IE.json
testing get {'.': {'*': '2021/06'}} expecting output
data undefined
ok 1 s was undefined
# force test to end
ok 2 forcing test to end with process.exit

1..2
# tests 2
# pass  2

# ok
Wasis Haryo Sasoko
@yokowasis
@jabis try it again
gun only allocated i think 30ms to fetch the data before returning undefined.
Jabis Sevon
@jabis
Ok this works, first fetching the parent object
console.log("testing get {'.': {'*': '2021/06'}} expecting output")
  await gun.get('chat2').then();  
  await gun.get('chat2').get({'.': {'>': '2021/06'}}).map().once(s=>{
    console.log ("data",s);
    t.notEqual(s,undefined,"s was not undefined");
  }).then()
I think that was a known bug
testing get {'.': {'*': '2021/06'}} expecting output
data { _: { '#': 'chat2/2021/06/25 01:30:00' } }
ok 1 s was not undefined
data { _: { '#': 'chat2/2021/06/31 01:00:00' } }
ok 2 s was not undefined
data { _: { '#': 'chat2/2021/06/31 01:30:00' } }
ok 3 s was not undefined
data { _: { '#': 'chat2/2021/06' } }
ok 4 s was not undefined
data { _: { '#': 'chat2/2021/06/22 01:00:00' } }
ok 5 s was not undefined
data { _: { '#': 'chat2/2021/06/23 01:30:00' } }
ok 6 s was not undefined
data { _: { '#': 'chat2/2021/06/24 01:00:00' } }
ok 7 s was not undefined
# force test to end
ok 8 forcing test to end with process.exit

1..8
# tests 8
# pass  8

# ok
Wasis Haryo Sasoko
@yokowasis
@jabis does that mean you have to fetch all the data first ? if possible I want to fetch only the data I need.
Jabis Sevon
@jabis
I'd say you only need to trigger a query first
fetching the parent "chat" -object once won't fetch all data I think, only one level
Wasis Haryo Sasoko
@yokowasis
if this is a chat app, 1 level can easily have 1000 entries.
Jabis Sevon
@jabis
add some metadata node that doesn't have anything interesting
Gessic
@gessicapps_twitter
Hi, how do I set something to null? everytime I try, it just adds a new entry/node:
feedProviders.get(providerAddress.Algaddress).set(null);
image.png
Wasis Haryo Sasoko
@yokowasis
@gunar put(null)
@gessicapps_twitter put(null)
Gessic
@gessicapps_twitter
Perfect, thanks @yokowasis
Gessic
@gessicapps_twitter
how can I return the values from .once() without using a callback? It doesnt seem to be an async function...
Jabis Sevon
@jabis
include gun/lib/then.js or gun/lib/promise.js
4 replies
@gessicapps_twitter ^
Jabis Sevon
@jabis
image.png
for example
David Dahl
@daviddahl
@amark No worries. My ignorance of AXE was the issue. I have watched the talk you gave on it... Exciting stuff man. And yes, I get it ,making shit just WORK is important. Now that I think about it, Libp2p and IPFS do that too :)
There are a lot of onion skins for me to pull back yet with GUN.
David Dahl
@daviddahl
@amark was that talk yesterday recorded? I am curious about your concept - I have been talking about UX and crypto for some time - Search & privacy sounds interesting...
aaronsantiago
@aaronsantiago

I'm using gun to update a react page with a lot of user-editable elements that are synced across devices, and I'm noticing that it can sometimes take a while (30 - 90 seconds) to get to the latest version (it seems like it runs through a lot of the history). I would think that gun would locally cache calls to .get()?

Also would using .set() instead alleviate some of these issues? There are a lot of entries in there that are nulled or marked as deleted and it has to download the non-nulled versions first before deleting them making for a poor UX

Adam
@adam-12:matrix.org
[m]
@aaronsantiago might benefit from using the option change: true when using once().
Hmm maybe not if the change is null
aaronsantiago
@aaronsantiago
Seems like I'm hitting quota exceeded well before the 5mb localstorage limit as well--perhaps I'm misunderstanding some part of that. I can switch to RAD/indexedDB I believe since that works in the browser
Alexander Quine
@alxndr
is there a recommended way of visualizing the db?
jakethejab
@jakethejab

I am trying to wrap my head around Lex, but the documentation does not describe what some of the characters used in the examples actually do, specifically #, +, and ..

Here are some Lex examples pulled from the SEA certify docs, could someone please describe what the #, +, and . characters do in this context?

{"*": "notifications", "+": "*"} // Path must start with "notifications", then Path or Key must contain Certificant's Pub (it's just (path||key).indexOf(pub)!=-1)

{"#": {"*": "inbox"}} // Path must start with "inbox". "get('inbox').get('Alice').get('secret').put('abc', null, cert)" and "get('inbox').get('Bob').get('sensitive').put('something', null, cert)" ARE ALL OK.

{"#": {"*": "project"}, ".": {"*": "Bob"}, {"+": "*"}} // Path must start with "project" and Key must start with "Bob", then Path or Key must contain Certificant's Pub.

"inbox/Bob" // Path must equal "inbox/Bob", it is a LEX exact match {"=":"inbox/Bob"}

["inbox", {"*":"projects", "+": "*"}, {"*":"employees"}] // an Array of rules. If any matches, continue.
Bradley Matusiak
@bmatusiak
lamo,, google failed because they didnt have gun, https://www.youtube.com/watch?v=v_UyVmITiYQ
rococtz
@rococtz:matrix.org
[m]
@aaronsantiago: If you deleted something, it will still show as null. The solution to get rid of this is to use map(); if the value is null just manually returned undefined so the callback is not triggered anymore. About the local storage, the 5MB limit is annoying, but IndexedDB is much much slower
3 replies
@alxndr: there are plenty of ways https://gun.eco/docs/Awesome-GUN#plugins-helpers
1 reply
rococtz
@rococtz:matrix.org
[m]
This one is the first that I clicked and it doesn't give 404. It even has a youtube video on the README page and the creator is active in chat @Dletta
1 reply
Lorenzo Mangani @qxip
@lmangani:matrix.org
[m]
@AlexZan: gun-graphin and gun-scape also should work fine (i mostly maintain them) what viasualizer projects are you referring to?
1 reply
Jachen Duschletta
@Dletta
[D]Aethiop: I've been trying to upload a file to gun by chunking the data and downloading the file is just reading those chunked data to a blob and creating object URL for it but it seems that it's not getting the full file something is wrong when reading the file because the size is not the same as the upload and also the file is corrupt. Can anyone help me out on this?
[D]Aethiop: ```let files = {};
let reader = {};
let loading = true;
var slice_size = 1024 1024 1;
const is_file = () => {
    if (files && files[0] && files[0].size > 0) {
        return true;
    }
    return false;
};
let prev = user.get("file");

function upload() {
            if (files[0]) file = files[0];
    if (is_file()) {
        prev = prev.get(file.name).get("next");
        reader = new FileReader();
        upload_file(0);
    }
}

function upload_file(start) {
    var next_slice = start + slice_size + 1;
    var blob = file.slice(start, next_slice);
    reader.onloadend = function (e) {
        if (next_slice <= file.size) {
            prev.put({ data: e.target.result });
            prev = prev.get("next");
            upload_file(next_slice);
        } else {
            loading = false;
        }
    };
    reader.readAsText(blob);
}```
[D]Aethiop: This is how I'm Uploading the download is kinda the same just reading from the linked list
[D]Aethiop: ```
async function getChunks(k) {
var next = user.get("file").get(k);
var chunks = "";
while ((await next.get("next").get("data")) != null) {
next = next.get("next");
chunks += await next.get("data");
}
return chunks;
}
user.get("file")
.map()
.once(async (d, k, n) => {
var fileChunk = await getChunks(k);
var data = new Blob([fileChunk], { type: "text/plain" });
            var url = window.URL.createObjectURL(data);
            console.log(data.size);
            if (fileChunk) {
                files = [
                    ...files,
                    {
                        url: url,
                        name: k,
                        size: data.size,
                    },
                ];
            }
        });```
[D]Aethiop: Console log shows the same thing when uploading and downloading its just the file gets corrupt i don't understand
Alexander Quine
@alxndr
what does the "0 length key!" console message indicate? all my uses of .get() are passing in non-empty strings...
Jabis Sevon
@jabis
you seem to forget that gun.get is not promisified without using something that promisifies it (gun/lib/then or gun/lib/promise) gun.get only returns you the chain item, not the contents
Jabis Sevon
@jabis
I'd probably go with it with something like
// <script> tags for then 
files.map(file=>{
    return getChunks(file)
  }).reduce(async(prev,next)=>{
    await prev;
    return next.then();
  },Promise.resolve()).then(()=>{
    done()
})
where files would be the wanted keys I suspect, getChunks returns a promisified gun.get.then (ie a real value) and all boils down to a single then - well my example doesn't have return value described as it's from a generic job iterator, but you get the point
Natnael Teferi
@aethiop
So the upload is correct??
ignas-g
@ignas-g
Hi all, I am having trouble connecting to GUNDB RPC from chrome extension
getting this error
gun.js:1672 WebSocket connection to