1j01 / jspaint

🎨 Classic MS Paint, REVIVED + ✨Extras
https://jspaint.app/about
MIT License
7.23k stars 564 forks source link

Demo instance hit Firebase quota #68

Open zezic opened 6 years ago

zezic commented 6 years ago

Sadly, I see messages about Firebase quota on http://jspaint.ml instance. Can we have any workaround features for keep multiuser working? Maybe, feature to enter own Firebase credentials for small session with friends? Or RTCDataChannel solution?

1j01 commented 6 years ago

Yeah, so RTCDataChannel would be an interesting way to do things, but it would basically be a full rewrite of the multi-user code. (Not necessarily a bad thing, but not high priority, for sure.)

Entering credentials to an arbitrary Firebase instance sounds like a good short term solution. It might be a little awkward, since Firebase is normally set up once early on, but it should be doable. Should make sure it's not against the TOS tho. (...doesn't look like it)

I would say, the most pertinent thing is to get some error handling in there for the case of hitting the quota limits. Although the console only logs a warning, which is worrying - hopefully there's a way to handle it! (...there's storage/quota_exceeded listed as an error code in their docs. maybe I'm just not handling an error.. or.. if I recall, their API kinda doesn't encourage you to do error handling at all) (...nope, that was the wrong page. that was for Storage, not the Database - confusing! and the search gives no similar page for handling errors for the Database.)

1j01 commented 6 years ago

It looks like they added error handling in a later version, but also the later version makes this particular use case uglier - "awkward" as I was saying. Apparently jspaint is on an older version of the API, (which makes sense; it's an old project), in which it wouldn't be so ugly. So in other words, it would be less ugly in the current, older version, but there's no error handling support. Tisk, tisk. Best to get it over with though, rather than creating a reason not to upgrade. I didn't notice I was using a wrapper. Fooled by my own abstraction.

1j01 commented 6 years ago

Any issue is more interesting with an image :)

"Your database has been disabled due to exceeding your downloads limit — upgrade to ensure there is no service disruption"; 404.9 GB / 10 GB

"404.9 GB / 10 GB"

1j01 commented 6 years ago

Added a visible message at least, in https://github.com/1j01/jspaint/commit/1ca9cc331083fd8f9106e356e4aaa2aacdef182f I can't seem to find any docs on error handling though, so it's just displayed regardless 😣

Mycah commented 6 years ago

Can you split off the firebase config to a config file, so we don't have to branch or merge when changes occur?

1j01 commented 6 years ago

@Mycah As far as I know, not without switching away from GitHub Pages (assuming you mean keeping it outside of version control)

But I could do what @zezic suggested and allow you to enter your own Firebase credentials at runtime, and we could even persist them. We'd just have to hope Google/Firebase doesn't go "hey, what's going on here? what's with all these apps pointing to the same domain?"

..well, I guess if you're cloning it locally, we could have the default Firebase config, and then a separate one that overrides it that you create, and then you can set up Firebase for running on localhost ..so yeah, we could do something like that

keep in mind though, that the multi-user support was pretty garbage

1j01 commented 6 years ago

Oh hey... *psst* there's more quota now (start of the month)