curtisrutland / DIC-Editor-Shortcuts

A Chrome Extension to add keyboard shortcuts to the dreamincode.net text editor
0 stars 3 forks source link

Interested in using the dropbox api for settings? #8

Open curtisrutland opened 11 years ago

curtisrutland commented 11 years ago

Turns out, Dropbox has a "datastore api", which is basically simple tables that can store data on your account.

I just started playing with this for a different potential project, and I thought it was worth bringing up.

I think the current idea was to use localStorage, which is a great plan. But that limits us to a single browser; we'd either have to set our settings in many places or come up with some import/export feature. I think dropbox may be a good option. Maybe we could set it up in such a way that it stores settings locally until the user authenticates into dropbox, at which point it pushes settings to their datastore.

Anyway, this is just a question for now. We don't need to start working on this, but I'd like to get some feedback on the idea.

If you're interested, check out the tutorial here: https://www.dropbox.com/developers/datastore/tutorial/js

CasiOo commented 11 years ago

So you will need to authenticate and receive the datastore every time the user navigates DIC. I guess the OAuth access token doesn't survive the page navigation. Is there a way to make a script survive the navigation, so you only have to authenticate with dropbox/OAuth once?

curtisrutland commented 11 years ago

I'm not sure. However, I don't think that's going to be as big of a problem as you think. We shouldn't be injecting the settings code, there is a specific area for it in the manifest. Then it's only opened when you go to the settings for that particular extension. And we already have a background page for the copy/paste functionality (and you can pass messages between background scripts and injected scripts). So, in that case, we could move the functionality to run once when the extension is started (for initial syncing), to run whenever someone updates their settings, and perhaps on a fairly long timer (maybe once every 30 minutes or so, while there's an active D.I.C. page, which we could also track in the background page if we want.)

It would be a fun thing to try, but we definitely should focus on getting settings working at all before we worry about this.

CasiOo commented 11 years ago

Yes you are right. I did not know about background pages before right now.

Seems like my question has already been answered: http://developer.chrome.com/extensions/tut_oauth.html Background pages and google's OAuth to the rescue! They already did all the work, how nice of them haha