If something is no longer working, it means somebody probably trashed the account
please tell us on the chatroom so we can fix it.
@gilfuser Welcome to the community.
Some of the interactive tutorials and or third party tutorials seem deprecated. We know. Thanks for telling us.
I just uploaded a GunJS Starter Kit + Quickstart + Artificial Intelligence Pair Programming - which will sure help you a lot advancing your Gun knowledge. Make use of ChatGPT, it safes you a lot of time and you can ask him every part of the code and he will explain to you. https://github.com/amark/gun/wiki/GunJS-Starterkit---Quickstart---Artificial-Intelligence-Pair-Programming
@gilfuser
Yes that is in the documentation (look at the documents name 😂)
https://github.com/amark/gun/wiki/GunJS-Starterkit---Quickstart---Artificial-Intelligence-Pair-Programming#gun-relays-gun-works-local-first-even-without-a-relay-but-for-syncing-between-clients-you-need-a-relay
Easiest way to start. Clone Electron-Gun, follow the instructions in the readme and drop the noip address into both clients let gun = Gun('youraddresshere/gun')
should look like this: let gun = Gun([https://yournoipdomain.com/gun])
PS: in my example codes i use let db = Gun();
, just you dont wonder! The name of your Gun instance is free to choose.
NoIP? Sign-up, download client, drop/extend the above line.
https://github.com/worldpeaceenginelabs/ELECTRON-GUN#make-your-desktop-gun-server-available-from-the-outside-centralized-way-for-development-fallback-or-scaling-eventually
localStorage.noTest=1
.0.202
returned back with GUN.version
. (You mentioned finding out the version here for example amark/gun#1307)
@amark Hey Mark, what do you think about this? Huge security and availability improvement i think. One could do it with any piece of data that has no time pressure at on-boarding/creation. As soon as its uploaded, its real-time again.
Take a look at the storage 🤯
Pages uploads each file on your site to Cloudflare’s globally distributed network to deliver a low latency experience to every user that visits your site. Cloudflare Pages sites can contain up to 20,000 files. The maximum file size for a single Cloudflare Pages site asset is 25 MiB.
@amark
i see here a huge potential for production setups were persistant storage (e.g. AWS S3, SQL, Mongo, CockroachDB, IPFS...) could be completely replaced by edge dropping. Plus security improvements (these 200 edge servers are almost fort knox)
https://github.com/worldpeaceenginelabs/GunJS-AUTH-SIGN-UP-LOGIN-LOGOUT
Gun Auth is a nice template to start your Gun app. It does what the name says and manages your session.
(documentation says passwords are encrypted PBKDF2, still not sure if thats enough security)
@amark Is it enough security this way? Or do we need SEA here? (asking only for sign-up, login!!! NOT data, thats user.get().put() plus SEA.encrpyt/decrypt if we want encrypt/decrypt data)
I have thousands of long/lat pairs in my database: example {long: 50.0, lat:14.0}
My user's position is {long: 50.0, lat:14.0}
Now i need all records containing long/lat which are: not more or less than 0.3 of long, and the same for lat
Good: 50.3 / 13.7
Bad: 49.5/ 14.4
Which is faster? Gun's lexical search or typical local searching the data for numbers not higher, lower than 0.3?
I guess lexical is more efficient in the way that it downloads only the results?
ajv
is a good one & combined with the open extension .open(data => if(!ajv.check(data, 'schema')){ return } // normal code
now your code only executes if its operating on your specific application integirty/validity, which is higher order.domain.com/gun/package.json
or load any other gun repo file, but that'll show you version it is running.@amark
ChatGPT: Then maybe next time i will add he should not use code sources older than 2020 or so?
I actually want to leave the geo specific stuff away and just search records by the numbers(which is simple and efficient. 0.01 is 1 km). to search my data for a range n+-0.3 shouldnt be a problem, or is it?
(How big is the data? a post has max 1000 characters + 50.0000000/14.0000000 (7 digits accuracy) = so 1 record is max 1.02kb)
but what is the user-account replication strategy? user.create stores locally and to the relay i guess? but since i am be able to login from every other device on that same relay, user-accounts seem to be somewhat distributed "everywhere"???
What if the relay runs full? any Gun logic already built in?
Would a lexical or binary search from my client, search records on the relay and or other clients, before it decides to sync/download them? or does gun.get('chat').get({'.': {'*': '2019/06/'}}).map().once(cb)
first download ALL 'chat' messages and then show only the 2019/06 ones?
RAD is cool. i like the concept of the reusing the same data like in Alex and Alexandria. Is there a number? like if you have 1TB of RAD data, you safe a median of X GB?
@amark
get(hostposts).on(data)
.Meanwile the record gets deleted from our relay, or even the relay is wiped and starts from scratch. Can we receive the post record with get(hostposts).on(data)
stored locally at user a b and c now? till their local record is a copy of the original synced data? like a cluster recovery after relay wipe, kind of?
PS2: Could a relay maybe recover in the way, that since our clients did not receive a delete order, but the relay is empty, the relay starts now to re-sync from the clients local storages again?
Kind of a record could or maybe already does contain data about its sync state related to relay vitality.
If we could identify a relay wipe, this could be also a good mechanism/strategy to re-cover our user account records. since everybody seems to store the whole or big parts of the user accounts data, a wiped relay could re-sync the user accounts by re-chunking from all clients.
definitely want to make use of cheap services like that, but can't be vendor locked into that. Most storage engines are s3-API compatible, so all those systems are already open/interoperable :thumbsup: . Tho the other dweb/blockchain projects can't handle GUN's thruput even when throttled for storage writes. :/
Edge functions are not a security thing.
its basically a 500gb HTTPS harddrive, distributed around the world.
its like uploading encrypted files to your homepage or ftp server.
You can write only 500-5000 times per month.
But you can read your data with highspeed from 200 locations world-wide.
I dont see the vendor lock: you just upload whatever files to github, github syncs with cloudflare (or any other provider), cloudflare does the build and distributes to the edge network. (it doesnt have to be an app, you can also just upload static folders)
Just an idea: I was thinking about rendering the complete state of actual relays, but static on edge. (like a relay full of frozen spaces maybe?)
Simple method: maybe just dropping the Radata folders of actual relays on edge and register them as peers? (permanent storage?)
Maybe you could drop us a setting like https://gunrelay.com/guns/ (s for static, no inbound syncing) @amark
(or maybe just not using .put on this special relay would already do the job without any modification??? is it possible to specify which relay a .put calls to or rather which to exclude from .put?)
The security is that you can only upload/modify from your secure CI/CD. (mine is highly secure, strong passwords, 2fa, secret encryption, https strict pulls, ddos protect etc.) Definitly not less secure than any other server. You could further restrict the access to the edge page's domain etc. but the private data in radata folders is encrypted anyway.
PS: You can update the data incrementally(on Github), but builds to edge are whole(standard-setting), like wipe and then install new, but seamless.
But incremental cloudflare builds are also supported, but need some settings.
Here is latest demo and files:
https://codeberg.org/ahg/gun-demo
Prompts could be ignored if you want test with a generated SEA.pair and without a gun relay.
Testing gun data binding gun to dom and dom to gun. Add and delete persons (demo de-/encrypt persons for the current user.
Persist pair AND current gun relay to localstorage from console is possible: rememberMe()
Current logged in user is user1
. jGun instance is variable $
Are .put
s instant for the user since gun is offline-frst? So putting and getting in the following line okay to do? Been using .then()
but running into a lot of never-ending awaits and I'm wondering if it's because I'm using them on .puts
.
Making unit tests is a lot nicer when you write synchronous code imo