AptUrlRedirector

There should be a simple Web service at apt.ubuntu.com that redirects (for example) the URL http://apt.ubuntu.com/p/abiword to apt:abiword. This works right now for Firefox in Ubuntu. It needs to work for other browsers, and produce understandable results when you follow the link on other operating systems. Current development can be found on the APTURLRedirector LaunchPad Project Page

Rationale

apt: protocol links provide easy prompts to install packages on Ubuntu. However, there are thousands of Weblog systems, forums, wikis, and other CMSes that do not handle apt: links correctly, and most of them never will. People publishing on these systems still want to be able to make it as easy as possible for people to install Ubuntu software from the official repositories. So, they need to be able to use an http: URL that does the same job.

User stories

  • Matt Zimmermann wants to be able to write an item on his Web site extolling the virtues of apt: URLs for making Ubuntu software easy to install, without giving up after “WordPress completely destroys the apt: links in this post.”

  • Someone providing help on Twitter wants to make it as easy as possible for the person they’re helping to people to install a particular package, despite Twitter not linkifying apt: URLs. (A few URL-shortening services do, but many don’t, and it’s tedious to work out which is which.)

Behavior

flow-chart.jpg

On any Web request, apt.ubuntu.com should first examine the request URL.

  • If it is /, the server should return a static “Ubuntu Software Center Web links” page explaining Ubuntu Software Center Web links, including instructions on how to make a link.

  • If it is of the form /p/packagename (where packagename consists only of valid characters for a package name), continue to the next step.

  • If it is anything else, the server should return an HTTP 400 error page, including instructions on how to make a correct Web link.

If the URL is of the form /p/packagename, the server should next examine the User-Agent: header to determine whether the browser is running on Ubuntu.

  • If it is not, it should return an HTTP 400 error page, “Try Ubuntu”, which briefly describes the Ubuntu Software Center and has a “Get Ubuntu Now” link to http://www.ubuntu.com/getubuntu.

  • If it is continue to the next step.

Next, the server should display an HTTP 200 “One moment…” page with an indeterminate progress animation, so that the user has something to look at while Ubuntu Software Center is launching.

Next, it should open the URL apt:packagename. The most reliable way of doing this is probably (but not definitely) a <meta http-equiv="refresh">.

Once that is done, a script in the “One moment…” page should wait a few seconds, then determine whether the browser window has any session history. If it does, it should go back one page (i.e. to the page that the apt.ubuntu.com link was on in the first place). If it does not, it should close the window (because the window that was opened solely to launch the Ubuntu Software Center, and this window should not hang around).

For all HTML, images, and CSS (but not JavaScript), the Design team will provide artwork and text.

Current enhancements

  • apt.ubuntu.com covers other already-existing apt: URL syntaxes, e.g. multiple packages in a single URL, or packages from a particular Ubuntu component.

  • Multiple language support via LaunchPad translations

Future enhancements

  • Extend the variety of apt: syntaxes to cover things like search results, departments, and/or vendors. Each would follow a three-stage process:

    1. Ubuntu Software Center handles the apt: link correctly

    2. apt.ubuntu.com redirects the equivalent link correctly

    3. Ubuntu Software Center generates the equivalent apt.ubuntu.com link.

AptUrlRedirector (last edited 2010-12-15 12:35:02 by mpt)