summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xgit/gitls203
-rw-r--r--git/gitrules4
-rwxr-xr-xgit/tcp170212
-rwxr-xr-xgit/tcp94182
-rw-r--r--index.html31
5 files changed, 242 insertions, 0 deletions
diff --git a/git/gitls b/git/gitls
new file mode 100755
index 0000000..8a0c904
--- /dev/null
+++ b/git/gitls
@@ -0,0 +1,203 @@
+#!/bin/rc -e
+
+cd $1
+shift
+url=fulton.software
+rfork ne
+nl='
+'
+
+fn htcat {
+	sed '
+		s/&/\&/g;
+		s/</\&lt;/g;
+		s/>/\&gt;/g;
+		s/"/\&quot;/g;
+		s/''/\&#39;/g
+	' $*
+}
+
+fn resolveref {
+	if(~ $refname HEAD)
+		echo $refname
+	if not if(test -d /mnt/git/branch/$refname/tree)
+		echo branch/$refname
+	if not if(test -d /mnt/git/object/$refname/tree)
+		echo object/$refname
+	if not
+		status='bad ref'
+}
+
+fn repons {
+	mntgen
+	mntgen /mnt/mnt
+	bind /bin /mnt/bin
+	bind /tmp /mnt/tmp
+	bind -c /env /mnt/env
+	bind $1 /mnt/$repo
+	bind /mnt /
+	cd /mnt/$repo
+	git/fs
+	rfork m
+}
+
+
+fn prelude {
+	echo '
+	<!DOCTYPE html>
+	<html>
+	
+	<head>
+		<style type="text/css">
+			body{
+				margin: 3em auto;
+				max-width: 50em;
+				font-family: sans-serif;
+			}
+			h1,h2{
+				font-size: 1.3em;
+				color: #4c4c99;
+			}
+			h3{
+				font-size: 1em;
+				color: #4c4c99;
+			}
+			#desc{
+			}
+			#code{
+				background: #ffffea;
+				border: #99994cff
+			}
+		</style>
+	 	<link rel="alternate" type="application/rss+xml" href="feed.rss" title="rss">
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+		<title>git webls</title>
+	</head>
+	<body>
+	'
+}
+
+switch($1){
+case 'tar'
+	repo=$2
+	refname=$3
+	@{
+	repons $2
+	if(! ref=`{resolveref $refname}){
+		echo '<b>invalid ref '$refname'</b>'
+		exit
+	}
+	bind /mnt/git/$ref/tree /mnt/$repo
+	cd /mnt
+	tar cz $repo
+	}
+
+case 'list'
+	rfork m
+	prelude
+	echo '	<h1>Repos</h1>
+		<dl>'
+	for(repo in `$nl{ls}){
+		if(test -e $repo/.git/webpublish){
+			echo '<dt><a href="/git/'$repo'/HEAD/info.html">'$repo'</a></dt>'
+			echo '<dd>'
+			if(test -f $repo/.git/desc)
+				htcat $repo/.git/desc
+			if not
+				echo 'code some guy wrote'
+			echo '</dd>'
+		}
+	}
+	echo '</dl>'
+
+case 'info'
+	repo=$2
+	repodir=/mnt/$repo/.git
+	refname=$3
+	@{
+	repons $repo
+	if(! ref=`{resolveref $refname}){
+		echo '<b>invalid ref '$refname'</b>'
+		exit
+	}
+	cd /mnt/git/$ref/tree
+	hash=`{cat /mnt/git/$ref/hash}
+
+	prelude $repo $ref $repo
+	echo '	<h1><a href="/git/repos.html">Git</a>: <a
+		href=/git/'$repo'/'$ref'/info.html>'$repo'</a></h1>
+		<p>'$repo' @ <a href='/git/$repo/$hash/f.html'>'$hash'</a>
+		<pre id="desc">'
+	htcat /mnt/git/object/$hash/msg
+	echo '	</pre>
+		<h2>Code</h2>
+		<p>
+		<b>clone:</b> git://'$url'/'$repo', gits://'$url'/'$repo'<br>
+		<b>push:</b> hjgit://'$url'/'$repo'<br>
+		<b>tar:</b> <a href="'/git/$repo/$hash/snap.tar.gz'">snap.tar.gz</a><br>'
+	if(test -f $repodir/contact)
+		echo '<b>patches to: </b>'^`$nl{cat $repodir/contact}^'<br>
+			</p>
+			<pre id="code">'
+	for(f in `$nl{ls}){
+		url=`$nl{echo -n $f/f.html | urlencode}
+		fname=`$nl{echo -n $f | htcat}
+		echo '<a href="'$url'">'$fname'</a>'
+	}		
+	echo '</pre>
+		<h2>About This Repo</h2>
+		<pre id="desc">'
+	if(test -f $repodir/README)
+		htcat $repodir/README
+	if not if(test -f README)
+		htcat README
+	if not if (test -f README.md)
+		htcat README.md
+	if not if(test -f $repodir/desc)
+		htcat $repodir/desc
+	if not
+		echo 'this repo has no description'
+	echo '
+		</pre>
+		</body>
+		</html>
+	'
+	}
+
+case 'view'
+	repo=$2
+	repodir=/mnt/$repo/.git
+	refname=$3
+	file=$4
+	@{
+	repons $repo
+	if(! ref=`{resolveref $refname}){
+		echo '<b>invalid ref '$refname'</b>'
+		exit
+	}
+	cd /mnt/git/$ref/tree
+	if(~ $file '')
+		file='.'
+	hash=`{cat /mnt/git/$ref/hash}
+
+	prelude
+	echo '	<h1><a href="/git/repos.html">Git</a>: <a
+		href='/git/$repo/$ref/info.html'>'$repo'</a></h1>
+		<p>'$repo' @ <a href="'/git/$repo/$hash/f.html'">'$hash'</a>
+		<pre id="code">'
+	if(test -f $file){
+		htcat $file
+	}
+	if not if(test -d $file){
+		cd $file
+		for(f in `$nl{ls}){
+			url=`$nl{echo -n $f/f.html | urlencode}
+			fname=`$nl{echo -n $f | htcat}
+			echo '<a href="'$url'">'$fname'</a>'
+		}
+	}
+	echo '	</pre>
+		</body>
+		</html>'
+	}
+}
diff --git a/git/gitrules b/git/gitrules
new file mode 100644
index 0000000..d01c8b1
--- /dev/null
+++ b/git/gitrules
@@ -0,0 +1,4 @@
+/repos.html				/bin/gitls /usr/git list
+/([^'/]+)/([^'/]+)/info.html		/bin/gitls /usr/git info '\1' '\2'
+/([^'/]+)/([^'/]+)/snap.tar.gz		/bin/gitls /usr/git tar '\1' '\2'
+/([^'/]+)/([^'/]+)/(([^']+)/)?f.html	/bin/gitls /usr/git view '\1' '\2' '\4'
diff --git a/git/tcp17021 b/git/tcp17021
new file mode 100755
index 0000000..03cff56
--- /dev/null
+++ b/git/tcp17021
@@ -0,0 +1,2 @@
+#!/bin/rc
+exec tlssrv -a /bin/git/serve -wr/usr/git
diff --git a/git/tcp9418 b/git/tcp9418
new file mode 100755
index 0000000..6727baf
--- /dev/null
+++ b/git/tcp9418
@@ -0,0 +1,2 @@
+#!/bin/rc
+exec git/serve -r/usr/git
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..7e339d8
--- /dev/null
+++ b/index.html
@@ -0,0 +1,31 @@
+<html>
+<title>fulton.software</title>
+<H1>
+THE WEB IS DEAD
+</H1>
+
+<H1>
+LONG LIVE GEMINI
+</H1>
+
+<h4>
+!!!!WARNING THERE ARE NO COOKIES IN USE ON THIS WEBSITE!!!!
+</h4>
+
+<p>
+You can find my blog and most of my content at this domain on gemini.
+
+ <a href="https://portal.mozz.us/gemini/fulton.software">A proxy for people who don't want to download a gemini browser</a> 
+</p>
+<p> my code is hosted <a href="git/repos.html">here</a></p>
+
+<p>if you want to send me mail send it to fulton.software!fulton. if that didn't make any since to you your a bot and/or I don't want you in my inbox</p>
+
+<p> this web page was made with coffee and the 9front operating system and is designed for use on all form of unix (execpt macos 10 or newer), plan9, and haiku. </p>
+
+<p>
+
+<h1> USE FREE SOFTWARE </h1>
+
+
+</html>