Mirrors and Prisms: robust site-specific browsers

Mozilla (amongst others, see Chris Messina’s writeup of the trend, also Matt’s) have been exploring site-specific browsers through their Prism project. These combine aspects of the Web and Desktop environments, allowing you to have a desktop app tuned for browsing just one specific Web site. Prism is an application which, when run, will generate new per-site desktop applications. Currently it does not yet have a fancy packaging/installer, so users will need to install Prism plus the site files separately.

I have started to look at Prism as a basis for accessing robust, mirrored sites, so that a single point of failure (or censorship) might be avoided. With a lot help from Matt and others in #prism IRC chat, I have something almost working. The idea is simple: hack Prism so that the running browser code intercepts clicks and (based on some as-yet-undefined logic and preferences) gets the page from a list of mirrors, which might also be fetched dynamically from the ‘net.

I should also mention that one motivation here is for anti-censorship tools, to give users an easy way to access sites which might be blocked by their IP address or URL otherwise. I looked at FoxyProxy as an option but for site-specific robustness, running a full proxy server seems a bit heavy, compared to simply duplicating a set of files. Here’s what the main Prism app looks like:

prism-gutenberg

Screenshot showing Prism config settings for a site-specific browser.

Once you have Prism installed, you can hack a file named webrunner.js to intervene when links are clicked. In OSX, this can be found as /Applications/Prism.app/Contents/Resources/chrome/webrunner/content/webrunner.js.

Edit this: _domActivate : function(aEvent)

I added the following block to the start of this function:

var link = aEvent.target;
if (link instanceof HTMLAnchorElement && !WebRunner._isLinkExternal(link)) {
aEvent.preventDefault();
WebRunner._getBrowser().loadURI(“http://example.org/mirrors/”+link.href,null,null);
}

The idea here being that we intercept clicks, and rewrite them to point to equivalent http:// URIs elsewhere in the Web. As far as this goes, it works as advertised. But what I have is far from working… it would need some code in there to find the right mirror URLs to fetch from. Perhaps a list might be fetched on startup or first time a link is followed. It could also do with some work on packaging, so that this hacked version of Prism plus some actual site-specific browser config can be made into an easy-install Windows .exe or OSX .app. For a Windows installer, I am told that NSIS is a good place to start. You could also imagine a version that hid the mirrored URLs from user’s view. Since Prism has a built-in option to completely hide the URL navigation bar, I didn’t investigate this idea yet.

OK I think I’ve written up everything I learned from the helpful folks in IRC. I hope this repays some karma. If anyone cares to explore this further, or wants to help target student projects on exploring it, please get in touch.

geo/photo raw materials from a walk around Bristol

I’ve just been for a walk around town, taking a few photos on the way, with the camera’s clock sync’d to that of my new GPS. I’ve not yet figured out the best tool to use (other than write my own) for hooking up the photo and location metadata. It’s easy enough to get the data off of the device using GPSBabel; for now I’ve saved tracks and waypoints in GPX format. GPSBabel offers a wealth of other options, none of which I’ve explored yet.

The first thing I had to hand that consumed GPX was Google Earth on my WinXP laptop; it plotted the tracks happily enough:

2004-07-24 walk around town, plotted via google earth

I’m sure there are other, more open-data and hackable systems out there that I can feed this data to, but for a quick test, Google Earth (formerly ‘Keyhole’) is quite fun.

For Windows users, there are WorldWind scripts that convert GPX into World Wind Layers, available as an online service. I’ve just tried that; it produced me XML document that references a PNG image. I need to read the instructions again a bit more carefully, but nice to see that there’s more to the world than Google. There are also some notes on the OpenStreetMap site on MakingGpxTracks.

The next thing I should try is getting the location and photo metadata integrated, and then I can play around with associating images on maps. There is also a growing geo-tagger community using Flickr (by creating odd ‘tags’ that embed lat/long data). For example see various of jip’s photos, and the geobloggers website (which seems to use HTTP REFERER to plot geotagged flickr images with Google maps).

Update: as I suspected, the Locative guys have already done the work :)

After CPAN-installing the Perl dependencies Image::EXIF and RDF::Simple::Serialiser, Time::Piece, LWP::UserAgent, XML::Simple, Data::Compare and Geo::Track::Log, it looks like geoloc_media.pl is just what I’m after (thanks!).

geoloc_media.pl 0 http://rdfweb.org/people/danbri/media/2005/07/ ../../mydata/2005-07-24-Tracks.gpx    danbri@foaf-project.org 2004-07-24-BristolWalk/*jpg

The resulting RDF looks about right, from a quick look.

Here’s a quick query of the data using the online Redland SPARQL service. The query I ran was as follows (basically echoing back the core data structure emitted by the perl script above):

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX locative: <http://locative.net/2004/packet#>

SELECT DISTINCT ?image, ?lat, ?long, ?email 
WHERE {
  ?x rdf:type locative:Packet .
  ?x locative:media ?image .
  ?x geo:lat ?lat .
  ?x geo:long ?long .
  ?image foaf:maker ?who .
  ?who foaf:mbox ?email . 
}
ORDER BY ?lat

See the Locative wiki for more uses of the data, including some nice SVG hacks. Or the OpenStreetMap view of the area (seems to be bitmap imagery there but no streets etc yet).