dper / smallpump

A bit of JavaScript to show a user's pump.io recent activity.
Apache License 2.0
0 stars 0 forks source link

Pull from real pump.io feed #1

Open dper opened 11 years ago

dper commented 11 years ago

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:

dper commented 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.)

dper commented 11 years ago

A recommended starting point in the pump.io code base: https://github.com/e14n/pump.io/blob/master/bin/pump-authorize

dper commented 11 years ago

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.

dper commented 10 years ago

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.)