Kiwi

This is "kiwi", a wiki with a twist - by Coen Siegerink - October 2001

The sources are now at https://www.equi4.com/pub/etc/kiwi.tar.gz

QUICK SETUP INSTRUCTIONS

These one-letter areas have different uses:

Basically, the "payload" right now is more or less a classical wiki. But through commands in the u/ area, all scripts driving the wiki can themselves be edited over the net. The thing about kiwi is that it allows nearly 100% self-modifcation over the web, i.e. not just the wiki pages, but also the scripts implementing it all.

The w/ area is public. The u/ area *may* have Apache-style access control to restrict access to viewing and altering things such as the wiki in the w/ area.

The x/ area *must* be protected, it contains scripts which can do a lot of damage when used improperly. These scripts are only needed to "go in" and fix files when the kiwi system itself does not work.

HOW TO GET STARTED

To use the wiki, and that includes editing/adding pages as usual, start from the URL "http://<yourserver>/w/"

To look under the hood in kiwi use an URL which ends in "/u/<cmd>". There are currently just a few basic ones defined:

    /u/show	Display some info at what Tcl scripts can see/do
    /u/edit	Launch form-based editor for objects stored in Kiwi
    /u/run	Enter and run a single Tcl command
    /u/jcw	Custom handler (also used for "/u/jcw/*")

For example, in the editor you can edit various pieces:

    modules/u.tcl	- is the editor script itself (careful!)
    modules/w.tcl	- is the central code of the wiki in w/
    modules/u-jcw.tcl	- processes "/u/jcw/*" (add more as needed)

Enter a new name to create a file, or save as empty to delete one.

Or you can fool around by entering Tcl commands in /u/run, such as:

    puts "Hi!"
		gee, it talks
    package names
		list known packages
    ::u::edit
		start the above editor, but from the runner
    while 1 {}
		gets killed after a few secs of CPU clogging
    set x x; while 1 {set x $x$x$x$x$x$x$x$x$x$x}
		returns even quicker, as it hits the memory limit

For checking server config, there is a "/u/echo.cgi" which bypasses kiwi and simply shows info about how Apache starts up a CGI script.

WHERE AND HOW THINGS ARE STORED

Apart from a few bootstrap files, everything is managed through a separate "Tequila" server process, which runs permanently in the background. Each incoming requests launches a CGI which connects to the server. For now, only a few of Tequila's capabilities are exposed - i.e. a basic fetch/store/delete/enumerate API:

    qget <dir> <file>   ==>   <data>
    		fetch the specified file
    qput <dir> <file> <data>
    		create or replace the specified file
    qdel <dir> <file>
    		delete specified file
    qall <dir> ?*?
    		list all files in dir matching the pattern
  Directories currently in the system are:
    modules	contains scripts which can be loaded as needed
    packages	more scripts, available through "package require"
    wiki/pages	the current pages stored in the wiki

NOTES

Right now, directories have to be created outside the system, as the current setup cannot yet create or clean them up.

The "qdel" command will probably be dropped. Instead, storing an empty file will be treated as a deletion. Likewise, fetching a non-existent file will return an empty string, instead of failing.

The real power of Tequila has not yet been tapped, i.e. the ability to interface entirely through arrays, and automatically propagate changes to all connected clients. Once that is done, qget et al will no longer be needed as much.

This is work in progress, comments to <[email protected]> are welcome.