Bam! Two new gwit clients


In April 2024, I mentioned in the post “gwit implementations” that gwit had no working clients yet. This may have been a big stopper since the project's inception for people piqued by it, since an intro site and a harsh specification don't leave much room for experimentation. This has been the case… until now! In less than a week, we've seen *two* gwit clients pop up in the gwit-spec mailing list: Matograine's Wet and my own gwish.

gwit implementations
Wet, a minimal gwit client based on libgwit
gwish, a gwit client written in POSIX shell

Wet is written in Python as an interface to libgwit. It is quite featureful and friendly for such a brand new command-line program, which is an impressive feat. It allows getting the content of a gwit URI, figuring out site remotes to mirror the site if other sites which were already mirrored/visited provide introductions for it (otherwise, a remote URL may be specified). Wet can also handle relative links (given a context URI), and it has some interesting support for petnames. Here some usage examples:

$ # Get a URI, first mirror the site from the given remote URL.
$ ./wet.py get gwit://0x408198c2c363076c6b1eabe797ea3168a78cd65a \
               -r https://git.sr.ht/~ivilata/oldest-gwit-site
[…]
# The Oldest gwit Site

Welcome! This is a site about gwit, […]
$ 
$ # Get another URI from the same site (use existing local mirror).
$ ./wet.py get gwit://0x408198c2c363076c6b1eabe797ea3168a78cd65a/log/_en/
[…]
# The Oldest gwit Site
## Log
[…]
$ 
$ # Get URI from another site (mirror from remote learned from previous site).
$ ./wet.py get gwit://0x16c8a566bb88303c2513cf6328996d46e0440e85/
[…]
# Matograine

Bienvenue sur mon site ! […]
$ 
$ # Get link relative to last retrieved URI.
$ ./wet.py get blog/
[…]
# Mon blog

Articles divers, d'été et d'humeurs. […]
$ 
$ # Show info about previous site, search by petname.
$ ./wet.py show Matograine
Matograine - 0x16c8a566bb88303c2513cf6328996d46e0440e85
-------------------------------------------------------
- desc:   Matograine's Blog
[…]
$ 
$ # Get link relative to a site, search by petname.
$ ./wet.py get -p Matograine /blog/
[…]
# Mon blog
[…]

In contrast, gwish is intended (as per the aforementioned post) as a test of example commands in the gwit spec, and as a reference implementation regarding spec adherence. It's written as a single POSIX shell script for maximum portability, tested to work on +10-year-old setups. It offers a more low-level set of tools, still limited to core repo handling: creating & updating a local site mirror from several remotes, verifying content & handling history rewrites, and accessing configuration. Some usage examples:

$ # Mirror a site given its ID and a remote URL.
$ gwish mirror 0x408198c2c363076c6b1eabe797ea3168a78cd65a \
               https://git.sr.ht/~ivilata/oldest-gwit-site
gpg: Signature made Thu Dec 12 17:39:28 2024 UTC
gpg:                using RSA key 408198C2C363076C6B1EABE797EA3168A78CD65A
gpg: Good signature from "Degauss (The Oldest gwit Site) <degauss+togs@selidor.net>" [ultimate]
$ 
$ # List site remote URLs (taken from configuration, can be changed).
$ gwish remotes 0x408198c2c363076c6b1eabe797ea3168a78cd65a
https://git.sr.ht/~ivilata/oldest-gwit-site
https://elvil.net/git/oldest-gwit-site.git
$ 
$ # Update site from its remotes (will ask if a history rewrite is detected).
$ gwish update 0x408198c2c363076c6b1eabe797ea3168a78cd65a
INFO: Updating from remote: https://git.sr.ht/~ivilata/oldest-gwit-site
INFO: Updating from remote: https://elvil.net/git/oldest-gwit-site.git
$ 
$ # Get a configuration item from the site.
$ gwish conf 0x408198c2c363076c6b1eabe797ea3168a78cd65a name
Oldest gwit Site
$ 
$ # Clone the whole site to a working tree to access its files, history…
$ gwish clone 0x408198c2c363076c6b1eabe797ea3168a78cd65a TOgS
Cloning into 'TOgS'...
done.
$ ls -A TOgS/
.git  .gwit  .well-known  LICENSES  index.gmi  index__en.gmi  log
$ 
$ # Use Git commands for low-level hacking (here dump one file, no checkout).
$ gwish git 0x408198c2c363076c6b1eabe797ea3168a78cd65a \
  cat-file blob HEAD:index.gmi
# The Oldest gwit Site

Welcome! This is a site about gwit, […]

gwish may also help you create your own gwit site, by checking whether a local Git repo fulfils the requirements of a gwit site and reporting any issues, like this:

$ gwish check 0x408198c2c363076c6b1eabe797ea3168a78cd65a \
              ~/vc/git/oldest-gwit-site/
gpg: Signature made Thu Dec 12 18:39:28 2024 CET
gpg:                using RSA key 408198C2C363076C6B1EABE797EA3168A78CD65A
gpg: Good signature from "Degauss (The Oldest gwit Site) <degauss+togs@selidor.net>" [ultimate]

I hope that having these two tools at hand will encourage people to access and create more gwit sites, or to integrate gwit support in other tools, and especially to test the technology and provide some feedback!

🍃

🗒 Back to log index