Open dper opened 11 years ago
An example of posting to a pump.io API using OAuth is here: http://www.jamesrobertson.eu/snippets/2013/jul/16/posting-to-the-identi-ca-api-using-o.html
That example does more than we need for smallpump, though. Smallpump doesn't have to write anything, so we should be able to use a modified and (perhaps) simpler version of the above. Also, smallpump is designed to be used in-browser, so there should be no confidential data lying around with it.
(It's also a ruby program, not JavaScript. But in many ways, it is similar enough to be a useful reference.)
A recommended starting point in the pump.io code base: https://github.com/e14n/pump.io/blob/master/bin/pump-authorize
This is not as simple as I would like. Because of cross site scripting issues, one can't easily pull from a feed on another server, it seems. As I understand it, then, this script needs to be used either (a) on a domain where pump.io is installed, or (b) with a server side script or cron job to get the feed.
A straightforward solution is to write a server-side script (using PyPump, for example), that periodically updates the JSON file. The JavaScript can refer to that, and there won't be any cross-site scripting problems.
(For DreamHost users, this is useful because DreamHost allows cron jobs but not daemons. Users can't run pump, unfortunately, but they can run scripts to get a little bit of data from a pump server. Probably many other web hosts have similar limitations.)
Right now, smallpump uses an example JSON file. It should be using JSON pulled directly from a pump.io feed as specified in
smallpump.html
. To do this, apparently OAuth is needed so the client (smallpump) can talk to the server.Possibly relevant sites: