View Single Post
Old 03-18-2011, 02:48 PM   #1
Xiaopangzi
Enthusiast
Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.
 
Posts: 29
Karma: 16912
Join Date: Mar 2011
Device: kindle k3, prs-t2
Lightbulb Web server, user interfaces

I'm attaching an arm binary executable of a tiny http server called bozohttpd (see http://www.eterna.com.au/bozohttpd/ for details), compiled with directory indexing and cgi support but without ssl support. I find this to be extremey handy to have on the kindle.

A possible quick-start would be to mkdir /mnt/us/www, put some content there, and start the server using bozohttpd -b -X /mnt/us/www (from the command prompt in an ssh session, from a launchpad ini, from /etc/rc...). For cgi support, mkdir /mnt/us/www/cgi-bin and add -c /mnt/us/www/cgi-bin to the options.

For example, I keep a web bookmarks file (same html-formatted file in /mnt/us/documents as .txt and in /mnt/us/www as .html) that allows access both from the kindle's home screen and bookmarked within the web browser.

If you want the web server to be accessible from the outside world, open port 80 in the kindle's firewall. Bind-mounting /mnt/us/documents somewhere under /mnt/us/www/ would allow you to share your books and other documents over wifi.

However, the most useful application of this appears to build user interfaces using cgi. At present, the options to launch and interact with applications beyond what the kindle framework itself allows are limited. Launchpad works fine for many applications, but sometimes a user interface going beyond blind keypresses is desirable. For example, a playlist of local audio files and remote streaming urls could be presented as a list of clickable links (static or generated on the fly by a local cgi script), launching mplayer with the right options (from the same or another local cgi script). Unlike for the blind keypress interface, there would be nothing wrong with having hundreds of audio files or streaming urls visually filling a few web pages.

Static html files with clickable links to launch or control local applications via cgi scripts could (in addition to an .html in /mnt/us/www) live in a .txt file on the kindle's home screen. Clicking a link will launch a cgi script that can perform any action and then generate html-formatted output as a response to be presented to the user in the kindle's web browser. Dynamically generated html content like on-the-fly playlists needs to be viewed inside the web browser. In all situations, wifi needs to be enabled.

The potential benefits of doing this look very promising to me. I'm not a web programmer and don't have any useful scripts at this time, but I invite the forum members to consider this technique and to expand on it. In particular, I would like to see a useable frontend for mplayer.
Attached Files
File Type: zip bozohttpd.zip (20.3 KB, 466 views)
Xiaopangzi is offline   Reply With Quote