Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store user preferences + stars in firebase instead of localstorage #83

Open
theRealPadster opened this issue Dec 22, 2021 · 7 comments
Open
Labels
💫 enhancement New feature or request 🚦 hold On hold. Blocked or waiting. 📨 proposed

Comments

@theRealPadster
Copy link
Member

Just an idea. Not sure if feasible. We could have a table with users and their preferences (e.g. tabs, stars enabled, etc). This would be linked with their Spotify username/id or something. That way you can have the same marketplace experience on multiple computers.

@CharlieS1103
Copy link
Member

@CharlieS1103
Copy link
Member

We need to determine the database structure, is it better to store the individual users and which themes/extensions they've liked in an object for the user, or is it better to store the themes and extensions with all of the users who liked them? We may have to do both.

@theRealPadster
Copy link
Member Author

theRealPadster commented Feb 6, 2022

So I just realized a pretty huge issue with this. We can READ data fine, but if we want to WRITE data (e.g. when a user stars a theme), it will need to have our Supabase/Firebase credentials stored in the publicly-accessible code, which would allow anyone to do whatever they want to it. To get around this, we would need a private server that has the actual Supabase connection, and then POST data to it from within Spotify when we want to send anything.

@theRealPadster
Copy link
Member Author

theRealPadster commented Feb 6, 2022

More notes on that issue:

  • We could make a free Heroku account, which has 550h (~23 days) free dyno time. With a credit card verified, that jumps to 1000h. We would need 744h for 31 days.
  • Then we could publicly host the server code on GitHub, and use Heroku's config vars to keep the Supabase credentials secured.
  • We would also need some sort of DOS protection, since all the write requests would be going through our single (free, not professional-tier) server.
  • And we'd want to rate limit by IP or something, so people can't just generate random user ids and boost their stats.
  • So, it gets pretty complicated, pretty fast.

@FlafyDev
Copy link
Contributor

FlafyDev commented Feb 6, 2022

So I just realized a pretty huge issue with this. We can READ data fine, but if we want to WRITE data (e.g. when a user stars a theme), it will need to have our Supabase/Firebase credentials stored in the publicly-accessible code, which would allow anyone to do whatever they want to it. To get around this, we would need a private server that has the actual Supabase connection, and then POST data to it from within Spotify when we want to send anything.

There are ways to authenticate users so they won't do whatever they want https://supabase.com/docs/guides/auth

I don't understand what you mean

@theRealPadster
Copy link
Member Author

Usually there is some sort of API key, connection string, or secret, or something, to actually initiate the database connection. So it knows where the database is and is able to write to it. If those are in the code, anyone would be able to use them to write their own code and do what they want, no? Or are you saying since it's hosted, we just need some identifier for our database, and it handles stuff with user logins automatically?

@FlafyDev
Copy link
Contributor

FlafyDev commented Feb 6, 2022

Usually there is some sort of API key, connection string, or secret, or something, to actually initiate the database connection. So it knows where the database is and is able to write to it. If those are in the code, anyone would be able to use them to write their own code and do what they want, no? Or are you saying since it's hosted, we just need some identifier for our database, and it handles stuff with user logins automatically?

Yeah, only the creators have access to the database's content. So people won't have access to other people's API keys

@theRealPadster theRealPadster added the 🚦 hold On hold. Blocked or waiting. label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💫 enhancement New feature or request 🚦 hold On hold. Blocked or waiting. 📨 proposed
Projects
None yet
Development

No branches or pull requests

3 participants