lightsystemdarkgreen
@ 261119.3

261119.1 d1753f14c7293dd5f2cdb3b5b4488e94ab87a52a The project is dirview and its command drvu

The name is final. NAME, back from WORKING_NAME, holds drvu, and everything the tool names follows: the binaries drvu, drvu-public and drvu-syntax, DRVU_ADDR and the other variables, ~/.local/state/drvu, the journal tag, .drvu-follow, /_drvu/ and the systemd units.

The project, its Go module and its Debian packages are dirview and dirview-syntax. The Makefile takes that name from the module path as PACKAGE, so the name test now guards both names.

Old names stop working: WWW_ADDR, ~/.local/state/www, the www package and running www servers stay until removed.

reading declarations

.gitignore

@@ -1,4 +1,4 @@ build/-# www's locks for serving this tree+# drvu's locks for serving this tree /*.*.*.*-*.lock /*.*.*.*-*.LOCK

Makefile

@@ -1,14 +1,16 @@ .PHONY: all build syntax fonts run test blackbox bench clean install uninstall deb deb-syntax install-deb uninstall-deb -# WORKING_NAME holds the program's name, provisional until a final one is-# chosen. The binary, the package and the paths below take it.-NAME := $(shell cat WORKING_NAME)+# NAME holds the program's name, which the binaries, units and paths+# below take. The project's name is the module's, which the Debian+# packages take.+NAME := $(shell cat NAME)  all: build  # The root is a library package and each executable has its main under # cmd/. MODULE is the library's import path, which -X needs. MODULE := $(shell go list -m)+PACKAGE := $(notdir $(MODULE))  # build names this checkout in the reader's binary, so its bug button files # into csi/bugs here; the package is built without it. The public binary@@ -33,7 +35,7 @@ fonts: # an installed server on port 80. A server already there is replaced by # this build, serving the same trees, so its open pages go on under the # new code; the browser opens only when no page of this directory was-# open, and www says which happened.+# open, and drvu says which happened. RUNADDR := 127.31.$(shell expr $$(id -u) - 1000).1:8080  run: build syntax@@ -94,36 +96,36 @@ uninstall: VERSION ?= 0~git$(shell TZ=UTC git log -1 --format=%cd --date=format-local:%Y%m%d%H%M%S).$(shell git rev-parse --short HEAD) ARCH ?= $(shell go env GOARCH) STAGE := build/deb-DEB := build/$(NAME)_$(VERSION)_$(ARCH).deb+DEB := build/$(PACKAGE)_$(VERSION)_$(ARCH).deb  deb: 	rm -rf $(STAGE) 	CGO_ENABLED=0 GOARCH=$(ARCH) go build -trimpath -ldflags='-s -w' -o $(STAGE)/usr/bin/$(NAME) ./cmd/local 	CGO_ENABLED=0 GOARCH=$(ARCH) go build -trimpath -ldflags='-s -w' -o $(STAGE)/usr/bin/$(NAME)-public ./cmd/public-	install -D -m 0644 README.md $(STAGE)/usr/share/doc/$(NAME)/README.md-	{ sed '/^@EXPAT@$$/,$$d; s/@NAME@/$(NAME)/g' deb/copyright.in; sed '1,4d; s/^$$/./; s/^/ /' LICENSE; \+	install -D -m 0644 README.md $(STAGE)/usr/share/doc/$(PACKAGE)/README.md+	{ sed '/^@EXPAT@$$/,$$d; s/@NAME@/$(NAME)/g; s/@PACKAGE@/$(PACKAGE)/g' deb/copyright.in; sed '1,4d; s/^$$/./; s/^/ /' LICENSE; \ 	  sed '1,/^@EXPAT@$$/d' deb/copyright.in; sed 's/^$$/./; s/^/ /' assets/fonts/STIXTwoText-OFL.txt; } > $(STAGE)/copyright-	install -D -m 0644 $(STAGE)/copyright $(STAGE)/usr/share/doc/$(NAME)/copyright+	install -D -m 0644 $(STAGE)/copyright $(STAGE)/usr/share/doc/$(PACKAGE)/copyright 	rm $(STAGE)/copyright 	mkdir -p $(STAGE)/usr/share/lintian/overrides-	sed 's/@NAME@/$(NAME)/g' deb/lintian-overrides.in > $(STAGE)/usr/share/lintian/overrides/$(NAME)+	sed 's/@NAME@/$(NAME)/g; s/@PACKAGE@/$(PACKAGE)/g' deb/lintian-overrides.in > $(STAGE)/usr/share/lintian/overrides/$(PACKAGE) 	mkdir -p $(STAGE)/usr/lib/systemd/user $(STAGE)/usr/lib/systemd/system 	sed 's/@NAME@/$(NAME)/g; s|@BIN@|/usr/bin/$(NAME)|' systemd/user.service.in > $(STAGE)/usr/lib/systemd/user/$(NAME).service 	sed 's/@NAME@/$(NAME)/g; s|@BIN@|/usr/bin/$(NAME)|' systemd/system@.service.in > $(STAGE)/usr/lib/systemd/system/$(NAME)@.service-	printf '$(NAME) (%s) unstable; urgency=low\n\n  * Build of commit %s.\n\n -- %s  %s\n' \+	printf '$(PACKAGE) (%s) unstable; urgency=low\n\n  * Build of commit %s.\n\n -- %s  %s\n' \ 		'$(VERSION)' "$$(git rev-parse --short HEAD)" "$$(sed -n 's/^Maintainer: //p' deb/control.in)" \ 		"$$(git log -1 --format=%cD)" | gzip -9n > $(STAGE)/changelog.gz-	install -D -m 0644 $(STAGE)/changelog.gz $(STAGE)/usr/share/doc/$(NAME)/changelog.gz+	install -D -m 0644 $(STAGE)/changelog.gz $(STAGE)/usr/share/doc/$(PACKAGE)/changelog.gz 	rm $(STAGE)/changelog.gz 	mkdir -p $(STAGE)/DEBIAN 	sed 's/@NAME@/$(NAME)/g' deb/postinst.in > $(STAGE)/DEBIAN/postinst-	sed -e 's/@NAME@/$(NAME)/g' -e 's/@VERSION@/$(VERSION)/' -e 's/@ARCH@/$(ARCH)/' \+	sed -e 's/@NAME@/$(NAME)/g' -e 's/@PACKAGE@/$(PACKAGE)/g' -e 's/@VERSION@/$(VERSION)/' -e 's/@ARCH@/$(ARCH)/' \ 		-e "s/@SIZE@/$$(du -sk $(STAGE)/usr | cut -f1)/" deb/control.in > $(STAGE)/DEBIAN/control 	chmod -R u=rwX,go=rX $(STAGE) 	chmod 0755 $(STAGE)/DEBIAN/postinst 	dpkg-deb --root-owner-group --build $(STAGE) $(DEB) -# deb-syntax packages the tree-sitter helper as NAME-syntax. It is a+# deb-syntax packages the tree-sitter helper NAME-syntax as PACKAGE-syntax. It is a # package of its own because it needs cgo and libc, while the main binary # is static. The main package recommends it and it depends on the main # package, each at the same version, since the main binary reads the@@ -131,18 +133,18 @@ deb: # the helper uses. A build for another ARCH needs a C cross compiler, eg # CC=aarch64-linux-gnu-gcc. SYNSTAGE := build/deb-syntax-SYNDEB := build/$(NAME)-syntax_$(VERSION)_$(ARCH).deb-SYNDOC := $(SYNSTAGE)/usr/share/doc/$(NAME)-syntax+SYNDEB := build/$(PACKAGE)-syntax_$(VERSION)_$(ARCH).deb+SYNDOC := $(SYNSTAGE)/usr/share/doc/$(PACKAGE)-syntax  deb-syntax: 	rm -rf $(SYNSTAGE) 	cd syntax && CGO_ENABLED=1 GOARCH=$(ARCH) go build -trimpath -buildmode=pie -ldflags='-s -w' -o ../$(SYNSTAGE)/usr/bin/$(NAME)-syntax . 	mkdir -p $(SYNDOC) $(SYNSTAGE)/DEBIAN-	{ sed '/^@EXPAT@$$/,$$d; s/@NAME@/$(NAME)/g' deb/syntax-copyright.in; sed '1,4d; s/^$$/./; s/^/ /' LICENSE; } > $(SYNDOC)/copyright-	printf '$(NAME)-syntax (%s) unstable; urgency=low\n\n  * Build of commit %s.\n\n -- %s  %s\n' \+	{ sed '/^@EXPAT@$$/,$$d; s/@NAME@/$(NAME)/g; s/@PACKAGE@/$(PACKAGE)/g' deb/syntax-copyright.in; sed '1,4d; s/^$$/./; s/^/ /' LICENSE; } > $(SYNDOC)/copyright+	printf '$(PACKAGE)-syntax (%s) unstable; urgency=low\n\n  * Build of commit %s.\n\n -- %s  %s\n' \ 		'$(VERSION)' "$$(git rev-parse --short HEAD)" "$$(sed -n 's/^Maintainer: //p' deb/control.in)" \ 		"$$(git log -1 --format=%cD)" | gzip -9n > $(SYNDOC)/changelog.gz-	sed -e 's/@NAME@/$(NAME)/g' -e 's/@VERSION@/$(VERSION)/g' -e 's/@ARCH@/$(ARCH)/' \+	sed -e 's/@NAME@/$(NAME)/g' -e 's/@PACKAGE@/$(PACKAGE)/g' -e 's/@VERSION@/$(VERSION)/g' -e 's/@ARCH@/$(ARCH)/' \ 		-e "s/@LIBC@/$$(objdump -T $(SYNSTAGE)/usr/bin/$(NAME)-syntax | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -V | tail -1)/" \ 		-e "s/@SIZE@/$$(du -sk $(SYNSTAGE)/usr | cut -f1)/" deb/syntax-control.in > $(SYNSTAGE)/DEBIAN/control 	chmod -R u=rwX,go=rX $(SYNSTAGE)@@ -166,4 +168,4 @@ install-deb: uninstall 	-/usr/bin/$(NAME) --restart --force  uninstall-deb:-	sudo apt remove $(NAME) $(NAME)-syntax+	sudo apt remove $(PACKAGE) $(PACKAGE)-syntax

NAME

new file mode 100644@@ -0,0 +1 @@+drvu

README.md

@@ -1,49 +1,49 @@-# www+# dirview -www reads directories and repos in the browser: Markdown as pages, code as code, history beside both.+dirview reads directories and repos in the browser: Markdown as pages, code as code, history beside both. Its command is `drvu`.  It is for anyone who keeps notes, docs and code in plain files and wants to read them as linked pages. It runs on your machine. Nothing needs a build step, and nothing needs a push first. -A repo on GitHub, GitLab or Codeberg reads the same way, once www has fetched it.+A repo on GitHub, GitLab or Codeberg reads the same way, once drvu has fetched it.  It is fast. A page takes one to three milliseconds and a server starts in about 40 ms. `make test` fails any page that takes over 5 ms.  ## Usage  ```-www [-p] [--foreground] [--no-open] [-a ADDR] [--debug] [--no-bug]+drvu [-p] [--foreground] [--no-open] [-a ADDR] [--debug] [--no-bug]     [--cache=SIZE] [--disk=SIZE] [--base=PATH] [--] [DIR]-www [-p] [--foreground] [--no-open] --share[=HOST] [--secret] [--debug]+drvu [-p] [--foreground] [--no-open] --share[=HOST] [--secret] [--debug]     [--no-bug] [--cache=SIZE] [--disk=SIZE] [--base=PATH] [--] [DIR]-www --restart [-f] [--no-open] [--debug] [--no-bug]+drvu --restart [-f] [--no-open] [--debug] [--no-bug]     [-a ADDR | --share[=HOST]] [--] [DIR]-www -l [-a ADDR | --share[=HOST]] [--] [DIR]-www --kill [-a ADDR | --share[=HOST]]-www --commit=REV [--] [DIR]-www -h | --help-www -V | --version+drvu -l [-a ADDR | --share[=HOST]] [--] [DIR]+drvu --kill [-a ADDR | --share[=HOST]]+drvu --commit=REV [--] [DIR]+drvu -h | --help+drvu -V | --version ``` -A second executable, `www-public`, serves online repos to the web and nothing else:+A second executable, `drvu-public`, serves online repos to the web and nothing else:  ```-www-public --disk=SIZE (-a ADDR | --share[=HOST]) [--debug] [--cache=SIZE]+drvu-public --disk=SIZE (-a ADDR | --share[=HOST]) [--debug] [--cache=SIZE]     [--base=PATH]-www-public -h | --help-www-public -V | --version+drvu-public -h | --help+drvu-public -V | --version ``` -Run `www` in a directory. It prints the tree's URL and opens it with `xdg-open`, a tab in your default browser. To open it another way, set `WWW_OPEN`, eg `WWW_OPEN='brave-browser --app=%s'` for a window of its own; [options](doc/options.md) has more.+Run `drvu` in a directory. It prints the tree's URL and opens it with `xdg-open`, a tab in your default browser. To open it another way, set `DRVU_OPEN`, eg `DRVU_OPEN='brave-browser --app=%s'` for a window of its own; [options](doc/options.md) has more.  It also writes a lockfile named after the endpoint, eg `127.31.1.1-8080.lock`. Delete the lockfile to stop serving the tree. Trees on one address share one server, which exits when its last lock is gone. The server on your default address stays up, since it also serves [online repos](doc/online-repos.md).  ```-www                         serve this directory and open it-www -p ~/notes              serve ~/notes, and again after a reboot-www --share=192.168.1.5     serve this directory to the LAN-www -l                      list every served tree as keyval-www --restart               move every server to the current binary-www-public --disk=6G -a 127.0.0.1:8080+drvu                         serve this directory and open it+drvu -p ~/notes              serve ~/notes, and again after a reboot+drvu --share=192.168.1.5     serve this directory to the LAN+drvu -l                      list every served tree as keyval+drvu --restart               move every server to the current binary+drvu-public --disk=6G -a 127.0.0.1:8080                             serve online repos to the web, behind a proxy ``` @@ -53,11 +53,11 @@ To read a repo from GitHub, open `http://127.31.1.2/github.com/junegunn/fzf/`.  ## Install -www needs git.+drvu needs git. -`make install` links `build/www` and `build/www-public` into `~/.local/bin` and serves on port 8080.+`make install` links `build/drvu` and `build/drvu-public` into `~/.local/bin` and serves on port 8080. -`make install-deb` builds and installs two Debian packages: www and its syntax tree helper. The package's binary may bind port 80, so URLs carry no port.+`make install-deb` builds and installs two Debian packages: dirview and dirview-syntax, its syntax tree helper. The package's binary may bind port 80, so URLs carry no port.  ## Documentation @@ -69,9 +69,9 @@ www needs git. - [History](doc/history.md): histories, their feeds, commits, stardates, the timeline and old versions of a tree - [Online repos](doc/online-repos.md): reading a forge's repos on the second address, or serving them to the web - [Sharing](doc/sharing.md): serving a tree to other machines-- [Safety](doc/safety.md): what www refuses to serve, follow or run-- [Speed](doc/speed.md): what www caches and how it is timed-- [Log](doc/log.md): what www writes to the journal+- [Safety](doc/safety.md): what drvu refuses to serve, follow or run+- [Speed](doc/speed.md): what drvu caches and how it is timed+- [Log](doc/log.md): what drvu writes to the journal - [Debugging](doc/debugging.md): the bug button and the build stamp - [Install](doc/install.md): the Debian package, port 80 and locks in git - [Development](doc/development.md): `make run`, the two executables, the working name and the usage check@@ -83,4 +83,4 @@ MIT, see `LICENSE`.  The embedded fonts are subsets of STIX Two Text and Iosevka, under the SIL Open Font License: see `assets/fonts/STIXTwoText-OFL.txt` and `assets/fonts/Iosevka-OFL.txt`. -The binary links in five Go modules. Four are under the MIT licence: goldmark by Yusuke Inuzuka, chroma by Alec Thomas, regexp2 by Doug Clark and kv, www's sister project. regexp2 ports parts of Microsoft's dotnet/corefx. The fifth, yaml.v3 by Canonical, is under Apache 2.0, with its files from Kirill Simonov's libyaml under MIT. The package's copyright file carries their notices.+The binary links in five Go modules. Four are under the MIT licence: goldmark by Yusuke Inuzuka, chroma by Alec Thomas, regexp2 by Doug Clark and kv, dirview's sister project. regexp2 ports parts of Microsoft's dotnet/corefx. The fifth, yaml.v3 by Canonical, is under Apache 2.0, with its files from Kirill Simonov's libyaml under MIT. The package's copyright file carries their notices.

WORKING_NAME

deleted file mode 100644@@ -1 +0,0 @@-www

about.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"fmt"

about_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"regexp"

args.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/netip"@@ -12,7 +12,7 @@ type config struct { 	sharing bool 	share   string // the address --share names; "" takes the default route's 	secret  bool-	token   string // the secret path's token, from WWW_SECRET or drawn at random+	token   string // the secret path's token, from DRVU_SECRET or drawn at random 	ep      netip.AddrPort 	fg      bool 	noopen  bool@@ -21,7 +21,7 @@ type config struct { 	noBug   bool   // hide the bug button and refuse reports 	cache   string // the memory for cached git answers, eg 32M; "" takes defaultCache 	disk    string // the disk for online repos, eg 4G; "" takes defaultDisk-	base    string // the path every URL starts with, eg /www; "" serves at the root+	base    string // the path every URL starts with, eg /drvu; "" serves at the root 	public  bool   // serve only online repos, to the open web; the public executable sets it 	help    bool 	version bool

args_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"errors"@@ -62,7 +62,7 @@ func TestParseArgs(t *testing.T) { 	} } -// parseOK holds command lines www takes, and what each parses to.+// parseOK holds command lines drvu takes, and what each parses to. var parseOK = []struct { 	args []string 	want config

backlinks.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"

backlinks_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"encoding/json"

base_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"html"

bench_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

browser.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"fmt"@@ -24,7 +24,7 @@ func openBrowser(url string) { 	go cmd.Wait() } -// openArgs is the command that opens url. A loopback URL takes WWW_OPEN,+// openArgs is the command that opens url. A loopback URL takes DRVU_OPEN, // split at spaces, with each %s replaced by the URL, or the URL appended // when none holds %s; eg 'brave-browser --app=%s' opens an app window. A // shared URL, and any URL without the variable, goes to xdg-open.

browser_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"slices"

budget_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"@@ -10,7 +10,7 @@ import ( 	"time" ) -// pageBudget is the time www promises for any page from a warm server.+// pageBudget is the time drvu promises for any page from a warm server. const pageBudget = 5 * time.Millisecond  // Every kind of page renders within pageBudget once its git answers are

bug.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"errors"@@ -18,7 +18,7 @@ const maxBug = 16 << 20  // handleBug files a page as a numbered bug, from the bug button at each // page's foot, or adds a comment to one. A report is one line in the log,-// which `journalctl --user -t www -g '^bug '` finds; N.kv under the state+// which `journalctl --user -t drvu -g '^bug '` finds; N.kv under the state // directory, as keyval: the time, URL, selected text as the note, the // window's size and scroll, the browser, the build and the server's // state from bugState; and N.html, the page as the reader saw it. It@@ -26,7 +26,7 @@ const maxBug = 16 << 20 // the log and to N.kv. func (s *server) handleBug(w http.ResponseWriter, r *http.Request) { 	if !sameOrigin(r) {-		http.Error(w, "a bug report must come from an "+progName+" page", http.StatusForbidden)+		http.Error(w, "a bug report must come from a "+progName+" page", http.StatusForbidden) 		return 	} 	r.Body = http.MaxBytesReader(w, r.Body, maxBug)@@ -125,7 +125,7 @@ var sourceDir string  // bugDir is where bug reports go, made on first use: csi/bugs in the // checkout the binary was built from, when that checkout has csi, so the-// bugs sit with the project they are about; else $XDG_STATE_HOME/www/bugs.+// bugs sit with the project they are about; else $XDG_STATE_HOME/drvu/bugs. func bugDir() (string, error) { 	if sourceDir != "" { 		if info, err := os.Stat(filepath.Join(sourceDir, "csi")); err == nil && info.IsDir() {

bug_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

cache.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	linked "container/list"

cache_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

cmd/local/main.go

@@ -2,6 +2,6 @@ // machine and, on a second address, online repos. package main -import "www"+import "dirview" -func main() { www.Local() }+func main() { dirview.Local() }

cmd/public/main.go

@@ -2,6 +2,6 @@ // repos fetched from a forge, never a tree of this machine. package main -import "www"+import "dirview" -func main() { www.Public() }+func main() { dirview.Public() }

deb/control.in

@@ -1,14 +1,14 @@-Package: @NAME@+Package: @PACKAGE@ Version: @VERSION@ Architecture: @ARCH@ Maintainer: unixfile <unixfile@users.noreply.github.com> Installed-Size: @SIZE@ Depends: git, libcap2-bin, weasyprint-Recommends: xdg-utils, @NAME@-syntax (= @VERSION@)+Recommends: xdg-utils, @PACKAGE@-syntax (= @VERSION@) Suggests: graphviz Section: text Priority: optional-Homepage: https://github.com/unixfile/@NAME@+Homepage: https://github.com/unixfile/@PACKAGE@ Description: browse trees of Markdown docs in the browser  Run @NAME@ in a directory and it serves the tree on a loopback address  of the user's own, rendered on each request. Links follow into

deb/copyright.in

@@ -1,6 +1,6 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/-Upstream-Name: @NAME@-Source: https://github.com/unixfile/@NAME@+Upstream-Name: @PACKAGE@+Source: https://github.com/unixfile/@PACKAGE@  Files: * Copyright: 2026 unixfile

deb/lintian-overrides.in

@@ -1,2 +1,2 @@ # Go builds static binaries on purpose: no libc to match on the target.-@NAME@: statically-linked-binary [usr/bin/@NAME@]+@PACKAGE@: statically-linked-binary [usr/bin/@NAME@]

deb/syntax-control.in

@@ -1,12 +1,12 @@-Package: @NAME@-syntax+Package: @PACKAGE@-syntax Version: @VERSION@ Architecture: @ARCH@ Maintainer: unixfile <unixfile@users.noreply.github.com> Installed-Size: @SIZE@-Depends: libc6 (>= @LIBC@), @NAME@ (= @VERSION@)+Depends: libc6 (>= @LIBC@), @PACKAGE@ (= @VERSION@) Section: text Priority: optional-Homepage: https://github.com/unixfile/@NAME@+Homepage: https://github.com/unixfile/@PACKAGE@ Description: syntax trees for the code pages of @NAME@  @NAME@-syntax parses source with tree-sitter and prints its syntax  tree, which @NAME@ shows as a code page's tree view. It knows Go,

deb/syntax-copyright.in

@@ -1,6 +1,6 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/-Upstream-Name: @NAME@-Source: https://github.com/unixfile/@NAME@+Upstream-Name: @PACKAGE@+Source: https://github.com/unixfile/@PACKAGE@  Files: * Copyright: 2026 unixfile

details.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"fmt"

details_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"os"

doc/code-pages.md

@@ -6,7 +6,7 @@ Code pages are highlighted by chroma, by the language the file name gives, in fe  Go is lexed by Go's own scanner from the standard library instead, about 150 times faster, with the same colours. A Go page of 1,400 lines takes 2 ms. -Python, JavaScript and shell have lexers of www's own. They follow chroma's rules and give every byte the class chroma gives it. chroma took 180 ms to lex argparse.py, 2,633 lines, and they take under 2 ms. A whole page of it renders in about 3 ms, and jquery.js, 10,907 lines, in about 20 ms instead of 400.+Python, JavaScript and shell have lexers of drvu's own. They follow chroma's rules and give every byte the class chroma gives it. chroma took 180 ms to lex argparse.py, 2,633 lines, and they take under 2 ms. A whole page of it renders in about 3 ms, and jquery.js, 10,907 lines, in about 20 ms instead of 400.  Other languages go through chroma, at about 70 µs a line. @@ -40,11 +40,11 @@ In the same corner, flat goes back to the plain page.  Add `?tree`, or follow tree, for the syntax tree: one row per named node, with its field in its parent, its kind, its text on one line and a link to its lines. It is folded so the file's top-level declarations show first. -A helper parses it with tree-sitter: `www-syntax`, which the package of that name installs and `make syntax` builds beside www with a C compiler. It knows Go, Python, JavaScript, TypeScript, Rust, C, C++, shell, Java, C#, JSON, HTML, CSS and Ruby. Without the helper, or for another language, the page says so above the plain code.+A helper parses it with tree-sitter: `drvu-syntax`, which the package dirview-syntax installs and `make syntax` builds beside drvu with a C compiler. It knows Go, Python, JavaScript, TypeScript, Rust, C, C++, shell, Java, C#, JSON, HTML, CSS and Ruby. Without the helper, or for another language, the page says so above the plain code.  The page carries only the folds that show. A closed fold arrives empty and fetches its rows when it opens, its own folds empty in turn. jquery.js's tree is 4.8 MB, and its page sends 413 bytes of it, since the file is one function; server.go's sends 9 KB of 266. Once the page has loaded, it fetches the whole tree and fills each fold still empty, so the browser's find reaches every row and the folds already opened stay open. A search waits for that, then filters. When the whole tree cannot be had, the search covers the rows the page has and says so. A request for a fold names the hash of the file the page showed; when the file changed since, the page reloads instead of mixing two trees. -A first view of a 1,400-line file takes about 20 ms; one of jquery.js, 10,900 lines, takes about 85 ms, most of it in the parse. www renders the rows as the helper prints them. The server keeps the tree, so a later view takes a few milliseconds.+A first view of a 1,400-line file takes about 20 ms; one of jquery.js, 10,900 lines, takes about 85 ms, most of it in the parse. drvu renders the rows as the helper prints them. The server keeps the tree, so a later view takes a few milliseconds.  ## Gron 

doc/debugging.md

@@ -2,20 +2,20 @@  ## Bug reports -A small, faint `www bug` button sits at the foot of every page. It reports a bug in www and the server, not in the tree you are reading.+A small, faint `drvu bug` button sits at the foot of every page. It reports a bug in drvu and the server, not in the tree you are reading.  A click files a numbered bug with the page attached, and the button says which, eg `bug 7 filed`. Text selected on the page goes in as the note. A field then opens beside the button for a comment: Enter adds it, Escape or clicking away leaves the bug without one. -Each report lands in `csi/bugs/` of the checkout the binary was built from, when `make build` built it there and that checkout has csi, so the bugs sit with www's own project. Otherwise, as for the package, it lands in `~/.local/state/www/bugs/`, or below `$XDG_STATE_HOME` when set:+Each report lands in `csi/bugs/` of the checkout the binary was built from, when `make build` built it there and that checkout has csi, so the bugs sit with drvu's own project. Otherwise, as for the package, it lands in `~/.local/state/drvu/bugs/`, or below `$XDG_STATE_HOME` when set:  - `7.kv`: the report as keyval: the time, the page's URL, the note, the window's size and scroll as `view`, the browser as `ua`, the build, then the server: its `pid`, its binary as `exe`, `stale yes` if a rebuild has replaced that binary, its `addr`, when it `started`, its `command` line and each tree it serves as `tree.0`, `tree.1` and on, then each comment as `comment.0`, `comment.1` and on - `7.html`: the page as it stood at the click, script changes included, with its stylesheet and no script, so it opens as you saw it - `next`: the number the next report gets. Numbers only grow, so a bug deleted once fixed never gives its number away -Each report and comment is also one line in the log. Find them with `journalctl --user -t www -g '^bug '`:+Each report and comment is also one line in the log. Find them with `journalctl --user -t drvu -g '^bug '`:  ```-bug 7: http://127.31.1.1/x/nowhere.md note="the coin is cut off" view=1280x800+0 ua="Mozilla/5.0 ..." build=1aa282c snapshot=/home/t/scratch/github.com/unixfile/www/csi/bugs/7.html+bug 7: http://127.31.1.1/x/nowhere.md note="the coin is cut off" view=1280x800+0 ua="Mozilla/5.0 ..." build=1aa282c snapshot=/home/t/scratch/github.com/unixfile/dirview/csi/bugs/7.html bug 7 comment: "after a restart" ``` @@ -25,4 +25,4 @@ bug 7 comment: "after a restart"  With `--debug`, each page says when its binary was built and how many seconds ago, the commit it was built from and how long the page took to render, eg `built 12:49, 108 s ago, from 1aa282c+modified, rendered in 3.3 ms`. It sits small and faint above the header, so a glance tells which build served the page. -`+modified` marks a build from uncommitted code. www's script counts the seconds up while the page is open. Shares leave the stamp out.+`+modified` marks a build from uncommitted code. drvu's script counts the seconds up while the page is open. Shares leave the stamp out.

doc/development.md

@@ -1,20 +1,20 @@ # Development -To try a change without installing it, run `make run`. It builds `build/www` and the syntax tree helper and serves this directory on port 8080 with `--debug`, beside an installed server on port 80.+To try a change without installing it, run `make run`. It builds `build/drvu` and the syntax tree helper and serves this directory on port 8080 with `--debug`, beside an installed server on port 80.  A later run replaces the server on 8080 with the new build, serving the same trees, and open pages go on under it. So edit and `make run` again. -It opens the browser only when no page of this directory was open on the old server, and says which happened. A hidden tab holds no connection, so it does not count and gets a second tab. `www --kill -a 127.31.N.1:8080` stops it.+It opens the browser only when no page of this directory was open on the old server, and says which happened. A hidden tab holds no connection, so it does not count and gets a second tab. `drvu --kill -a 127.31.N.1:8080` stops it.  ## Two executables -The root directory is a library package. Each executable has only its main under `cmd/`: `cmd/local` builds `www`, the reader, and `cmd/public` builds `www-public`, for the open web. `make build` builds both into `build/`.+The root directory is a library package. Each executable has only its main under `cmd/`: `cmd/local` builds `drvu`, the reader, and `cmd/public` builds `drvu-public`, for the open web. `make build` builds both into `build/`.  The public executable leaves a feature out by never calling it, and the linker drops code that no call leads to. A server gets the stop form, the bug form and the index only through `local()`, which the public start never calls. `TestPublicLeavesOutTheReadersFeatures` builds both and reads their symbols: the public one must hold none of the listed names and the reader every one. -## The working name+## The names -The program's name lives in the file `WORKING_NAME`, since www is a working name until a final one is chosen. The binary, its paths, environment variables, journal tag and URLs, the Makefile and the Debian package all take it from there. A test fails on any other copy outside prose and `go.mod`.+The project is dirview and its command is drvu. The command's name lives in the file `NAME`: the binaries, their paths, environment variables, journal tag, units and URLs take it from there. The project's name lives in `go.mod`, as the module's, and the Debian packages take it from there. A test fails on any other copy of either outside prose, `go.mod` and the Go package and import lines.  ## Usage check 

doc/history.md

@@ -26,7 +26,7 @@ A commit on no main line, eg on another branch, shows its short hash.  A doc or code page with commits opens with a line that says where the reader is: current when the page matches its last commit, changed when it has edits since. Hover names the commit by stardate and subject. -www compares git's id for the file with the one HEAD keeps, which takes microseconds, and asks `git status` only when they differ.+drvu compares git's id for the file with the one HEAD keeps, which takes microseconds, and asks `git status` only when they differ.  ## The timeline @@ -38,7 +38,7 @@ The menu loads when the pointer first passes over the line, so it opens full. Up  ## The feed -`?log=rss` serves the same history as an RSS feed, eg `/scratch/www/doc/?log=rss`. A history page names its feed in its head, where a feed reader finds it, and as rss in its header.+`?log=rss` serves the same history as an RSS feed, eg `/scratch/dirview/doc/?log=rss`. A history page names its feed in its head, where a feed reader finds it, and as rss in its header.  The feed carries the 50 newest commits. Each item's title is the subject, its link the commit's page and its date the one the history shows. Its text is the stardate, the short hash and the message in paragraphs. @@ -46,7 +46,7 @@ Links are absolute, since a reader shows them away from the page. They take the  The feed has an ETag, so a reader that polls gets 304 until a commit changes it. A byte that XML forbids, eg a control character in a message, becomes U+FFFD, so one message cannot break the feed. -On the web address a feed request is a visit, so it fetches a copy over five minutes old. A page answers from the copy at hand and reloads after the fetch, but a feed reader does not reload. So a feed request waits for the fetch, up to 30 seconds, and answers from the tree it brought. A fetch that takes longer, or fails, leaves the feed as the copy had it. `www-public` serves feeds too.+On the web address a feed request is a visit, so it fetches a copy over five minutes old. A page answers from the copy at hand and reloads after the fetch, but a feed reader does not reload. So a feed request waits for the fetch, up to 30 seconds, and answers from the tree it brought. A fetch that takes longer, or fails, leaves the feed as the copy had it. `drvu-public` serves feeds too.  ## Commit pages @@ -54,7 +54,7 @@ permalink in a history's fold, or commit at the right end of a version's top lin  Added lines sit on a green tint and removed ones on a red. The diff stops at 1 MiB. -From the terminal, `www --commit=261024.4` prints a commit's full hash, stardate and subject as keyval.+From the terminal, `drvu --commit=261024.4` prints a commit's full hash, stardate and subject as keyval.  ## Semantic diffs @@ -70,9 +70,9 @@ A first view of a commit that touches 12 files took about 190 ms. The server kee  ## Git's safety -www runs `git log`, `git show` and `git rev-parse` in the directory of what the page shows, after links resolve.+drvu runs `git log`, `git show` and `git rev-parse` in the directory of what the page shows, after links resolve. -A cloned repo's `.git/config` can name programs for git to run. So www turns off external diff, textconv, signature checks and fetches, and drops `GIT_` variables from its environment. git's own `safe.directory` check refuses repos that other users own.+A cloned repo's `.git/config` can name programs for git to run. So drvu turns off external diff, textconv, signature checks and fetches, and drops `GIT_` variables from its environment. git's own `safe.directory` check refuses repos that other users own.  No history page shows authors, on a share or on loopback. @@ -80,7 +80,7 @@ No history page shows authors, on a share or on loopback.  A shared server shows history and diffs as loopback does, with four differences. -History appears only when other users could read the repo's git directory, its `HEAD`, `objects` and `refs`. Nobody reads through www what git run as another user would not show them.+History appears only when other users could read the repo's git directory, its `HEAD`, `objects` and `refs`. Nobody reads through drvu what git run as another user would not show them.  Each message loses its trailer block, which carries emails and session links in lines such as `Signed-off-by:` and `Claude-Session:`. As in git, the last paragraph is a trailer block when a quarter of its lines are `Key: value` lines, so a cherry-pick note or a wrapped trailer does not keep it. @@ -92,15 +92,15 @@ A share never shows git's errors, which name paths on the machine, and says only  Each commit in a history has a time warp link, inside its fold, to the page as it was in that commit. -`@` and a commit's hash on a tree's name serve the tree as of that commit, eg `/scratch/www@5430ac3/` for its root or `/scratch/www@5430ac3/doc/history.md` for one doc. The version qualifies the tree, so it sits on the name, not below it as an entry would. A tree served at `/` has no name, so its versions sit below it, eg `/@5430ac3/`.+`@` and a commit's hash on a tree's name serve the tree as of that commit, eg `/scratch/dirview@5430ac3/` for its root or `/scratch/dirview@5430ac3/doc/history.md` for one doc. The version qualifies the tree, so it sits on the name, not below it as an entry would. A tree served at `/` has no name, so its versions sit below it, eg `/@5430ac3/`. -The address below the tree, eg `/scratch/www/@5430ac3/`, is the old form and redirects. A tree that holds an entry named like a version, eg a directory `@cafe`, serves that entry at `/scratch/www/@cafe/`, and the old form does not redirect there.+The address below the tree, eg `/scratch/dirview/@5430ac3/`, is the old form and redirects. A tree that holds an entry named like a version, eg a directory `@cafe`, serves that entry at `/scratch/dirview/@cafe/`, and the old form does not redirect there. -A stardate works the same, eg `www@261024.4/`, and a hash of a commit with a stardate redirects to it. A day alone, eg `www@261024/`, names no commit and says so, though its six digits would also read as a hash. Any length of hash from four characters up works and redirects to git's short form.+A stardate works the same, eg `dirview@261024.4/`, and a hash of a commit with a stardate redirects to it. A day alone, eg `dirview@261024/`, names no commit and says so, though its six digits would also read as a hash. Any length of hash from four characters up works and redirects to git's short form. -Docs, code pages, listings and search work there as on the tree itself, read from git rather than the disk. Relative links stay in the same version. www's script still runs there, so keys, the search box and line marks work as on the tree.+Docs, code pages, listings and search work there as on the tree itself, read from git rather than the disk. Relative links stay in the same version. drvu's script still runs there, so keys, the search box and line marks work as on the tree. -The top line names the commit that last changed the page as of that version, stardate first as in histories, and opens the same timeline with that version marked. At the line's right end, commit opens the commit's page, and current leads to the page as it is, as does the timeline's first row. The breadcrumbs and the tab title carry the hash, eg `www @ 5430ac3`.+The top line names the commit that last changed the page as of that version, stardate first as in histories, and opens the same timeline with that version marked. At the line's right end, commit opens the commit's page, and current leads to the page as it is, as does the timeline's first row. The breadcrumbs and the tab title carry the hash, eg `drvu @ 5430ac3`.  A version never changes, so it has no live reload, no Delete lock button and no path to copy, and its docs list no backlinks. 

doc/install.md

@@ -1,24 +1,24 @@ # Install -www needs git.+drvu needs git. -`make install` links `build/www` into `~/.local/bin`.+`make install` links `build/drvu` into `~/.local/bin`.  ## Debian packages -`make deb` builds a Debian package in `build/`, such as `www_0~git20261015223930.20f02fd_amd64.deb`, versioned by the last commit's UTC time and hash. It depends on git. For another architecture, pass `ARCH`, eg `make deb ARCH=arm64`.+`make deb` builds a Debian package in `build/`, such as `dirview_0~git20261015223930.20f02fd_amd64.deb`, versioned by the last commit's UTC time and hash. It depends on git. For another architecture, pass `ARCH`, eg `make deb ARCH=arm64`. -`make deb-syntax` builds `www-syntax`, the syntax tree helper, as a package of its own beside it, since the helper needs cgo and libc while www is static. The main package recommends it and the helper depends on www, each at the same version, because www reads the helper's output. For another architecture it needs a C cross compiler, eg `make deb-syntax ARCH=arm64 CC=aarch64-linux-gnu-gcc`.+`make deb-syntax` builds the syntax tree helper `drvu-syntax` as a package of its own beside it, `dirview-syntax`, since the helper needs cgo and libc while drvu is static. The main package recommends it and the helper's package depends on dirview, each at the same version, because drvu reads the helper's output. For another architecture it needs a C cross compiler, eg `make deb-syntax ARCH=arm64 CC=aarch64-linux-gnu-gcc`.  `make install-deb` builds both packages while sudo asks for the password, then installs them with `sudo apt install`, which pulls in git. It first removes the `~/.local/bin` link from `make install`, which would otherwise shadow the package's binary. Run it again to replace an installed build, even of the same commit. `make uninstall-deb` removes both. -Debian's needrestart lists the services that use old libraries after the install instead of asking which to restart. None of them is www.+Debian's needrestart lists the services that use old libraries after the install instead of asking which to restart. None of them is drvu.  ## Port 80 -The package holds both executables, `/usr/bin/www` and `/usr/bin/www-public`. It grants `/usr/bin/www` one capability, `cap_net_bind_service`, so it can bind port 80 while running as the user. `getcap /usr/bin/www` shows it.+The package holds both executables, `/usr/bin/drvu` and `/usr/bin/drvu-public`. It grants `/usr/bin/drvu` one capability, `cap_net_bind_service`, so it can bind port 80 while running as the user. `getcap /usr/bin/drvu` shows it. -With it www serves on port 80 and URLs carry no port. Without it, as after `make install`, the port is 8080. www also takes port 80 where the machine lets every user bind low ports.+With it drvu serves on port 80 and URLs carry no port. Without it, as after `make install`, the port is 8080. drvu also takes port 80 where the machine lets every user bind low ports.  ## Locks in git 

doc/log.md

@@ -1,23 +1,23 @@ # Log -www logs every action, always. There is no flag and no level to set, because a filter set before a mistake drops the entry that would explain it.+drvu logs every action, always. There is no flag and no level to set, because a filter set before a mistake drops the entry that would explain it. -Entries go to the systemd journal, tagged `www`:+Entries go to the systemd journal, tagged `drvu`:  ```-journalctl --user -t www --since -1h-journalctl --user -t www WWW_ENDPOINT=127.31.1.1-80-journalctl --user -t www -p err+journalctl --user -t drvu --since -1h+journalctl --user -t drvu DRVU_ENDPOINT=127.31.1.1-80+journalctl --user -t drvu -p err ``` -Each entry carries the endpoint it concerns in `WWW_ENDPOINT` and its priority in `PRIORITY`: 3 for faults, 6 for the rest. The journal also holds what explains a vanished server, such as a suspend, an OOM kill or a logout.+Each entry carries the endpoint it concerns in `DRVU_ENDPOINT` and its priority in `PRIORITY`: 3 for faults, 6 for the rest. The journal also holds what explains a vanished server, such as a suspend, an OOM kill or a logout. -Where no journal socket exists, entries go to `~/.local/state/www/log` instead, or below `$XDG_STATE_HOME` when set. Its lines hold time, PID, endpoint, priority and the message. The file is mode 600 and rotates once to `log.1` at 1 MB. `www --help` names the place in use.+Where no journal socket exists, entries go to `~/.local/state/drvu/log` instead, or below `$XDG_STATE_HOME` when set. Its lines hold time, PID, endpoint, priority and the message. The file is mode 600 and rotates once to `log.1` at 1 MB. `drvu --help` names the place in use.  ## What is logged -- Every run of `www`, with its arguments, working directory and binary, and its outcome when it fails. A run that joins a server or finds its tree already served says so.-- Each server's start with its binary and commit, eg `/usr/bin/www 54cca2a`, and `+modified` for a build from uncommitted code. A stale binary is the first suspect when a page looks wrong.+- Every run of `drvu`, with its arguments, working directory and binary, and its outcome when it fails. A run that joins a server or finds its tree already served says so.+- Each server's start with its binary and commit, eg `/usr/bin/drvu 54cca2a`, and `+modified` for a build from uncommitted code. A stale binary is the first suspect when a page looks wrong. - Each tree served and withdrawn, with the cause: a deleted lock, a Delete lock or Kill server button, or a signal. Then the server's stop and exit. - Stale locks and registry links cleared after a crash, and the SIGTERM that `--kill` and `--restart` send. - Every page request, with method, path, status and time taken. Live reload streams, the stylesheet, fonts and the favicon come with every page and are left out. A shared server adds the visitor's address.

doc/online-repos.md

@@ -1,6 +1,6 @@ # Online repos -The server on your default address also listens on the address after it, 127.31.N.2, on the same port. That server stays up with no tree, and `www --restart`, which the login unit runs, starts it, so the web address answers at all times. There a URL names a repo on a forge by its host and path, eg `http://127.31.1.2/github.com/junegunn/fzf/README.md`. The first visit fetches the repo into a cache. From then on www serves it as it serves a checkout: docs, code, listings, search and history.+The server on your default address also listens on the address after it, 127.31.N.2, on the same port. That server stays up with no tree, and `drvu --restart`, which the login unit runs, starts it, so the web address answers at all times. There a URL names a repo on a forge by its host and path, eg `http://127.31.1.2/github.com/junegunn/fzf/README.md`. The first visit fetches the repo into a cache. From then on drvu serves it as it serves a checkout: docs, code, listings, search and history.  Home and the web never collide, since each has an address of its own. @@ -10,9 +10,9 @@ The index at `/` on the default address links the web address. The web address's  The index at `/` names the web address, but a reader seldom sees the index, so two ways in lie where a reader already is. -A link in a doc to a repo on GitHub, GitLab, Codeberg or Bitbucket, or to a file or directory in one, is followed by a small www, raised like a footnote mark. It opens the same repo or file on the web address, and its title names the repo. The forge's own link stays as it was.+A link in a doc to a repo on GitHub, GitLab, Codeberg or Bitbucket, or to a file or directory in one, is followed by a small drvu, raised like a footnote mark. It opens the same repo or file on the web address, and its title names the repo. The forge's own link stays as it was. -On the web address the link turns around. A reader there is already inside an online repo, so a link to another repo opens it in www, and the mark after it names the forge, eg github, and opens the forge's page. A link in your own docs still goes where it says.+On the web address the link turns around. A reader there is already inside an online repo, so a link to another repo opens it in drvu, and the mark after it names the forge, eg github, and opens the forge's page. A link in your own docs still goes where it says.  A link to a forge page that is not a file, eg an issue or an account, gets no mark. A link to a file's bare bytes counts as a link to the file, eg on raw.githubusercontent.com. A link pinned to a commit by its hash opens that version, eg `fzf@26ff936`. A branch or tag drops, since the web address serves the commit it fetched. The copy button leaves the mark out. @@ -24,29 +24,29 @@ Both appear wherever a server serves the web address: on its default address and  ## The first visit -A repo not yet cached opens a page that says "reading". It names each step as www takes it: the git command, the URL and where the files go, with git's progress below and its time. When the repo is ready the page turns into it on its own. For most repos that takes one to three seconds; git's own repo takes about 20.+A repo not yet cached opens a page that says "reading". It names each step as drvu takes it: the git command, the URL and where the files go, with git's progress below and its time. When the repo is ready the page turns into it on its own. For most repos that takes one to three seconds; git's own repo takes about 20.  A visit to another path in a repo being read, eg its README in a second tab, joins that read. Its page shows the same steps and turns into the page asked for when the read ends. It starts nothing, so it counts against no limit. A link to a version of a repo not yet cached, eg `fzf@26ff936`, reads the repo and then shows the version. -www first finds where the repo ends in the path. It asks `git ls-remote` on every prefix at once, with and without `.git`, and takes the longest that answers; the rest of the path lies inside the repo. GitHub, Bitbucket and Codeberg keep every repo at owner/name, so there it asks nothing and clones at once.+drvu first finds where the repo ends in the path. It asks `git ls-remote` on every prefix at once, with and without `.git`, and takes the longest that answers; the rest of the path lies inside the repo. GitHub, Bitbucket and Codeberg keep every repo at owner/name, so there it asks nothing and clones at once.  A URL that ends in `.git` redirects to the one without, so a repo has one URL. -When another website links to a repo not yet cached, the browser marks the request as cross-site, and www asks before fetching anything. The page's read link keeps the link's fragment, eg the lines `#L10-L12` marks, and the page never reloads on its own, so nothing is fetched until you follow it. A URL typed, bookmarked or followed from a www page fetches at once. So no site can make your browser fill the disk.+When another website links to a repo not yet cached, the browser marks the request as cross-site, and drvu asks before fetching anything. The page's read link keeps the link's fragment, eg the lines `#L10-L12` marks, and the page never reloads on its own, so nothing is fetched until you follow it. A URL typed, bookmarked or followed from a drvu page fetches at once. So no site can make your browser fill the disk.  ## The cache -The cache lives in `~/.cache/www/`, or `$XDG_CACHE_HOME/www/`, one directory per repo named by its host and path. Each holds a bare clone without file contents, in `.git`, and one worktree of the commit served, such as `.wt-b412a450538e`, which the link `.tree` names.+The cache lives in `~/.cache/drvu/`, or `$XDG_CACHE_HOME/drvu/`, one directory per repo named by its host and path. Each holds a bare clone without file contents, in `.git`, and one worktree of the commit served, such as `.wt-b412a450538e`, which the link `.tree` names.  The worktree's checkout fetches every file of that commit in one request. Older file versions arrive when a page needs them: a commit's diff fetches the blobs it shows, which takes about half a second on GitHub. A version fetches a directory's files in one request, the first time its listing or one of its files opens, so its first page takes about the same. -`--disk=SIZE` sets the cache's limit, 2G by default. When a fetch takes it over, www deletes the repos read longest ago until it fits. A repo larger than the limit on its own goes too, and its page says so.+`--disk=SIZE` sets the cache's limit, 2G by default. When a fetch takes it over, drvu deletes the repos read longest ago until it fits. A repo larger than the limit on its own goes too, and its page says so. -Delete the directory any time; www fetches what it needs again.+Delete the directory any time; drvu fetches what it needs again.  ## Staying current -A visit to a repo fetched over five minutes ago serves the cached commit at once and fetches in the background. A feed request is the exception: it waits for the fetch, see `doc/history.md`. When the branch moved, www builds the new commit's worktree beside the old one and swaps the link, so no page sees a half-updated tree. Open pages reload onto the new commit.+A visit to a repo fetched over five minutes ago serves the cached commit at once and fetches in the background. A feed request is the exception: it waits for the fetch, see `doc/history.md`. When the branch moved, drvu builds the new commit's worktree beside the old one and swaps the link, so no page sees a half-updated tree. Open pages reload onto the new commit.  The header of every page in the repo names the commit shown by its stardate, eg `@ 261029.3`, as a version's crumbs name a commit. Its hash and time show on hover. The stardate links the page in that commit's version, which stays put after the next fetch. A commit off the main line shows its hash instead. @@ -58,11 +58,11 @@ A fetch takes the branches and tags. It leaves out GitHub's pull request refs, w  A repo here has versions as a local tree has: `@` and a commit below the repo's address, eg `/github.com/junegunn/fzf@b412a45/main.go`, shows the repo as it was then, and its pages, history and share button link them. The clone holds every commit and tree, so a version's listings come at once; its files are fetched from the forge as a page first needs them. -The share button here copies the forge's own link at the commit the page shows, eg `https://github.com/junegunn/fzf/blob/<commit>/main.go#L10-L12`, since a link to this address opens only on this machine. Lines take the forge's form: `#L10-L12` on GitHub and Codeberg, `#L10-12` on GitLab and `#lines-10:12` on Bitbucket. A host www knows no link form for gets the page's own address.+The share button here copies the forge's own link at the commit the page shows, eg `https://github.com/junegunn/fzf/blob/<commit>/main.go#L10-L12`, since a link to this address opens only on this machine. Lines take the forge's form: `#L10-L12` on GitHub and Codeberg, `#L10-12` on GitLab and `#lines-10:12` on Bitbucket. A host drvu knows no link form for gets the page's own address.  ## Listings -A path that names no repo lists the repos below it, eg `/github.com/junegunn` or `/git.suckless.org`. git cannot list an account, so here alone www asks something else, in this order:+A path that names no repo lists the repos below it, eg `/github.com/junegunn` or `/git.suckless.org`. git cannot list an account, so here alone drvu asks something else, in this order:  - the forge's API: GitHub, GitLab, Bitbucket, and Forgejo or Gitea on any other host, such as Codeberg - a web frontend's index: gitweb's project index, or the front page of cgit or stagit@@ -72,19 +72,19 @@ The listing names its source and the sources that failed first, so a partial lis  ## On the open web -`www-public --disk=SIZE -a ADDR` serves online repos to anyone who reaches the address, eg through Caddy in front of it. It serves no tree from the machine and no other address, and it runs in the foreground for a service manager. `--share=HOST` binds a public address directly instead. `--base=/www` puts every URL below `/www`, for a proxy that gives www only that part of a domain; the proxy passes the path on whole.+`drvu-public --disk=SIZE -a ADDR` serves online repos to anyone who reaches the address, eg through Caddy in front of it. It serves no tree from the machine and no other address, and it runs in the foreground for a service manager. `--share=HOST` binds a public address directly instead. `--base=/drvu` puts every URL below `/drvu`, for a proxy that gives drvu only that part of a domain; the proxy passes the path on whole. -`www-public` is an executable of its own, built from the code `www` uses for online repos. It does not contain the bug button, the stop buttons, the index of servers, the browser launch, `--restart`, `-l`, `--kill`, `-p` or locks, so no flag or request can reach them. `make test` reads the binary's symbols and fails if one of them is there. `www --public` is gone and says where it went.+`drvu-public` is an executable of its own, built from the code `drvu` uses for online repos. It does not contain the bug button, the stop buttons, the index of servers, the browser launch, `--restart`, `-l`, `--kill`, `-p` or locks, so no flag or request can reach them. `make test` reads the binary's symbols and fails if one of them is there. `drvu --public` is gone and says where it went.  A visitor learns nothing of the machine or of what others read. `/` says only how to read a repo. A listing that no forge or web frontend gives is a 404, never the cache. Pages write the cache's paths from `cache/`, git's errors included.   No page has a stop or bug button, nothing opens a browser, and any Host header is answered, since nothing local is there to protect. -`--disk` is required, since any visitor can make www clone. A clone, fetch or checkout stops once the repo outgrows it or after 10 minutes, so a forge that sends without end cannot fill the disk or hold a clone's place.+`--disk` is required, since any visitor can make drvu clone. A clone, fetch or checkout stops once the repo outgrows it or after 10 minutes, so a forge that sends without end cannot fill the disk or hold a clone's place. -A visitor can name any host, so www fetches only from hosts whose every address is on the open internet: never loopback, a private or link-local range, or carrier-grade NAT. git connects only to the addresses checked and follows no redirect, and listings check each address they connect to. A repo's `.git` is hidden, and a link out of a repo is refused without saying where it leads, whatever marker lies there.+A visitor can name any host, so drvu fetches only from hosts whose every address is on the open internet: never loopback, a private or link-local range, or carrier-grade NAT. git connects only to the addresses checked and follows no redirect, and listings check each address they connect to. A repo's `.git` is hidden, and a link out of a repo is refused without saying where it leads, whatever marker lies there. -The limits aim at a bot that makes www clone without end, not at a reader. A repo already in the cache opens at any time. A visit to an uncached path starts a read: a probe, a clone or a listing.+The limits aim at a bot that makes drvu clone without end, not at a reader. A repo already in the cache opens at any time. A visit to an uncached path starts a read: a probe, a clone or a listing.  One address runs one read at a time and starts at most 20 within an hour. A second read waits on its reading page, which names the read ahead of it, and starts when that ends; reads run in the order asked. A waiting read counts from the moment it is asked. Over 20 an address gets a 429 with `Retry-After`, and the log names the address. An IPv6 address counts by its /64. Behind a proxy on loopback, eg Caddy, the visitor is the last address in `X-Forwarded-For`. @@ -96,7 +96,7 @@ One leak remains: a repo already in the cache opens at once, and one that is not  Every git call against a forge runs without your git config and without prompts or hooks, and only over HTTPS. A public repo is fetched without credentials. -When github.com asks for a login, `www` asks `gh auth token` for gh's login and reads the repo again with it, into `~/.cache/www-private/`, or `$XDG_CACHE_HOME/www-private/`. git gets the login through its environment, never its arguments, and sends it to github.com alone. It opens every repo the gh account can read. Without gh, or with gh logged out, the reading page says which. A share and `www-public` never read private repos, and `www-public` contains none of this code.+When github.com asks for a login, `drvu` asks `gh auth token` for gh's login and reads the repo again with it, into `~/.cache/drvu-private/`, or `$XDG_CACHE_HOME/drvu-private/`. git gets the login through its environment, never its arguments, and sends it to github.com alone. It opens every repo the gh account can read. Without gh, or with gh logged out, the reading page says which. A share and `drvu-public` never read private repos, and `drvu-public` contains none of this code.  Loopback is open to every account on the machine, so the web address answers only the account that runs its server. The kernel names each connection's owner in `/proc/net/tcp`; another account, or a connection whose owner cannot be told, gets 403. 

doc/options.md

@@ -1,10 +1,10 @@ # Options and environment -`www --help` prints the options in short. Here is each in full.+`drvu --help` prints the options in short. Here is each in full. -- `-a ADDR`, `--addr=ADDR`: serve on another loopback address, an IP or IP:PORT; the port defaults to 80 where www may bind it, else 8080+- `-a ADDR`, `--addr=ADDR`: serve on another loopback address, an IP or IP:PORT; the port defaults to 80 where drvu may bind it, else 8080 - `--share[=HOST]`: share the tree on the default route's address, or on the address or name given beyond loopback, with an optional port, such as `192.168.1.5`, `0.0.0.0` or `mate.peer.home`; see `doc/sharing.md`-- `--secret`: serve a shared tree under the token in `WWW_SECRET`, or a random one, so only those holding the link reach it+- `--secret`: serve a shared tree under the token in `DRVU_SECRET`, or a random one, so only those holding the link reach it - `--foreground`: when no server runs on the address yet, serve in the foreground until Ctrl-C - `--no-open`: print the URL without opening a browser - `--no-bug`: hide the bug button at the foot of each page and refuse reports; `--restart` passes it to the new servers when given@@ -12,35 +12,35 @@ - `--debug`: show what serves debugging: above each page's header, the build stamp, see `doc/debugging.md`; on the index, each server's build and start time and each lock's time. `make run` sets it; `--restart` passes it to the new servers when given, and leaves it off otherwise - `--cache=SIZE`: memory a new server may spend on cached git answers, eg `64M`; `0` caches nothing. The default is `32M`, and `--restart` goes back to it - `--disk=SIZE`: disk a new server may fill with online repos, eg `4G`; it drops the repos read longest ago, but not one that another server is fetching, since every server shares the cache. The default is `2G`, and `--restart` goes back to it-- `--base=PATH`: serve a new server's every URL below PATH, eg `--base=/www` for `http://127.31.1.1/www/notes/`; see `doc/servers.md`+- `--base=PATH`: serve a new server's every URL below PATH, eg `--base=/drvu` for `http://127.31.1.1/drvu/notes/`; see `doc/servers.md` - `--restart`: replace every server this binary started with one running it now, serving the same trees, and print each tree's URL; an address with persistent trees and no server gets one, when this binary served it last; with `-a` or `--share`, only the server on that address, whichever binary runs it; with a directory, it also serves that directory there and opens it in the browser unless a page of it was open, and says which - `-f`, `--force`: with `--restart`, take the servers and persistent trees of other binaries too - `-l`, `--list`: print each served tree's directory, URL and binary as keyval, on every address; with `-a` or `--share`, on that address only; with a directory, only the trees at or below it. A directory that holds no served tree prints nothing; one that does not exist fails with `E2` - `--kill`: stop every server and print the trees it served, as `--list` does; with `-a` or `--share`, only the server on that address. A server that serves no live tree is stopped too, and a line on stderr names it-- `--commit=REV`: print as keyval the commit REV names in the repo of DIR, or of the current directory: its full hash, its stardate and its subject. REV is a stardate, eg `261024.4`, a hash or any name git takes, so `git show $(www --commit=261024.4 | sed -n 's/^hash //p')` shows a commit seen on a page. A day and x, eg `261026.x`, works while one commit alone holds it. A commit or repo that is not there fails with `E2`-- `-V`, `--version`: print when the binary was built and the commit it came from, as the stamp says it, eg `www built 2026-10-21 12:49, from 1aa282c+modified`+- `--commit=REV`: print as keyval the commit REV names in the repo of DIR, or of the current directory: its full hash, its stardate and its subject. REV is a stardate, eg `261024.4`, a hash or any name git takes, so `git show $(drvu --commit=261024.4 | sed -n 's/^hash //p')` shows a commit seen on a page. A day and x, eg `261026.x`, works while one commit alone holds it. A commit or repo that is not there fails with `E2`+- `-V`, `--version`: print when the binary was built and the commit it came from, as the stamp says it, eg `drvu built 2026-10-21 12:49, from 1aa282c+modified` - `-h`, `--help`: print the options -`www-public` takes six of these: `-a`, `--share`, `--disk`, which it requires, `--cache`, `--debug` and `--base`, with `-V` and `-h`. It takes no directory. `www-public --help` prints them, and `doc/online-repos.md` says what it serves.+`drvu-public` takes six of these: `-a`, `--share`, `--disk`, which it requires, `--cache`, `--debug` and `--base`, with `-V` and `-h`. It takes no directory. `drvu-public --help` prints them, and `doc/online-repos.md` says what it serves. -Options follow GNU style. Short ones combine, as in `-pa 127.31.1.2`, and options may follow the directory. Optional values go joined, as in `--share=192.168.1.5`; with a space the address would be read as the directory, and www says so. `-f` and `-n` mean force and dry run in every tool of the author's, so `--foreground` and `--no-open` have no short form. The help text is written in docopt notation, except that docopt has no way to write the optional `=HOST`.+Options follow GNU style. Short ones combine, as in `-pa 127.31.1.2`, and options may follow the directory. Optional values go joined, as in `--share=192.168.1.5`; with a space the address would be read as the directory, and drvu says so. `-f` and `-n` mean force and dry run in every tool of the author's, so `--foreground` and `--no-open` have no short form. The help text is written in docopt notation, except that docopt has no way to write the optional `=HOST`. -`--list` and `--kill` print [keyval](https://unixfile.github.io/keyval/): three lines per tree, sorted, with every index the same width. The binary line is missing for a server that started before www recorded it.+`--list` and `--kill` print [keyval](https://unixfile.github.io/keyval/): three lines per tree, sorted, with every index the same width. The binary line is missing for a server that started before drvu recorded it.  ```-tree.0.binary /usr/bin/www+tree.0.binary /usr/bin/drvu tree.0.dir /home/t/keep/notes tree.0.url http://127.31.1.1/keep/notes/-tree.1.binary /home/t/scratch/github.com/unixfile/www/build/www-tree.1.dir /home/t/scratch/github.com/unixfile/www-tree.1.url http://127.31.1.1:8080/scratch/github.com/unixfile/www/+tree.1.binary /home/t/scratch/github.com/unixfile/dirview/build/drvu+tree.1.dir /home/t/scratch/github.com/unixfile/dirview+tree.1.url http://127.31.1.1:8080/scratch/github.com/unixfile/dirview/ ```  Two variables set the default addresses. `--help` shows each value and where it comes from, and an error from a bad value names its variable. -- `WWW_SHARE`: the address or name for a bare `--share`, eg `mate.peer.home`, in a start and in `--kill`, `--restart` and `--list`. Without it a bare `--share` takes the default route's address-- `WWW_ADDR`: the loopback address for a start without `-a`. `--list`, `--kill` and `--restart` without an address still cover every server+- `DRVU_SHARE`: the address or name for a bare `--share`, eg `mate.peer.home`, in a start and in `--kill`, `--restart` and `--list`. Without it a bare `--share` takes the default route's address+- `DRVU_ADDR`: the loopback address for a start without `-a`. `--list`, `--kill` and `--restart` without an address still cover every server -A third sets how a start opens its URL. `WWW_OPEN` holds the command, split at spaces, with `%s` where the URL goes, or the URL appended when no `%s` is given. `WWW_OPEN='brave-browser --app=%s'` opens a tree in an app window and `WWW_OPEN=firefox` in Firefox. It applies to loopback starts only; a share opens through `xdg-open`, as every start does without the variable. A window of its own, without tabs or an address bar, needs `--app=%s`, which Brave, Chrome, Chromium, Edge, Vivaldi and Opera take. Firefox has no such flag; `firefox --new-window` opens a window with its usual bars. `surf %s` opens a WebKit window with none.+A third sets how a start opens its URL. `DRVU_OPEN` holds the command, split at spaces, with `%s` where the URL goes, or the URL appended when no `%s` is given. `DRVU_OPEN='brave-browser --app=%s'` opens a tree in an app window and `DRVU_OPEN=firefox` in Firefox. It applies to loopback starts only; a share opens through `xdg-open`, as every start does without the variable. A window of its own, without tabs or an address bar, needs `--app=%s`, which Brave, Chrome, Chromium, Edge, Vivaldi and Opera take. Firefox has no such flag; `firefox --new-window` opens a window with its usual bars. `surf %s` opens a WebKit window with none. -A fourth holds a share's token. `WWW_SECRET` gives `--secret` a token of letters, digits, `-` and `_` instead of a random one. The token never goes on the command line, where `ps` shows it to every local user and the shell keeps it in its history, so `--secret=token` fails with `E22`. `--help` says whether the variable is set but never shows its value.+A fourth holds a share's token. `DRVU_SECRET` gives `--secret` a token of letters, digits, `-` and `_` instead of a random one. The token never goes on the command line, where `ps` shows it to every local user and the shell keeps it in its history, so `--secret=token` fails with `E22`. `--help` says whether the variable is set but never shows its value.

doc/pages.md

@@ -28,9 +28,9 @@ Docs follow CommonMark with GitHub's extensions, rendered by goldmark: tables, s  Lines join into a paragraph, and a blank line starts the next. A line that starts with a dash begins a list even right after text. Straight quotes and dashes turn typographic. -Text is hyphenated by the rules of its language, which the browser picks from a block's `lang`. www tells each block's language from its commonest words, eg `och`, `att` and `inte` for Swedish, and marks every block that is not English. It knows English, Swedish, Danish, Norwegian, German, Dutch, French, Spanish, Italian and Portuguese.+Text is hyphenated by the rules of its language, which the browser picks from a block's `lang`. drvu tells each block's language from its commonest words, eg `och`, `att` and `inte` for Swedish, and marks every block that is not English. It knows English, Swedish, Danish, Norwegian, German, Dutch, French, Spanish, Italian and Portuguese. -A block is a paragraph, heading, list, quote or table at the doc's top level. One too short to tell, such as a heading, takes the language of the doc as a whole. A doc in a language www does not know counts as English. Code and raw HTML are neither read nor marked.+A block is a paragraph, heading, list, quote or table at the doc's top level. One too short to tell, such as a heading, takes the language of the doc as a whole. A doc in a language drvu does not know counts as English. Code and raw HTML are neither read nor marked.  A quote whose first line is only `[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]` or `[!CAUTION]` becomes an alert. The marker gives way to a small mono label that names its kind, and the alert keeps full strength where a plain quote fades. A marker with text after it on the same line stays a plain quote. @@ -42,7 +42,7 @@ Every gap between blocks is the same, whether the block is a paragraph, list, ta  ## PDF -pdf in a doc's header, beside raw, saves the doc as a PDF file, eg `README.pdf`. `?pdf` asks for it directly. weasyprint draws it from the page www renders, with the same stylesheet and fonts, on A4 pages and without the header, search row or buttons.+pdf in a doc's header, beside raw, saves the doc as a PDF file, eg `README.pdf`. `?pdf` asks for it directly. weasyprint draws it from the page drvu renders, with the same stylesheet and fonts, on A4 pages and without the header, search row or buttons.  weasyprint reaches only the server that asked, as a browser on the page may. An image from another host, or a `file:` URL, stays out of the PDF. @@ -78,24 +78,24 @@ The server watches the directory of each open page and its repo's git directory  ## Look -The stylesheet is www's own. It began as md2html-default's, whose light palette it keeps, and the page colours sit as variables on `:root`.+The stylesheet is drvu's own. It began as md2html-default's, whose light palette it keeps, and the page colours sit as variables on `:root`.  A page turns dark when the OS asks for it, with a grey palette. The dark palette is a first draft. -The header's right end names the mode in force, eg `▸ system`, and opens like the menu of versions. The menu sets the mode by hand: `light`, `system`, `dark` and `green`. Green is green text on near black, and only the menu or `:green` turns it on. Diffs and the kill button keep their red and green in it, since those colours carry meaning. Each mode shows in its own colours: light as a light page, dark as a dark one, green as a green one, system as the OS has it now. The one in force has a border. A choice, a click outside the menu or Escape closes it. `system` follows the OS again. The browser keeps the choice per server address, so a server on another address starts with the system's mode, and nothing goes to the server. The light, dark and system modes write each colour as `light-dark(light, dark)`, which browsers know since 2024; an older one shows pages without www's colours. Green sets plain colours.+The header's right end names the mode in force, eg `▸ system`, and opens like the menu of versions. The menu sets the mode by hand: `light`, `system`, `dark` and `green`. Green is green text on near black, and only the menu or `:green` turns it on. Diffs and the kill button keep their red and green in it, since those colours carry meaning. Each mode shows in its own colours: light as a light page, dark as a dark one, green as a green one, system as the OS has it now. The one in force has a border. A choice, a click outside the menu or Escape closes it. `system` follows the OS again. The browser keeps the choice per server address, so a server on another address starts with the system's mode, and nothing goes to the server. The light, dark and system modes write each colour as `light-dark(light, dark)`, which browsers know since 2024; an older one shows pages without drvu's colours. Green sets plain colours. -The browser loads the stylesheet once. Its URL names a hash of its content, eg `/_www/style.7b94a08e7731.css`, so it is kept for a year, and a changed stylesheet comes under a new URL.+The browser loads the stylesheet once. Its URL names a hash of its content, eg `/_drvu/style.7b94a08e7731.css`, so it is kept for a year, and a changed stylesheet comes under a new URL.  The header names a tree by its base name and shows the full path on hover. Every tree page's breadcrumbs start at `index`, which links `/`. -The header, listings and www's own messages are mono; documents keep the serif. Mono text shows no ligatures, so `<=` stays two characters in any font.+The header, listings and drvu's own messages are mono; documents keep the serif. Mono text shows no ligatures, so `<=` stays two characters in any font.  Every page keeps one width, 58ch of the body font, and keeps space for a scrollbar, so the header holds still from page to page. Code is smaller than the body text and never under 11px. A code block in a document fits 99 columns in that width, and so does a diff, its leading sign included. A code page fits 104: a line number of up to four digits, a space and 99 columns of code. Longer lines scroll.  ## Fonts -Pages load no fonts from the network. STIX Two Text, the serif, and Iosevka, the mono, come from the machine when installed. Otherwise they come from subsets built into www, which the browser caches for a year.+Pages load no fonts from the network. STIX Two Text, the serif, and Iosevka, the mono, come from the machine when installed. Otherwise they come from subsets built into drvu, which the browser caches for a year. -Each face has a core file for Latin text and www's own signs, about 25 KB for the serif and 15 KB for the mono, so a plain page fetches about 40 KB of font. A second file per face holds Greek, Cyrillic and symbols, and the browser fetches it only for a page that uses them.+Each face has a core file for Latin text and drvu's own signs, about 25 KB for the serif and 15 KB for the mono, so a plain page fetches about 40 KB of font. A second file per face holds Greek, Cyrillic and symbols, and the browser fetches it only for a page that uses them.  Text shows at once in a fallback font and switches when the file arrives.

doc/safety.md

@@ -1,12 +1,12 @@ # Safety -www refuses to serve the home directory and every directory above it, such as `/home` and `/`. A tree exposes everything below it, and home holds `~/.ssh`, `~/.gnupg` and every token file.+drvu refuses to serve the home directory and every directory above it, such as `/home` and `/`. A tree exposes everything below it, and home holds `~/.ssh`, `~/.gnupg` and every token file.  ## Symlinks  Symlinks inside the tree are followed, absolute ones included. -A link that leads out of the tree is followed only into a directory that holds a file named `.www-follow`, or below one, and only when other users could read the target. A file needs the others-read bit and a directory others-read and others-execute, checked from the marker's directory down. So nobody reads through www what `cat` would not show them.+A link that leads out of the tree is followed only into a directory that holds a file named `.drvu-follow`, or below one, and only when other users could read the target. A file needs the others-read bit and a directory others-read and others-execute, checked from the marker's directory down. So nobody reads through drvu what `cat` would not show them.  A store of private files linked into repos, such as lord's `~/.local/share/lord`, opens with one marker in its root. Secrets kept there at mode 600 stay refused. @@ -16,11 +16,11 @@ Opening a refused link shows the link, its target and the reason. The listing ma  A loopback server answers only to loopback addresses, `localhost` and names that `/etc/hosts` maps to loopback. -Its Content-Security-Policy forbids every script but www's own, which it allows by hash. www's script reloads pages, marks changed blocks, walks listings by arrow and opens history folds. Raw HTML in a doc passes through, so a README in a cloned repo could otherwise run code on this origin.+Its Content-Security-Policy forbids every script but drvu's own, which it allows by hash. drvu's script reloads pages, marks changed blocks, walks listings by arrow and opens history folds. Raw HTML in a doc passes through, so a README in a cloned repo could otherwise run code on this origin.  ## Code in a tree -www runs no code a tree supplies. It reads files and runs git with every option turned off that would start a program named in the repo's config: the pager, textconv, external diff, signature checks, fsmonitor and fetching.+drvu runs no code a tree supplies. It reads files and runs git with every option turned off that would start a program named in the repo's config: the pager, textconv, external diff, signature checks, fsmonitor and fetching.  ## Other users 

doc/search.md

@@ -8,7 +8,7 @@ On a listing it searches the directory, nearest first. The directory's own names  A line result takes one row, cut so the match shows, and opens a code page at its line. A file shows its first three matching lines, then `+N more`, which opens the file filtered by the query. -What git ignores comes last, behind one link: `1 hit in 1 ignored file`. Following it shows the hits. A repo inside the tree counts its own ignores. www asks git what it ignores at most once every 10 seconds per directory, so a file that becomes ignored can show as ordinary for that long. A search started inside an ignored directory treats its contents as ordinary. Limits apply per level, so a deep directory full of hits cannot crowd out a shallower one.+What git ignores comes last, behind one link: `1 hit in 1 ignored file`. Following it shows the hits. A repo inside the tree counts its own ignores. drvu asks git what it ignores at most once every 10 seconds per directory, so a file that becomes ignored can show as ordinary for that long. A search started inside an ignored directory treats its contents as ordinary. Limits apply per level, so a deep directory full of hits cannot crowd out a shallower one.  Any other page filters itself, and each match is marked: @@ -45,7 +45,7 @@ Kill server and Delete lock take a second Enter. Files and directories are not c  ## Copy buttons -Beside the box, ⧉ copies the page's text: what lies below the box, without www's own lines and links or line numbers. A code page copies as its file and a listing as its names. A doc copies its Markdown, and lines a range marks, eg `#L3-L26`, copy alone. What a search hides stays out.+Beside the box, ⧉ copies the page's text: what lies below the box, without drvu's own lines and links or line numbers. A code page copies as its file and a listing as its names. A doc copies its Markdown, and lines a range marks, eg `#L3-L26`, copy alone. What a search hides stays out.  Beside it, ⤴ copies a link to what is selected: 

doc/servers.md

@@ -1,30 +1,30 @@ # Servers and locks -Run `www` in a directory. It prints the tree's URL, opens the browser and writes a lockfile named after the endpoint, such as `127.31.1.1-8080.lock`. `cat` the lockfile to see the URL, root, PID and start time.+Run `drvu` in a directory. It prints the tree's URL, opens the browser and writes a lockfile named after the endpoint, such as `127.31.1.1-8080.lock`. `cat` the lockfile to see the URL, root, PID and start time. -The URL is all it prints, so `url=$(www --no-open)` works. Running `www` again in a served directory prints the same URL and starts nothing.+The URL is all it prints, so `url=$(drvu --no-open)` works. Running `drvu` again in a served directory prints the same URL and starts nothing.  Delete the lockfile to stop serving the tree. The Delete lock button on the tree's pages does the same.  ## One server per address -Trees on one address share one server. The first `www` starts it in the background, and later ones hand their tree to it and return.+Trees on one address share one server. The first `drvu` starts it in the background, and later ones hand their tree to it and return. -When something other than your www on that address holds the port, `www` fails at once with `E98` and names the listeners there.+When something other than your drvu on that address holds the port, `drvu` fails at once with `E98` and names the listeners there. -The server exits when its last lock is gone, except on your default address. That server also serves the web address, which answers at all times, so it stays up with no tree. SIGTERM stops any server at once and removes every lock but a persistent `.LOCK`, as do the Kill server button on the index at `/` and `www --kill`.+The server exits when its last lock is gone, except on your default address. That server also serves the web address, which answers at all times, so it stays up with no tree. SIGTERM stops any server at once and removes every lock but a persistent `.LOCK`, as do the Kill server button on the index at `/` and `drvu --kill`.  Delete lock and Kill server answer 410 Gone. The page shows the code and "Gone" on the line below it, then names each tree stopped, its lock removed or kept, and whether the server serves on.  ## Restarts -A running server keeps the binary it started with. `www --restart` moves every server's trees to the current binary, and `make install` and `make install-deb` run it for you. Open tabs reload onto the new binary, and it says how many did.+A running server keeps the binary it started with. `drvu --restart` moves every server's trees to the current binary, and `make install` and `make install-deb` run it for you. Open tabs reload onto the new binary, and it says how many did.  It moves only the servers its own binary started, so the package and a build from `make install` leave each other's servers alone. It names each server it leaves, and `-f` takes them too. `make install-deb` passes `-f`, since it removes the `make install` link.  A binary without the capability for port 80, such as the one from `make install`, leaves a port-80 server on its old binary and says so. -`www --restart` also starts a server on its binary's default address when none runs there, with no tree, so the web address answers. A server there with no tree is replaced by the current binary, as one with trees is. `-a` or `--share` limits it to that address and starts nothing else.+`drvu --restart` also starts a server on its binary's default address when none runs there, with no tree, so the web address answers. A server there with no tree is replaced by the current binary, as one with trees is. `-a` or `--share` limits it to that address and starts nothing else.  ## The index @@ -36,53 +36,53 @@ The package's binary and the one `make install` links are listed under No server  With `--debug`, each server also says when its binary was built, from which commit and when the server started, and each tree when its lock was written. These serve debugging, so they are hidden otherwise. -To reach the server by name, add a line such as `127.31.1.1 www` to `/etc/hosts`. Type the name with its slash, eg `www/`, or the browser searches for it.+To reach the server by name, add a line such as `127.31.1.1 drvu` to `/etc/hosts`. Type the name with its slash, eg `drvu/`, or the browser searches for it.  ## Addresses -Each user owns 127.31.N.0/24 with N = uid − 1000. www serves on 127.31.N.1 by default, on port 80 where it may bind it, else 8080, and online repos on 127.31.N.2.+Each user owns 127.31.N.0/24 with N = uid − 1000. drvu serves on 127.31.N.1 by default, on port 80 where it may bind it, else 8080, and online repos on 127.31.N.2.  Uids from 1000 to 1255 fit; others need `--addr`. `-a` takes only loopback addresses; `--share` takes the others.  ## Serving after reboot -`www -p` writes a lock in capitals, such as `127.31.1.1-8080.LOCK`. It holds no PID, and it outlives its server: Kill server, `--kill`, SIGTERM and a reboot all stop the server but leave the `.LOCK` in place.+`drvu -p` writes a lock in capitals, such as `127.31.1.1-8080.LOCK`. It holds no PID, and it outlives its server: Kill server, `--kill`, SIGTERM and a reboot all stop the server but leave the `.LOCK` in place. -The next server on that address serves the tree again. So does `www --restart`, which starts a server for every address whose persistent trees have none.+The next server on that address serves the tree again. So does `drvu --restart`, which starts a server for every address whose persistent trees have none. -Deleting the `.LOCK`, or Delete lock on the tree's pages, ends the tree for good. `www -p` in a tree served by a plain `.lock` moves it to a `.LOCK`, and a plain `www` in a tree that holds a `.LOCK` keeps it.+Deleting the `.LOCK`, or Delete lock on the tree's pages, ends the tree for good. `drvu -p` in a tree served by a plain `.lock` moves it to a `.LOCK`, and a plain `drvu` in a tree that holds a `.LOCK` keeps it.  ## Systemd units -A systemd user unit runs `www --restart` at login, which also starts the server on the default address with no tree. Both ship disabled. They serve from login to logout, and linger stays off.+A systemd user unit runs `drvu --restart` at login, which also starts the server on the default address with no tree. Both ship disabled. They serve from login to logout, and linger stays off. -- The package puts `www.service` in `/usr/lib/systemd/user/`. Enable it with `systemctl --user enable www`.-- `make install` puts `www-dev.service` in `~/.config/systemd/user/`. Enable it with `systemctl --user enable www-dev`.+- The package puts `drvu.service` in `/usr/lib/systemd/user/`. Enable it with `systemctl --user enable drvu`.+- `make install` puts `drvu-dev.service` in `~/.config/systemd/user/`. Enable it with `systemctl --user enable drvu-dev`.  Each brings back only the trees its own binary served last, so with both installs both units run. -The package also ships a system template, `www@.service`, which serves a user's trees from boot, before login, with the capability for port 80. Enable it with `sudo systemctl enable www@<user>`.+The package also ships a system template, `dirview@.service`, which serves a user's trees from boot, before login, with the capability for port 80. Enable it with `sudo systemctl enable dirview@<user>`. -While the template or the package's user unit runs for a user, the other stands aside, since both run one binary on the same trees. `www-dev` runs beside either.+While the template or the package's user unit runs for a user, the other stands aside, since both run one binary on the same trees. `drvu-dev` runs beside either.  ## Registry -Each endpoint has a registry directory such as `~/.local/state/www/127.31.1.1-8080/` with a symlink to each lock its server holds. `$XDG_STATE_HOME` replaces `~/.local/state` when set.+Each endpoint has a registry directory such as `~/.local/state/drvu/127.31.1.1-8080/` with a symlink to each lock its server holds. `$XDG_STATE_HOME` replaces `~/.local/state` when set. -A joining `www` adds a link, and the server sees it through inotify, writes the lock and serves the tree. Where inotify fails the server polls every second. It also polls while it serves a tree on a network mount, eg sshfs, NFS or SMB, since inotify there misses what another host changes, such as a lock deleted on the far side. An flock on the directory keeps a tree from joining a server on its way out.+A joining `drvu` adds a link, and the server sees it through inotify, writes the lock and serves the tree. Where inotify fails the server polls every second. It also polls while it serves a tree on a network mount, eg sshfs, NFS or SMB, since inotify there misses what another host changes, such as a lock deleted on the far side. An flock on the directory keeps a tree from joining a server on its way out.  A lock left by a crash is detected on the next start through its PID and the kernel boot ID, then removed. A new server also clears what a crashed server left in the registry. -A server that holds its address but serves no live tree, eg one that missed its last lock going, makes a new `www` there fail with `E98`, naming the server's PID. `www --kill -a ADDR` stops it.+A server that holds its address but serves no live tree, eg one that missed its last lock going, makes a new `drvu` there fail with `E98`, naming the server's PID. `drvu --kill -a ADDR` stops it. -A lock also names the server's PID namespace. Inside a sandbox or container, another namespace's PID says nothing, so www takes that server to be running: it keeps the lock, lists the tree and refuses `--kill` and `--restart` with E1. If that server has crashed, its lock stays until a reboot or until you delete it. A lock written before locks named their namespace counts as the host's. A `www` that cannot read its own namespace from `/proc` treats every lock this way.+A lock also names the server's PID namespace. Inside a sandbox or container, another namespace's PID says nothing, so drvu takes that server to be running: it keeps the lock, lists the tree and refuses `--kill` and `--restart` with E1. If that server has crashed, its lock stays until a reboot or until you delete it. A lock written before locks named their namespace counts as the host's. A `drvu` that cannot read its own namespace from `/proc` treats every lock this way.  ## A base path -`--base=PATH` puts every URL of a new server below PATH, eg `www --base=/www` serves `~/notes` at `/www/notes/`. It is for a proxy that gives www one part of a domain, eg `example.org/www/`, beside other sites. The proxy passes the path on whole, base included.+`--base=PATH` puts every URL of a new server below PATH, eg `drvu --base=/drvu` serves `~/notes` at `/drvu/notes/`. It is for a proxy that gives drvu one part of a domain, eg `example.org/drvu/`, beside other sites. The proxy passes the path on whole, base included. -The base covers everything www writes and answers: trees, the index at `/www/`, the stylesheet and fonts, the stop and bug forms, redirects and the web address's repos. `/www` alone redirects to `/www/`. A path outside the base is a 404.+The base covers everything drvu writes and answers: trees, the index at `/drvu/`, the stylesheet and fonts, the stop and bug forms, redirects and the web address's repos. `/drvu` alone redirects to `/drvu/`. A path outside the base is a 404.  A base is one or more segments of letters, digits, `-`, `.` and `_`, and no segment starts with `_`. -A base belongs to a server, not to a tree. A tree that joins a running server takes the server's base, and www says so when `--base` named another. `--restart` keeps each server's base, so it takes no `--base`; to change one, stop the server with `--kill` and start it again.+A base belongs to a server, not to a tree. A tree that joins a running server takes the server's base, and drvu says so when `--base` named another. `--restart` keeps each server's base, so it takes no `--base`; to change one, stop the server with `--kill` and start it again.

doc/sharing.md

@@ -1,24 +1,24 @@ # Sharing -`www --share [DIR]` serves a tree on the address of the default route, so other machines on the LAN can read it. www asks the kernel which source address it would use to leave the machine, and the printed URL shows it. Over a full-tunnel VPN that is the tunnel's address.+`drvu --share [DIR]` serves a tree on the address of the default route, so other machines on the LAN can read it. drvu asks the kernel which source address it would use to leave the machine, and the printed URL shows it. Over a full-tunnel VPN that is the tunnel's address. -`WWW_SHARE`, eg `WWW_SHARE=mate.peer.home`, gives a bare `--share` another address, for `--kill --share` and `--restart --share` as well.+`DRVU_SHARE`, eg `DRVU_SHARE=mate.peer.home`, gives a bare `--share` another address, for `--kill --share` and `--restart --share` as well. -`--share=HOST` names the address instead, an IP or IP:PORT, joined with `=`: `--share 192.168.1.5` would read the address as the directory. Any IPv4 address the machine lets www bind will do, `0.0.0.0` included. A name will do too, such as `--share=mate.peer.home`: www binds the address it resolves to, which an interface here must hold.+`--share=HOST` names the address instead, an IP or IP:PORT, joined with `=`: `--share 192.168.1.5` would read the address as the directory. Any IPv4 address the machine lets drvu bind will do, `0.0.0.0` included. A name will do too, such as `--share=mate.peer.home`: drvu binds the address it resolves to, which an interface here must hold. -The printed URL carries the address's name when its reverse lookup resolves back to it, so a share on a WireGuard address with its own DNS prints `http://mate.peer.home/notes/`. Otherwise it carries the address. The port defaults to 80 where www may bind it, else 8080, as on loopback. `-a` takes only loopback addresses, so a typo there cannot share a tree.+The printed URL carries the address's name when its reverse lookup resolves back to it, so a share on a WireGuard address with its own DNS prints `http://mate.peer.home/notes/`. Otherwise it carries the address. The port defaults to 80 where drvu may bind it, else 8080, as on loopback. `-a` takes only loopback addresses, so a typo there cannot share a tree.  A shared address gets a server of its own, apart from the loopback one. More trees join it with the same `--share` address. The lock is named after the address, such as `192.168.1.5-80.lock`, and deleting it stops the share. -`www --kill --share` stops every tree on that address. `www --restart --share` moves the trees to a new binary. `www -l` lists shared trees with the rest.+`drvu --kill --share` stops every tree on that address. `drvu --restart --share` moves the trees to a new binary. `drvu -l` lists shared trees with the rest. -On `0.0.0.0` the printed URL carries the machine's name, since the server answers on every address. `0.0.0.0` claims its port on every address, so it cannot bind a port that any listener holds, the loopback www included. www then fails with `E98` and names the listeners on that port. Share on one address, or give `0.0.0.0` another port.+On `0.0.0.0` the printed URL carries the machine's name, since the server answers on every address. `0.0.0.0` claims its port on every address, so it cannot bind a port that any listener holds, the loopback drvu included. drvu then fails with `E98` and names the listeners on that port. Share on one address, or give `0.0.0.0` another port.  ## What a visitor sees  A shared tree mounts at its base name, eg `http://192.168.1.69/notes/`. The URL does not reveal where the tree lives on the machine. -The server serves only what other users on the machine could read. A file needs the others-read bit, and every directory from the tree's root down to it needs others-read and others-execute. Links out of the tree follow the `.www-follow` rule as on loopback.+The server serves only what other users on the machine could read. A file needs the others-read bit, and every directory from the tree's root down to it needs others-read and others-execute. Links out of the tree follow the `.drvu-follow` rule as on loopback.  Names that begin with a dot are neither listed nor served, at any depth, nor are links that lead to them inside the tree: `.git` holds the history and every deleted file. @@ -39,7 +39,7 @@ note: other machines connect to 192.168.1.69:80; a firewall here may drop them u       Check with: sudo tcpdump -ni wlp0s20f3 tcp port 80 ``` -www cannot find out by itself. A firewall drops the connection before any socket sees it, reading the ruleset needs root, and a test from this machine goes through loopback and passes.+drvu cannot find out by itself. A firewall drops the connection before any socket sees it, reading the ruleset needs root, and a test from this machine goes through loopback and passes.  Run the capture and load the URL on the other machine: @@ -57,7 +57,7 @@ sudo nft insert rule inet <table> input ip saddr 192.168.1.0/24 tcp dport 80 acc  ## Secret paths -`--secret` mounts the tree under a random 128-bit token instead of its name, eg `http://192.168.1.5/lz7sjx3g2cvx54ev7ndbzf7i7q/`, and leaves it off the index. Only those holding the link reach it. `WWW_SECRET` sets a token of your own, of letters, digits, `-` and `_`. The command line takes none, since `ps` would show it to every local user.+`--secret` mounts the tree under a random 128-bit token instead of its name, eg `http://192.168.1.5/lz7sjx3g2cvx54ev7ndbzf7i7q/`, and leaves it off the index. Only those holding the link reach it. `DRVU_SECRET` sets a token of your own, of letters, digits, `-` and `_`. The command line takes none, since `ps` would show it to every local user.  The token also guards against DNS rebinding. Without it, a hostile web page could read a share through the browser of a visitor on the same network. 

doc/speed.md

@@ -1,6 +1,6 @@ # Speed -www is fast. A page from a running server takes one to three milliseconds and a server starts in about 40 ms. A test in `make test` fails any page that takes over 5 ms.+drvu is fast. A page from a running server takes one to three milliseconds and a server starts in about 40 ms. A test in `make test` fails any page that takes over 5 ms.  ## Git's answers @@ -14,7 +14,7 @@ The cache holds only what someone has visited, with one exception. When a tree j  In a large repo git can take a second for a history, because it reads every commit back to the ones that touched the path. -When it takes over 100 ms, the history page says so and names `git commit-graph write --reachable --changed-paths`. That builds git's index of the paths each commit changed and makes such histories several times faster. www never writes to the repo itself.+When it takes over 100 ms, the history page says so and names `git commit-graph write --reachable --changed-paths`. That builds git's index of the paths each commit changed and makes such histories several times faster. drvu never writes to the repo itself.  ## Benchmarks 

endpoint.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"@@ -56,7 +56,7 @@ var ( 	secretEnv = envPrefix + "SECRET" ) -// secretToken returns the token in WWW_SECRET, or a random one when it is+// secretToken returns the token in DRVU_SECRET, or a random one when it is // unset. A bad token's error names the variable but not its value, which // is a secret. func secretToken() (string, error) {@@ -70,9 +70,9 @@ func secretToken() (string, error) { 	return v, nil } -// endpointOf returns where c serves. A bare --share takes WWW_SHARE,-// and a start without -a takes WWW_ADDR; --list, --kill and --restart-// without an address cover every server, so WWW_ADDR leaves them be.+// endpointOf returns where c serves. A bare --share takes DRVU_SHARE,+// and a start without -a takes DRVU_ADDR; --list, --kill and --restart+// without an address cover every server, so DRVU_ADDR leaves them be. // An error from a variable's value names the variable. func endpointOf(c config, uid int) (netip.AddrPort, error) { 	if c.sharing {

endpoint_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"strings"@@ -19,7 +19,7 @@ func TestHasCap(t *testing.T) { 	} } -// A chosen token comes from WWW_SECRET, never the command line, and a bad+// A chosen token comes from DRVU_SECRET, never the command line, and a bad // one's error names the variable without echoing the secret. func TestSecretToken(t *testing.T) { 	t.Setenv(secretEnv, "k3x9")

feed.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"@@ -97,7 +97,7 @@ func (t *tree) serveFeed(w http.ResponseWriter, r *http.Request, name string, di  // linkOrigin is the scheme and host r reached, eg http://127.31.1.1, for links // that leave the page. A proxy on loopback that ends TLS, such as Caddy-// before www-public, names the scheme in X-Forwarded-Proto; any other+// before drvu-public, names the scheme in X-Forwarded-Proto; any other // peer's header is ignored, since it could claim anything. func linkOrigin(r *http.Request) string { 	scheme := "http"

feed_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"encoding/xml"

forge.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

forge_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

formats.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"crypto/sha256"

formats_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"os"

git.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"@@ -48,7 +48,7 @@ type commit struct { // run, so the options that would start one are off, fsmonitor among them // whichever command runs, and git may not fetch a partial clone's missing // objects. Pathspecs are literal, and no GIT_-// variable from www's own environment leaks in. git's safe.directory+// variable from drvu's own environment leaks in. git's safe.directory // check refuses repos that other users own. // // In web's cache git may reach a forge, since a repo there is a partial

git_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"fmt"

githead.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bufio"

go.mod

@@ -1,4 +1,4 @@-module www+module dirview  go 1.26 

golex.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"go/scanner"

gone.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

gone_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

graph.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"

gron.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"

gron_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"os"

guard.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"fmt"@@ -112,7 +112,7 @@ func guard(next http.Handler, anyHost bool) http.Handler { var hostsFile = "/etc/hosts"  // localHost accepts a loopback address, localhost, or a name that the hosts-// file maps to loopback, eg an www instance named there. DNS is never+// file maps to loopback, eg a drvu instance named there. DNS is never // asked: a DNS name that resolves to loopback is the rebinding attack itself. func localHost(host string) bool { 	if strings.EqualFold(host, "localhost") {

guard_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

historypage.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"@@ -202,7 +202,7 @@ func (t *tree) serveLog(w http.ResponseWriter, r *http.Request, name string, dir 	} 	// git walks every commit back to the ones that touched name, unless 	// the repo's commit-graph tells it which paths each commit changed.-	// www leaves the repo alone and names the command instead. A share+	// drvu leaves the repo alone and names the command instead. A share 	// says nothing, since its viewer cannot run it. 	if took > slowGit && !t.shared && t.lacksPathFilters(r.Context(), name) { 		fmt.Fprintf(&body, "<p class=\"own\">git took %d ms for this history. "+

historypage_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

index.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"fmt"

index_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net"

jslex.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"strings"

lex.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"strings"

lexcheck_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"io/fs"@@ -13,8 +13,8 @@ import (  // TestOwnLexersMatchChroma compares the program's own lexers with // chroma's, byte by byte, by the class each byte gets on a page.-// WWW_LEXCHECK names the files and directories to compare, eg-// WWW_LEXCHECK=/usr/lib/python3.11; without it the test is skipped. It+// DRVU_LEXCHECK names the files and directories to compare, eg+// DRVU_LEXCHECK=/usr/lib/python3.11; without it the test is skipped. It // reports the share of bytes that agree per language and the first lines // that differ. func TestOwnLexersMatchChroma(t *testing.T) {

links.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"errors"

links_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

list.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"errors"

list_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"strings"

live.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"@@ -50,7 +50,7 @@ var goneWait = 2 * time.Second  // live tells open pages when what they show has changed. A page names its // version: the server instance that rendered it and what the page showed.-// It keeps a stream open on /_www/live, which wakes on any change in+// It keeps a stream open on /_drvu/live, which wakes on any change in // the directories the page reads from and sends one event, reload, when // the version is no longer current. type live struct {

live_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bufio"

lock.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"

lock_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"fmt"@@ -86,7 +86,7 @@ func setPIDNS(t *testing.T, ns string) { }  // A PID from another namespace says nothing here. Deleting its lock stopped-// a live server when `www -l` ran inside a sandbox. A lock written before+// a live server when `drvu -l` ran inside a sandbox. A lock written before // locks named their namespace counts as the host's, so a sandbox keeps it // and the host still clears it once its server is gone. A reader that // cannot name its own namespace can check no PID.

log.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"@@ -15,10 +15,10 @@ import ( 	"time" ) -// www logs every action, so a later look can tell what the user and-// www did: each run with its arguments, each server's start and stop+// drvu logs every action, so a later look can tell what the user and+// drvu did: each run with its arguments, each server's start and stop // with the cause, trees joining and leaving, and page requests. Entries go-// to the systemd journal, tagged www, or to a file in the state+// to the systemd journal, tagged drvu, or to a file in the state // directory where no journal runs. Nothing is filtered when written; the // journal's PRIORITY filters when read. @@ -106,7 +106,7 @@ func journalEntry(prio int, ep, msg string) []byte { 	return b.Bytes() } -// logFile is the fallback log, eg ~/.local/state/www/log.+// logFile is the fallback log, eg ~/.local/state/drvu/log. func logFile() (string, error) { 	base, err := stateDir() 	if err != nil {@@ -201,7 +201,7 @@ func logSink() *os.File { 	return f } -// build names the running binary and its commit, eg /usr/bin/www+// build names the running binary and its commit, eg /usr/bin/drvu // 54cca2a, with +modified for a build from uncommitted code. A stale binary // is the first thing to rule out. func build() string {

log_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"

lookup.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

lookup_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

main.go

@@ -1,8 +1,8 @@-// Package www browses trees of Markdown docs in the browser. It renders+// Package dirview browses trees of Markdown docs in the browser. It renders // each page with goldmark when requested and mirrors the file tree in its // URLs. Trees on one address share a server, which lives while their locks // exist. The executables under cmd/ share it.-package www+package dirview  import ( 	"bufio"@@ -104,7 +104,7 @@ func noteRun() { 	} } -// errno is an error with the code www exits with.+// errno is an error with the code drvu exits with. type errno struct { 	code syscall.Errno 	msg  string@@ -158,7 +158,7 @@ func show(kind, text string, noopen bool) { 	} } -// detach re-runs www in a new session and relays its start report.+// detach re-runs drvu in a new session and relays its start report. // Go cannot fork safely, so a re-exec is the way to background itself. func detach(c config) int { 	r, w, err := os.Pipe()

name.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	_ "embed"@@ -6,17 +6,18 @@ import ( 	"syscall" ) -//go:embed WORKING_NAME+//go:embed NAME var nameFile string -// progName is the program's name, from the file WORKING_NAME, which the-// Makefile and the package files read too. Every path, variable, URL and-// message that names the program derives from it, so a rename changes one-// word.+// progName is the program's name, from the file NAME, which the Makefile+// and the package files read too. Every path, variable, URL and message+// that names the program derives from it, so a rename changes one word.+// The project, its module and its Debian package carry a name of their+// own, which go.mod holds. var progName = strings.TrimSpace(nameFile)  // envPrefix starts the name of every environment variable the program-// reads, eg WWW_ADDR.+// reads, eg DRVU_ADDR. var envPrefix = strings.ToUpper(progName) + "_"  // ownPath is the URL path of the program's own resources, eg the@@ -24,7 +25,7 @@ var envPrefix = strings.ToUpper(progName) + "_" // home, which this one, starting with an underscore, does not shadow. var ownPath = "/_" + progName + "/" -// basePath is the path every URL of the server starts with, eg /www, set+// basePath is the path every URL of the server starts with, eg /drvu, set // by --base for a server that shares its domain with other sites behind a // proxy; "" serves at the root. It has no trailing slash. Tree prefixes, // ownPath and the stylesheet's URL include it, so most code never names

name_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"go/scanner"@@ -10,21 +10,34 @@ import ( 	"testing" ) -// The name lives in WORKING_NAME alone. Go code takes it from progName, the Makefile-// and the package files from WORKING_NAME, so a tracked file names the program-// only in prose: comments, README.md, doc/ and go.mod, which Go needs as-// a literal, as it does the module's path where a main under cmd/ imports-// it. A name such as www also occurs inside words that belong to others,-// which foreign strips first.+// The program's name lives in NAME alone and the project's in go.mod. Go+// code takes the first from progName; the Makefile reads NAME and takes the+// project's from the module, and fills both into the package files. So a+// tracked file names either only in prose: comments, README.md and doc/,+// or where Go needs a literal: go.mod, the package clause and the import+// in each main under cmd/. func TestNameHasOneSource(t *testing.T) { 	needGit(t) 	out, err := exec.Command("git", "ls-files").Output() 	if err != nil { 		t.Fatalf("git ls-files: %v", err) 	}-	lower := strings.ToLower(progName)+	mod, err := exec.Command("go", "list", "-m").Output()+	if err != nil {+		t.Fatalf("go list -m: %v", err)+	}+	names := []string{strings.ToLower(progName), strings.ToLower(path.Base(strings.TrimSpace(string(mod))))}+	holds := func(s string) bool {+		s = strings.ToLower(s)+		for _, n := range names {+			if strings.Contains(s, n) {+				return true+			}+		}+		return false+	} 	for _, f := range strings.Fields(string(out)) {-		if f == "WORKING_NAME" || f == "go.mod" || f == "README.md" || strings.HasPrefix(f, "doc/") || strings.HasPrefix(f, "assets/fonts/") {+		if f == "NAME" || f == "go.mod" || f == "README.md" || strings.HasPrefix(f, "doc/") || strings.HasPrefix(f, "assets/fonts/") { 			continue 		} 		src, err := os.ReadFile(f)@@ -51,20 +64,16 @@ func TestNameHasOneSource(t *testing.T) { 				if imports { 					continue 				}-				if (tok == token.STRING || tok == token.CHAR) && strings.Contains(foreign.Replace(strings.ToLower(lit)), lower) {+				if (tok == token.STRING || tok == token.CHAR) && holds(lit) { 					t.Errorf("%s: %s", fset.Position(pos), lit) 				} 			} 			continue 		} 		for i, line := range strings.Split(string(src), "\n") {-			if !strings.HasPrefix(strings.TrimSpace(line), "#") && strings.Contains(foreign.Replace(strings.ToLower(line)), lower) {+			if !strings.HasPrefix(strings.TrimSpace(line), "#") && holds(line) { 				t.Errorf("%s:%d: %s", f, i+1, line) 			} 		} 	} }--// foreign removes the words that hold www without naming the program: web-// hosts, the host prefix a forge link may carry and the form media type.-var foreign = strings.NewReplacer("://www.", "://", `"www."`, "", "x-www-form-urlencoded", "")

norace_test.go

@@ -1,5 +1,5 @@ //go:build !race -package www+package dirview  const raceOn = false

owner.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

page.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"@@ -56,7 +56,7 @@ type crumb struct { }  // indexCrumb leads every tree page's breadcrumbs to the index, the parent-// of all trees. Its label is not www, which a tree may be called.+// of all trees. Its label is not drvu, which a tree may be called. var indexCrumb = crumb{Label: "index", Href: "/"}  type page struct {

page_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

pdf.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bufio"

pdf_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"@@ -92,7 +92,7 @@ func TestInterpreter(t *testing.T) { 	} } -// weasyprint draws the page from www's own HTML and fetches through this+// weasyprint draws the page from drvu's own HTML and fetches through this // server alone: a doc's image from the tree arrives, while an image on // another host and a file: URL are never fetched. func TestPDFDrawsThroughThisServerAlone(t *testing.T) {

persist_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

private.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"encoding/base64"@@ -79,7 +79,7 @@ func privateEnv() []string { }  // usePrivate lets w read private repos into the cache beside root, eg-// ~/.cache/www-private beside ~/.cache/www. A public server shares root+// ~/.cache/drvu-private beside ~/.cache/drvu. A public server shares root // when it runs as the same user, but never opens this one. func (w *web) usePrivate(root string) error { 	dir := filepath.Join(filepath.Dir(root), progName+"-private")

private_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

proselang.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"math/bits"

proselang_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"os"

public.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

public_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"os/exec"

pylex.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"strings"

race_test.go

@@ -1,6 +1,6 @@ //go:build race -package www+package dirview  // raceOn reports whether the race detector is built in. It slows code // five to 10 times, so timing tests skip under it.

reach.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

registry.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"crypto/rand"@@ -14,8 +14,8 @@ import ( )  // A registry directory joins trees to the server of one endpoint, eg-// ~/.local/state/www/127.31.1.1-8080/, with one symlink per lock. A-// joining www adds a link; the server sees it through inotify, writes+// ~/.local/state/drvu/127.31.1.1-8080/, with one symlink per lock. A+// joining drvu adds a link; the server sees it through inotify, writes // the lock and serves the tree. An flock on the directory orders a join // against the server's start and exit, so no tree joins a dying server. type registry struct {@@ -84,7 +84,7 @@ func flock(f *os.File, how int) error { // suffix follows. So every join makes a link of a new name, which the // server tells from the link it already has without trusting the inode, // which a new file may reuse. The name only helps a reader of the-// registry; www reads the tree from the link's target.+// registry; drvu reads the tree from the link's target. func linkName(dir string) string { 	name := strings.NewReplacer("%", "%25", "/", "%2F").Replace(dir) 	if len(name) > linkNameMax {

render.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"@@ -137,7 +137,7 @@ func markAlerts(doc ast.Node, src []byte) { 	}) } -// renderAlertLabel writes the label as text of www's own.+// renderAlertLabel writes the label as text of drvu's own. func renderAlertLabel(w util.BufWriter, src []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { 	if entering { 		w.WriteString(`<p class="own alert">` + node.(*alertLabel).kind + "</p>\n")@@ -164,7 +164,7 @@ func (n *webMark) Dump(src []byte, level int) { ast.DumpHelper(n, src, level, ni // markWeb puts a webMark after each link, bare URLs included, that names a // repo on a forge or a file in one. On the web address itself, base is "" // and the link turns around: it reads the repo there, so a reader in an-// online repo stays in www, and the mark leads to the forge.+// online repo stays in drvu, and the mark leads to the forge. func markWeb(doc ast.Node, src []byte, base string) { 	type found struct { 		link ast.Node@@ -245,7 +245,7 @@ func relativePath(dest string) string { }  // nodeRenderer replaces goldmark's rendering of fenced code and task list-// checkboxes, and renders the nodes www adds.+// checkboxes, and renders the nodes drvu adds. type nodeRenderer struct{}  func (nodeRenderer) RegisterFuncs(r renderer.NodeRendererFuncRegisterer) {

render_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"os/exec"

restart.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"errors"

restart_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

scope.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"slices"

scope_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"reflect"

search.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"

search_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

semantic.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"

semantic_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

serve.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"@@ -75,7 +75,7 @@ func run(c config, rep *reporter) int { 		return rep.fail(errnoOf(err), err.Error()) 	} 	// A share's name comes from DNS, which may take a second; asked-	// before the registry is locked, it holds up no other www.+	// before the registry is locked, it holds up no other drvu. 	origin := shareOrigin(c.ep) 	reg, err := openRegistry(c.ep) 	if err != nil {@@ -269,7 +269,7 @@ func originHost(host string, port uint16) string {  // report ends a start with the tree's URL alone, the same whether this run // started the tree or found it served. A share adds a note on stderr: a-// firewall drops other machines before www sees them, and a test from+// firewall drops other machines before drvu sees them, and a test from // this machine passes through loopback, so only a capture tells. func report(rep *reporter, ep netip.AddrPort, url string) { 	rep.send("url", url)@@ -544,7 +544,7 @@ func (h *hub) dropLeftovers() { }  // adopt serves the tree whose lock is lockPath and writes the lock. link is-// the registry entry a joining www made, or "" to make one. token puts+// the registry entry a joining drvu made, or "" to make one. token puts // a shared tree under a secret path. func (h *hub) adopt(lockPath, link, token string) (*tree, error) { 	if !filepath.IsAbs(lockPath) || !lockNames(h.ep, filepath.Base(lockPath)) {@@ -717,7 +717,7 @@ func (h *hub) shutdown(why string) { }  // halt closes the listener while the registry is locked, so a joining-// www finds the address free and starts a new server instead of+// drvu finds the address free and starts a new server instead of // linking into this one. Open connections drain in the background. The // caller holds the lock. func (h *hub) halt(why string) {

serve_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bufio"@@ -96,7 +96,7 @@ func testEndpoint(t *testing.T) netip.AddrPort { 	return ep } -// start runs www for dir as a detached child would and returns its+// start runs drvu for dir as a detached child would and returns its // report lines once it finished reporting, and a channel with its exit code. func start(t *testing.T, c config) ([]string, chan int) { 	t.Helper()

server.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"@@ -173,7 +173,7 @@ func (s *server) byPrefix(prefix string) *tree { }  // lookup returns the tree that serves path, or a version of, eg-// /x/www@261024.4/. A tree inside another wins, so it keeps its own label+// /x/dirview@261024.4/. A tree inside another wins, so it keeps its own label // and lock. func (s *server) lookup(path string) *tree { 	s.mu.RLock()@@ -257,7 +257,7 @@ func (s *server) handler() http.Handler { // localhost, so the request must come from a page of this server. func (s *server) handleStop(w http.ResponseWriter, r *http.Request) { 	if !sameOrigin(r) {-		http.Error(w, "stop must come from an "+progName+" page", http.StatusForbidden)+		http.Error(w, "stop must come from a "+progName+" page", http.StatusForbidden) 		return 	} 	trees, crumbs, why, kill := s.list(), []crumb{{Label: progName}}, "Kill server button", true

server_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"@@ -124,7 +124,7 @@ func TestStopRefusesOtherSites(t *testing.T) { 	} } -// The fonts come from www, cached for a year: every file the stylesheet+// The fonts come from drvu, cached for a year: every file the stylesheet // names, and nothing else from the font directory. func TestFonts(t *testing.T) { 	s, _, _ := serveTree(t)

share_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"encoding/binary"@@ -286,7 +286,7 @@ func TestSpacedShareHint(t *testing.T) { 	} } -// WWW_SHARE fills a bare --share and WWW_ADDR a start without -a.+// DRVU_SHARE fills a bare --share and DRVU_ADDR a start without -a. // Flags win, --list, --kill and --restart keep covering every server, and // a bad value names its variable. func TestEnvironmentDefaults(t *testing.T) {

shlex.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"strings"

stardate.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

stardate_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

syntax.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bufio"

syntax/main.go

@@ -9,7 +9,7 @@ // It is a program of its own because tree-sitter is C, and cgo would make // the main binary need a C compiler to build and a C library to run. The // main binary runs it for each tree page and does without it when it is-// absent. The binary takes its name from the Makefile, eg www-syntax.+// absent. The binary takes its name from the Makefile, eg drvu-syntax. // // The parse and the walk run in C, in walk.c, in one call; the Go binding // supplies tree-sitter's library and the grammars.

syntax_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

taken.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"encoding/binary"@@ -10,9 +10,9 @@ import ( 	"strings" ) -// taken explains why ep cannot be bound when no www of this user serves+// taken explains why ep cannot be bound when no drvu of this user serves // a live tree there: it names the listeners that hold the port, marking-// the ones that are www servers on other addresses. A www of the user+// the ones that are drvu servers on other addresses. A drvu of the user // that holds ep with no live tree, eg after its tree's lock went // unseen, is named with its PID and the command that stops it. func taken(ep netip.AddrPort) string {

taken_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"fmt"@@ -12,7 +12,7 @@ import ( 	"time" ) -// stray makes a www of this user that holds ep with no live tree: a+// stray makes a drvu of this user that holds ep with no live tree: a // sleeping child stands in for the server, its record names the child, // and the test listens on ep in its place. func stray(t *testing.T) (ep netip.AddrPort, pid string, done chan error) {@@ -42,7 +42,7 @@ func stray(t *testing.T) (ep netip.AddrPort, pid string, done chan error) { 	return ep, fmt.Sprint(cmd.Process.Pid), done } -// A www of the user that lost its last tree unseen is named as such, with+// A drvu of the user that lost its last tree unseen is named as such, with // its PID and a command that stops it, never as the address itself. func TestTakenNamesStrayServer(t *testing.T) { 	ep, pid, _ := stray(t)@@ -57,7 +57,7 @@ func TestTakenNamesStrayServer(t *testing.T) { 	} } -// A listener on the address that is no www of the user is not named as+// A listener on the address that is no drvu of the user is not named as // the address itself either. func TestTakenByStranger(t *testing.T) { 	e := testEndpoint(t)@@ -72,7 +72,7 @@ func TestTakenByStranger(t *testing.T) { 	} } -// --kill on the address stops a www that serves no live tree.+// --kill on the address stops a drvu that serves no live tree. func TestKillStopsStrayServer(t *testing.T) { 	ep, _, done := stray(t) 	if code := kill(config{ep: ep, addr: ep.String()}); code != 0 {

theme_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"os"

treepage.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"

treepage_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

version.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"@@ -20,7 +20,7 @@ import (  // A version is a tree as it was in one commit, served at the tree's URL // with @ and the commit's stardate after its name, eg-// /scratch/www@261024.4/doc/, or its hash when it has none. The version+// /scratch/dirview@261024.4/doc/, or its hash when it has none. The version // qualifies the tree, so it sits on the tree's name, not below it as an // entry would; a tree at / has no name, so its versions sit below it, eg // /@261024.4/. The version is in the path rather than a query, so@@ -123,7 +123,7 @@ func versionPrefix(prefix, seg string) string { }  // versionIn reads urlPath as a path in a version of t, eg-// /scratch/www@261024.4/doc/x.md: first is the version, @261024.4, and+// /scratch/dirview@261024.4/doc/x.md: first is the version, @261024.4, and // rest the path below it, doc/x.md. A tree at / reads its versions as // entries, in serve. func (t *tree) versionIn(urlPath string) (first, rest string, ok bool) {

version_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

watch.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"errors"

watch_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import "testing" 

web.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

web_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

webclone.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

webclone_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"context"

webdisk.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"errors"

webdisk_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

weblist.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bufio"

weblist_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"net/http"

webpage.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"fmt"

webpage_test.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"strings"

wikilink.go

@@ -1,4 +1,4 @@-package www+package dirview  import ( 	"bytes"