jaw-sh / stream-nexus

Unified multicast stream chat overlay.
27 stars 7 forks source link

Very basic persistence for super chats #22

Closed cohlexyz closed 4 months ago

cohlexyz commented 9 months ago

Backs up super chats to ./super_chats.json every time a new one is received. Will load them on next startup if the last modified time of the file is more recent than 15 minutes ago. Should assure that super chats can be recovered after a crash and prevent chats from an older session being loaded.

Not really the most elegant solution but it works. Closes #20

y-a-t-s commented 4 months ago

What about storing them in the browser's local storage? You could push any new superchats you process in the overlay to an array, stringify the array, then write it to localStorage. All the saving and loading could be handled through pure JS and browser APIs.

You could still write them to the .json file as well for redundancy.

cohlexyz commented 4 months ago

The initial version of the dashboard did that but as per https://github.com/jaw-sh/stream-nexus/pull/10#issuecomment-1788185637 I got rid of it. I think that Josh is right in that the server should save the data and the browser just displays it.