Dropbox file sharing

Hi, the dropbox support to import custom sprite is great. Do you think it would be possible to add support also for other types of files, like xml or other text/data files (adding also specific readData functionalities like the readImage already provided).

That would allow to import data configuration (like levels descriptor, ecc.) edited with other tools.

It should be possible to import sounds form dropbox.

@shrike this is something I’d like to add. We are still thinking about the right design for it.

Thanks @Simeon, it would be really wonderfull to have something like this. At now the only way I’ve found to handle a similar thing is to hack the lua sandbox (adding IO support) and add data files into a custom spritepack… but it requires to be connected to a PC to modify data files and it’s really unconfortable!

We’re going to run into this type of problem more and more…

If you just want to grab things, that’s easy - you can simply use the public link that Dropbox makes available via it’s web page. If you want to upload or delete - not quite as simple.

You can get to Dropbox via a RESTful API using http.get. Go to the dropbox site and sign up for an app https://www.dropbox.com/developers/apply and go nuts. Well, as nuts as you can with 5 users.

The problem is, that’s a pain - and all I really want to do is access my own dropbox. Presumably we could do that by having Codea act as a proxy for us - but is that wise? I’m not sure. One bad apple could cause issues and the only recourse Dropbox would have would be to invalidate Codea’s authorization, and that would be bad for everyone.

There is an impedence mismatch between the type of development TLL and Dropbox are talking about, and the type of devlopment Codea’s typical users do. I don’t know that there’s an easy solution.

(Aside - I looked into this for the game I’m forever making a while ago - I settled on github and agressive caching, but I was mainly looking for resource storage, with no need to write in-app. If you have to do that, the easiest way to go may just be setting up your own server… and even then, I’m not sure what you’d use to host a RESTful interface. That might be a fun research project…)

I’ve been digging, for fun. Does Codea even have full dropbox access? I suspect “no” is the answer, in which case my concerns about end-user abuse are probably unfounded. If you went a step further and provided Per-project access to folders within /Apps/Codea (ie. the “test” project has “/Apps/Codea/test”) it would be pretty neat.

And if you wrapped that all up in normal file I/O, mirroring that directory (so it’d be usable offline and sync back up when online), it would be totally insanely awesome (and Apple would probably come down like a ton of bricks, but I can dream).

Aside from all of this - I wonder how one would protect the application credentials in an open source app to begin with. Without that, this may only be useful as a stunt unless TLL does the proxy…

I actually got a call from the apple review team a few days ago and they were asking about an undocumented URL scheme, which they must have thought was us trying to get around the sharing restrictions, but it was actually just the URL that Dropbox uses for single sign-on. They do seem to be pretty thorough.

Hi @Simeon, have you change something about dropbox sync logic with Codea 1.4.1?

I’ve noticed only now that under Documents there’s a “Dropbox.spritepack” that mirror the synced Dropbox Codea App folder (including subdirs!).

Hacking tha LuaSandbox.lua that allows me to do exactly what I asked at the beginning of the thread, also using subfolders to manage project files (xml, images or whatever I need), and it’s fantastic!

That is the code I’m using

function getDropboxFile(fileName,folder)
    local home = os.getenv("HOME")
    local dir = home.."/Documents/Dropbox.spritepack/"
    if folder then
        dir = dir ..folder.."/"
    local _fileName = dir .. fileName
    local file = io.open(_fileName,"r")
    local res = file:read("*all")
    return res

and it requires just to comment out


in LuaSandbox.lua

@shrike The Dropbox.spritepack has been there since 1.4. And yes, feel free to change the sandbox if it helps you achieve your goals.

Hi @Simeon just one more question: the only way I’ve found to sync the dropbox folder is to open the spritepack/resource browser by tapping on a sprite() touch helper (or readImage).

Does it exist another way to sync or to open the folder browser window where there’s the sync button?

Try the cog icon (settings) on the main page

Hi @John, in the settings panel I see only the link/unlink option, not a synchronize one.

@shrike you’re right. There is no sync button outside the picker.

I was thinking to add an auto sync option (though that could be dangerous as it could overwrite your files). But a sync button in the sidebar would be useful too.

Hi @shrike, @simeon, I am having difficulty implementing what shrike mentioned. Where is luasandbox.lua located at in the new codea?