cryptoboid / splitio

split your bills easily! splitio is an open-source webapp built for tracking debts and payments quickly, without any user accounts. works as a splitwise-clone
https://splitio.vercel.app/
GNU Affero General Public License v3.0
88 stars 13 forks source link

JSON export? #4

Open chmac opened 2 years ago

chmac commented 2 years ago

I've created a couple of groups, and I'm slightly worried that people in the group will accidentally mess with the data, delete stuff, or whatever. It would be great to have a JSON export of all the data for a group (plus probably an import option). But, maybe this is unnecessary with GunDB, perhaps the history is always visible with GunDB, I'm not sure.

Also, I'm happy to put some time into some of these feature suggestions, I'm not super familiar with Svelte or GunDB but I have lots of frontend TypeScript experience.

cryptoboid commented 2 years ago

Hmmm, this one is a bit more difficult. For now, Gun stores the data in localStorage, so you could grab that and decrypt it with the group key (the string after the # in the URL). It would be good to have some way to export info from splitio, because I also have my doubts about data consistency with Gun. The data history is not visible with Gun, only the current state.

This is my first time with Svelte and Gun too! Svelte is super easy to pick up, you should try it out. I'm trying out Typescript also, so I need some help defining types, interfaces and that kind of stuff. Currently the code looks more like JS than TS 😅

chmac commented 2 years ago

I'm most familiar with React, but I've read a bit about svelte.

If there's any specific topics you're looking for help with types, feel free to create issues and either assign them to me or mention me and I'll try to lend a hand.

chmac commented 2 years ago

What about a plain text export instead? Just a quick way to see all the data (including the computed balances) as a single string. It could also be a "snapshot" feature, to capture into localStorage or so. My personal experience is that localStorage is nothing like as persistent as my own filesystem (mobile or desktop). I'm always nervous of leaving any data I actually care about only in localStorage.

chmac commented 2 years ago

@cryptoboid If you'd be open to pointing me in the right direction, I'd be down to put some time into this. We do quite a few collective expense events, and I now find that I can't get back to the 2 groups I created in the past. Their data just never loads. At least on mobile. Personally, I don't trust localStorage for the long term, and I'm happy running my own servers, so this topic becomes a significant blocker for me using splitio on every project.

cryptoboid commented 2 years ago

Hi, so, I've just pushed to dev an inspector page. Try inspecting your group by replacing like so: https://splitio.vercel.app/g/XXXXXXXXXXXXXX#YYYYYYYYYYYYYYYYY -> https://splitio-dev.vercel.app/inspector/XXXXXXXXXXXXXX#YYYYYYYYYYYYYYYYY

(add -dev and replace g with inspector)

For now it just shows parsed info from localstorage, indexeddb and optionally gun. You will find that local info is encrypted, but it may be useful at least

chmac commented 2 years ago

@cryptoboid That's awesome. Any chance to deploy it on the production domain also, then I could inspect my localStorage, etc for live groups.

cryptoboid commented 2 years ago

Already in production! You can test it in https://splitio.vercel.app/inspector/XXXXXXXXXXXXXX#YYYYYYYYYYYYYYYYY

cryptoboid commented 2 years ago

update: so, I've found an old group where this same behaviour happens. Strangely, (and luckily!) all info is still available in the indexedDB (and localStorage too, it was an old group) but Gun isn't picking it up for some reason. That means we can have a recovery mechanism that recreates the group data :) bad news is that it would require reverse-engineering gun's storage code, which will be super annoying, but at least we have some hope

nope, got confused by older info, it isn't there. Have you found your group info in the inspector?