In October I introduced custom interactors and someone asked what can be done with them other than application inspection.
Here‘s a practical application that turns Firefox into a screenshot server. It lets you request e.g.
http://localhost:4242/screenshot/http://en.wikipedia.org and receive a PNG screenshot of Wikipedia homepage. (Instructions to run it are at the bottom.)
Features and things to note:
- Every page is loaded in a new tab, meaning that multiple screenshots can be requested concurrently.
- You can have MozRepl listen to outside requests and thus have the server run on a machine (or machines) other than the one requesting screenshots.
.../getmail/http://mail.google.com?user=foo&password=bar, and so on, shouldn’t be too hard.
This is no finished product but it should give a hint of the possibilities. Known issues: since it takes the screenshot upon DOM load event, pages that use the same event to build sizeable portions of the document (such as iGoogle) might turn out incomplete or just white. Also, Firefox 3.1 seems to hang when the same browser instance is both the requester and the receiver of the screenshot (ok, not the most useful scenario, but still).
To try it:
- Get MozRepl, whether devel or stable branch doesn’t matter.
- Copy the source of the screenshot server to a file (e.g.
- In about:config, set
extensions.mozrepl.initUrl to the URL of that file, e.g.
file:///home/foo/mozrepl-init.js. (This file gets read whenever a new MozRepl session is started.)
- In about:config, also set
extensions.mozrepl.defaultInteractor to “screenshot”.
Tools → MozRepl → Start from the menu to start MozRepl.
- Point wget (or curl, or another browser) to Firefox with:
$ wget http://localhost:4242/screenshot/http://en.wikipedia.org
Update 2009-06-16: Adam has an HTML-to-PNG server with an improved version of the interactor.
It’s based on E4X, it’s extensible, and works in Spidermonkey 1.8 and Rhino 1.7. Rough docs are here. Enjoy!
After writing it in a couple of afternoons and letting it wait for attention (alas, in vain) for months, I decided to release purplebridge so that others may play with it. Quoting from the wiki:
purplebridge is a GUI-less client for IM networks based on libpurple that disguises as a local XMPP server. Once ready, an XMPP client will be able to launch it, connect to it, and through it reach the foreign networks supported by libpurple.
The wiki has more information about status and rationale.
Version 0.7 of SamePlace, the instant messaging client for Firefox, Flock and Thunderbird, is available.
It’s late over here, and I’m still on the lookout for subtle transition issues (who said that writing code is the hard part? Release engineers get all my respect…), so I hope you’ll forgive me if I spend some more lines at the server’s console and fewer blogging.
Packages are in the download section. In a few hours I’ll flip the switches to enable automatic update for those who are running release candidate or old stable. Uploads to addons.mozilla.org will follow shortly.
If you find any problems, post to the forum/mailing list or drop by the users’ chatroom (access it via Jabber or on the web). If you like SamePlace, consider supporting it; there’s no “Donate” button, but there are many equally precious things you can do: suggest features, report bugs, spread the word, tinker with the code.
After many, many weeks of “should be ready real soon now”, the new SamePlace web site and a release candidate of SamePlace Suite 0.7 are available.
The first thing you’ll probably notice about both is the user interface. Most of the merit for it goes to Andrea Cuius. I’ll talk more about this and the numerous other changes that happened under the hood in the release notes for 0.7.
If you find any glitch or problem in the release candidate, please take a moment to join the users’ chatroom (via web or via jabber) and tell me, or leave a message on the forum, or even file a bug.
Notice to feed subscribers: SamePlace-related announcements will be cross-posted on the usual section of the hyperstruct blog and on the SamePlace blog for a few weeks, then will move to the SamePlace blog. (I’ve also backported some past articles from the former to the latter.) Articles about the programming side of SamePlace will stay on the hyperstruct blog.