Earlier this week, Eye-fi announced they are discontinuing the online services for the "Pro" cards in favor of the new cloud-connected "Mobi" ones. Since my primary use of the Eye-fi card is to upload my photos to Flickr, I have no interest in paying for their cloud service. Time to look for another card! Most of the other wifi SD cards on the market come with an iOS/Android app, and basically all they let you do is view the photos from the app if your phone is connected to the card's wifi. Then I discovered the Toshiba FlashAir card, which has a developer site and encourages people to build things on top of the card.
What I really want is to "indiewebify" the SD card! My goal is to be able to plug it in, point my browser to the card, sign in using my website, and then have it upload all the photos I take to my website using Micropub. The FlashAir is an ideal card to accomplish this, since it provides the following:
- A built-in webserver that can host arbitrary html/js/css/img files, so that I can make a nice web interface.
- A server-side scripting environment (Lua) so the card can run code in response to HTTP requests.
- An event hook that will run a Lua script when a new file is written to the card.
Put all these together, and it should be possible to do what I want! So far I've just begun starting out, reading the API documentation and trying some things out.
I was able to make a custom HTML page that loads when the browser opens the card's URL, by creating a file called "/SD_WLAN/List.htm" on the card. I can write Lua scripts that run in response to HTTP requests by creating files like "/auth.lua" at the root of the card. It looks like query string parameters aren't available to the Lua scripts, but an HTTP "PUT" request from the browser can create files, so the access token can be saved to the card that way. I wrote a little test script that should run when the card boots up as well as when a new photo is added, but I have yet to see it run. I'm not yet sure the best way to debug that, since there isn't a lot of view into what's happening on the card.
Hope to get a chance to experiment some more soon!