wm: infra

Download patch

ref: 1869813c30458cd411900b666d3fe6e351887702
parent: e720631965b13539210b843af0af013db5858a17
author: mkf <mkf>
date: Wed Aug 28 01:55:08 EDT 2024

rules: import
these are rules used in our gopher and http servers.

xfnw asked for these, thanks xfnw!

diff: cannot open b/cfg/wm/rules//null: file does not exist: 'b/cfg/wm/rules//null'
--- /dev/null
+++ b/cfg/wm/rules/doc
@@ -1,0 +1,25 @@
+# main document server
+# html, pdf, ps and txt (defualt) available.
+/([^'/]+).htm		cd /usr/git/wm/doc/ ; git/fs ; ms2html < .git/fs/HEAD/tree/'\1'.ms
+#/([^'/]+).html		cd /usr/git/wm/doc/ ; git/fs ; htmlroff -ms -mhtml .git/fs/HEAD/tree/'\1'.ms
+/([^'/]+).html		wm/docweb /usr/git/ wm doc HEAD '\1'
+/([^'/]+).ps		cd /usr/git/wm/doc/ ; git/fs ; troff -ms .git/fs/HEAD/tree/'\1'.ms | dpost | ps2pdf
+/([^'/]+).txt		cd /usr/git/wm/doc/ ; git/fs ; nroff -ms .git/fs/HEAD/tree/'\1'.ms | col -bf
+/index.html		wm/doclist /usr/git/ wm doc HEAD
+/([0-9a-f]{40})/index.html		echo '\1'
+
+/([0-9a-f]{40})/([^'/]+).htm		cd /usr/git/wm/doc/ ; git/fs ; ms2html < .git/fs/'\1'/tree/'\2'.ms
+#/([0-9a-f]{40})/([^'/]+).html		cd /usr/git/wm/doc/ ; git/fs ; htmlroff -ms -mhtml .git/fs/'\1'/tree/'\2'.ms
+/([0-9a-f]{40})/([^'/]+).html		wm/docweb /usr/git/ wm doc '\1' '\2'
+/([0-9a-f]{40})/([^'/]+).ps		cd /usr/git/wm/doc/ ; git/fs ; troff -ms .git/fs/'\1'/tree/'\2'.ms | dpost | ps2pdf
+/([0-9a-f]{40})/([^'/]+).txt		cd /usr/git/wm/doc/ ; git/fs ; nroff -ms .git/fs/'\1'/tree/'\2'.ms | col -bf
+/([0-9a-f]+)/index.html		wm/doclist /usr/git/ wm doc '\1'
+
+# user document server
+# it's like main document server, but works with forks
+/usr/([^'/]+)/([^'/]+).htm	cd /usr/git/\1/doc ; git/fs ; ms2html < .git/fs/HEAD/tree/'\2'.ms
+/usr/([^'/]+)/([^'/]+).html	cd /usr/git/\1/doc ; git/fs ; htmlroff -ms -mhtml .git/fs/HEAD/tree/'\2'.ms
+/usr/([^'/]+)/([^'/]+).ps	cd /usr/git/\1/doc ; git/fs ; troff -ms .git/fs/HEAD/tree/'\2'.ms | dpost
+/usr/([^'/]+)/([^'/]+).pdf	cd /usr/git/\1/doc ; git/fs ; troff -ms .git/fs/HEAD/tree/'\2'.ms | dpost | ps2pdf
+/usr/([^'/]+)/([^'/]+).txt	cd /usr/git/\1/doc ; git/fs ; nroff -ms .git/fs/HEAD/tree/'\2'.ms | col -bf
+
--- /dev/null
+++ b/cfg/wm/rules/httpfs
@@ -1,0 +1,4 @@
+# the_guest wanted a (working) httpfs, here it is.
+# no, it's not enabled. dont be silly.
+#/(https?\:)/([^'/]*)/(.+)\.(.+)		webfs ; ip/httpfile -f /fd/1 '\1'//'\2'/'\3'.'\4'
+#/(https?\:)/([^'/]*)/(.+)\.(.+)		webfs ; hget '\1'//'\2'/'\3'.'\4'
--- /dev/null
+++ b/cfg/wm/rules/math
@@ -1,0 +1,9 @@
+# mathjax-alike
+# example: /{eqn input here}.png
+
+/([^'/]+).png		{echo .EQ ; echo '\1' ; echo .EN} | eqn | troff | dpost | gs -dNOPAUSE -dQUIET '-sOUTPUTFILE='/fd/1 '-sDEVICE=inferno' - quit.ps| crop -c 255 255 255 | topng
+/([^'/]+).bit		{echo .EQ ; echo '\1' ; echo .EN} | eqn | troff | dpost | gs -dNOPAUSE -dQUIET '-sOUTPUTFILE='/fd/1 '-sDEVICE=inferno' - quit.ps| crop -c 255 255 255
+/([^'/]+).gif		{echo .EQ ; echo '\1' ; echo .EN} | eqn | troff | dpost | gs -dNOPAUSE -dQUIET '-sOUTPUTFILE='/fd/1 '-sDEVICE=inferno' - quit.ps| crop -c 255 255 255 | togif
+/([^'/]+).(jpg|jepg)		{echo .EQ ; echo '\1' ; echo .EN} | eqn | troff | dpost | gs -dNOPAUSE -dQUIET '-sOUTPUTFILE='/fd/1 '-sDEVICE=inferno' - quit.ps| crop -c 255 255 255 | tojpg
+
+#/([0-9]+)/([^'/]+).(jpg|jepg)		{echo .EQ ; echo '\2' ; echo .EN} | eqn | troff | dpost | gs -dNOPAUSE -dQUIET '-sOUTPUTFILE='/fd/1 '-sDEVICE=inferno' - quit.ps | crop -c 255 255 255 | resize -x+'\1'% | tojpg
--- /dev/null
+++ b/cfg/wm/rules/toys
@@ -1,0 +1,3 @@
+# mathjax(?) alike,
+# see /math/'x sup 2'.gif as an example
+#/([^'/]+).gif		{echo .EQ ; echo '\1' ; echo .EN} | eqn | troff | dpost | ps2gif
--- /dev/null
+++ b/cfg/wm/rules/web
@@ -1,0 +1,13 @@
+/index.html					/bin/shithub/list	/usr/git
+([^'/]+)/usr.html				/bin/shithub/usr	/usr/git '\1'
+(/.well-known/acme-challenge/([^'/]+))		/bin/cat		/usr/web/\1
+([^'/]+)/([^'/]+)/([^'/]+)/info.html		/bin/shithub/info	/usr/git '\1' '\2' '\3'
+([^'/]+)/([^'/]+)/([^'/]+)/files.html		/bin/shithub/files	/usr/git '\1' '\2' '\3'
+([^'/]+)/([^'/]+)/([^'/]+)/branches.html	/bin/shithub/branches	/usr/git '\1' '\2' '\3'
+([^'/]+)/([^'/]+)/([^'/]+)/snap.tar.gz		/bin/shithub/tar	/usr/git '\1' '\2' '\3'
+([^'/]+)/([^'/]+)/([^'/]+)/(([^']+)/)?f.html	/bin/shithub/view	/usr/git '\1' '\2' '\3' '\5'
+([^'/]+)/([^'/]+)/([^'/]+)/(([^']+)/)?raw	/bin/shithub/viewraw	/usr/git '\1' '\2' '\3' '\5'
+([^'/]+)/([^'/]+)/([^'/]+)/log.html		/bin/shithub/log	/usr/git '\1' '\2' '\3'
+([^'/]+)/([^'/]+)/([^'/]+)/commit.html		/bin/shithub/show	/usr/git '\1' '\2' '\3'
+([^'/]+)/([^'/]+)/([^'/]+)/_patch		/bin/shithub/patch	/usr/git '\1' '\2' '\3'
+([^'/]+)/([^'/]+)/([^'/]+)/feed.rss		/bin/shithub/feed	/usr/git '\1' '\2' '\3'