Georepublic/localwiki_email_uploader — pull request #1 by philipn (2014-03-12 04:11:15+00:00)
Title: Api v4

I've done some work to make this work with the new LocalWiki and API v4. I've never written Ruby before, so this is a bit messy, but it appears to work in the cases I've tested it with.

The main functional difference is that posts are no longer made from the user's account and are instead made directly by the user associated with the main API key. This is because I do not yet see a way to securely allow the previous behavior: we can adapt the LocalWiki backend to allow superusers with API keys to post as any user (perhaps using a custom header), but the problem is that there is no way to authenticate the underlying email address, because email addresses can be so easily spoofed.

But this update should bring the script up to functioning status. It may need some polish, though. Other things worth looking at if this script is further developed:

* https://github.com/codeforseattle/localwiki_client Ruby LocalWiki API client (will be updated for the new LocalWiki soon by @sethvincent)

* https://github.com/localwiki/localwiki/issues/659 We are experimenting with a similar logic, build into the native LocalWiki interface. If and when we build this, it would be nice to expose this via the API so that clients like this can just `POST` to an endpoint with an image and some HTML and have all of the EXIF, etc stuff taken care of automatically.

* The region associated with the email client must be set manually in settings, but could also be inferred by looking at the location and doing a lookup in `/maps`, but i figure in this case this is the fastest way to get this running right now.