HelloZeroNet / ZeroNet

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network
https://zeronet.io
Other
18.37k stars 2.27k forks source link

IndexedDB support (or LocalStorage with IndexedDB backend) #1732

Open anoadragon453 opened 6 years ago

anoadragon453 commented 6 years ago

Some sites, like Riot.im, use IndexedDB as while LocalStorage provides similar functionality, the 5MB limit on LocalStorage is too little for some sites to operate.

A while back Riot.im switched to using IndexedDB and things have generally been good. However, this means that even though Riot.im is a static website and could easily be ported to ZeroNet, a lot of refactoring would have to take place as ZeroFrame doesn't provide any API to interface with IndexedDB. So, perhaps you could add a call for it?

Alternatively, you could keep the current API but use IndexedDB as the backend. This way people could just use the familiar LocalStorage method, but wouldn't have to worry about hitting the 5MB limit.

Unless there's no limit on localhost?

Thunder33345 commented 6 years ago

Unless there's no limit on localhost?

still need a bypass for people who use proxy/single device as zeronet proxy

anoadragon453 commented 6 years ago

Alright, so after doing some research on IndexedDB it seems to have a completely different API to LocalStorage, with the ability to query and store blobs and what have you.

Thus it looks like a new API would be best, but hopefully it wouldn't be too hard to implement as again you're just passing input to the browser.

still need a bypass for people who use proxy/single device as zeronet proxy

Oh huh, does this not work currently? Only worry would be security, and making sure a zite running locally couldn't pretend to be a proxy then jump out and start reading all other local zite data.

Thunder33345 commented 6 years ago

Oh huh, does this not work currently? Only worry would be security, and making sure a zite running locally couldn't pretend to be a proxy then jump out and start reading all other local zite data.

that's referred to

Unless there's no limit on localhost?

i am assuming you meant localstorage limit is exempt when the visiting address is localhost, and i am trying to make the point that some people dont access zeronet via localhost,(ignore what follows after if you understand this statement) it can be a proxy or a private proxy which then wont use the localhost address to access zeronet but something else, thus the localhost limit is not applicable, in turn the site wouldnt work as expected due to running out of storage unless it was running on localhost

anoadragon453 commented 6 years ago

Good point, yeah

anoadragon453 commented 6 years ago

So perhaps the LocalStorage command should be implemented in IndexedDB then because you could have two sites that think they can use 4/5MB but in reality they end up hitting the 5MB limit together.