amark / gun

An open source cybersecurity protocol for syncing decentralized graph data.
https://gun.eco/docs
Other
18.07k stars 1.16k forks source link

Storage exceeding quote #590

Closed mitra42 closed 5 years ago

mitra42 commented 6 years ago

Seeing this error in the browser console log while retrieving. The retrieval is going through our "hijacker" at the server, but shouldnt be seeing this.

Failed to execute 'setItem' on 'Storage': Setting the value of 'gun/' exceeded the quota.

mitra42 commented 6 years ago

See https://github.com/internetarchive/dweb-archive/issues/46

rebootcode commented 6 years ago

I believe the allowed permission-less storage capacity of the browser on the desktop is only 50mb and in mobile is 5mb.

Beyond this, you will need permission from the user to store access data.

robertheessels commented 6 years ago

You can now opt in to use IndexedDB, which has virtually unlimited space (up to half of free disk space). See lib/rindexed.js

amark commented 6 years ago

Yeah, quick (temporary) example of how to add it to the browser:

https://github.com/amark/gun/blob/master/test/tmp/indexedDB.html

mitra42 commented 6 years ago

I think it needs a solid solution from you @amark, something easily included either within a single Gun script, or "required" into a combined app (that includes GUN). At the very worse there should be an option <script ".../gunForBrowsers.js"> and require "Gun"; require "GunForBrowsers" The latter is going to be needed anyway by any library that uses GUN (such as dweb-transports, since the library cant itself know if its going to be used in a browser or in node.

mitra42 commented 6 years ago

P.S. I don't mind if something pops up on the browser Asking for permission, at the moment I suspect most apps will fail silently at this point (dweb-archive app just switches back to http when gun starts failing)

amark commented 6 years ago

Totes agree, it is easy enough for anybody in the community to add a build script to bundle them together, then it'll be a 1-line drop in. I just don't have time to waste doing it myself cause it takes me 10 hours to figure out how webpack/gulp/junk work (I wasted 3 hours the other day on some stupid gulp/babel problem), but I'll more than super happily accept a PR since others seem to be able to do it in 5 seconds "easily".

mitra42 commented 6 years ago

It would help if the example at https://github.com/amark/gun/blob/master/test/tmp/indexedDB.html was understandable, on the phone we clarified that jquery wasnt required and looks like that is removed. but I can't figure out ...

var opt = {};
opt.store = RindexedDB(opt);
var gun = Gun(opt);

Does this mean I have to call RindexedDB to get the options to pass to Gun, and having opt on both sides of that middle statement looks really weird. It clearly can't work this way in most apps which will include the libraries in one place and now can no longer pass a typical opt dictionary to Gun at startup since if I read the above code-fragment correctly I have to call RindexedDB to get something to pass t Gun, and RindexedDB is not going to be in scope at the level the opt dictionary is being built.

mitra42 commented 6 years ago

To be clear ... even if you follow the instructions in https://github.com/amark/gun/blob/master/test/tmp/indexedDB.html in node, they don't work. RindexedDB isn't defined, and it doesnt work if you do the obvious correction of var RindexedDB = require('gun/lib/rindexed.js') because opt.store = RindexedDB(opt) fails with window is not defined.

mitra42 commented 6 years ago

Note ... questions were asked about this on Gitter, without any reference to this issue, so copied below since chance of finding on Gitter are ~0% :-)

Mitra Ardron @mitra42 11:43 @amark Sorry - just saw your question a couple of days ago. Note I’m not watching this gitter chatroom as covers too many topics so I can’t just watch issues I’m following. You asked: "Help me understand - IndexedDB is a browser technology, not a NodeJS library. Is the goal the thing we talked about yesterday about... writing it in a NodeJS syntax so Webpack packages it in a single bundle? But it is crashing?” I’m not sure what that was in reference to … but .. The goal would be to have a single script that could be included (either including, before, or after the Githubissues.

  • Githubissues is a development platform for aggregating issues.