shithub: shithub

Download patch

ref: 1fabeb8473f2c92540e4b0e1e9c5208d1bb00aac
parent: 56fdabcdf05f0c22376f4d8d0aaae962e04c2df3
author: phil9 <telephil9@gmail.com>
date: Thu Oct 28 06:07:20 EDT 2021

introduce configuration file

	now that shithub is also deployed on git.9front.org we need to allow for
	site-specific customizations.

	This commit adds a `config.rc` file with the list of customizable elements:
	- title: used as html title and as the text for the link at the top of every pages
	- host: hostname where this shithub instance is deployed. This is used to change clone
	urls for instance
	- logo: filename (without path which is set to /static/) for the image used as the site logo

--- a/common.rc
+++ b/common.rc
@@ -1,3 +1,5 @@
+. /sys/lib/shithub/config.rc
+
 nl='
 '
 
@@ -171,7 +173,7 @@
 	 	echo '<link rel="alternate" type="application/rss+xml" href="/git/'$puser/$prepo'/HEAD/feed.rss" title="rss">'
 	echo '	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 		<meta name="viewport" content="width=device-width,initial-scale=1">
-		<title>shithub: '$"prepo'</title>
+		<title>'$title': '$"prepo'</title>
 	</head>
 	<body>
 	'
@@ -183,7 +185,7 @@
 	phash=$3
 
 	prelude $puser $prepo
-	echo '	<h1><a href="/">shithub</a>: 
+	echo '	<h1><a href="/">'$title'</a>: 
 		<a href="/'$puser/$prepo'/HEAD/info.html">'$prepo'</a></h1>
 		<div id="linkbar">
 		<a href="/'$puser/$prepo'/HEAD/info.html">Info</a>
--- /dev/null
+++ b/config.rc
@@ -1,0 +1,4 @@
+title=shithub
+host=shithub.us
+logo=shithub.png
+
--- a/feed
+++ b/feed
@@ -8,7 +8,7 @@
 	phash=$3
 
 	d=`{pwd}
-	guid='http://shithub.us/git/'$puser/$prepo/$phash'/commit.html'
+	guid='http://'$host'/git/'$puser/$prepo/$phash'/commit.html'
 	message=`{htcat $gitfs/object/$phash/msg | sed 1q}
 	description=`''{htcat $gitfs/object/$phash/msg}
 	date=`{date -uf$dfmt `{mtime $gitfs/object/$phash/msg |awk '{print $1}'}}
@@ -51,9 +51,9 @@
 echo '<?xml version="1.0" encoding="utf-8" ?>
 	<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 	<channel>
-	<atom:link href="http://shithub.us/'$gituser/$repo/'HEAD/feed.rss" rel="self" type="application/rss+xml" />
+	<atom:link href="http://'$host/$gituser/$repo/'HEAD/feed.rss" rel="self" type="application/rss+xml" />
 	<title>'$gituser/$repo' git log</title>
-	<link>http://shithub.us/git/'$gituser/$repo/'HEAD/log.html</link>
+	<link>http://'$host'/git/'$gituser/$repo/'HEAD/log.html</link>
 	<description>shithub git/log for repository '$gituser/$repo'</description>
 	<lastBuildDate>'`"{date -uf$dfmt}'</lastBuildDate>
 	<language>en-us</language>
--- a/info
+++ b/info
@@ -28,8 +28,8 @@
 user_prelude $gituser $repo $hash		
 echo '	<h3>Clone</h3>
 	<div>
-	<b>clone:</b> git://shithub.us/'$gituser/$repo' gits://shithub.us/'$gituser/$repo'<br>
-	<b>push:</b> hjgit://shithub.us/'$gituser/$repo'<br>'
+	<b>clone:</b> git://'$host/$gituser/$repo' gits://'$host/$gituser/$repo'<br>
+	<b>push:</b> hjgit://'$host/$gituser/$repo'<br>'
 if(test -f $repodir/contact)
 	echo '	<b>patches to: </b>'^`$nl{cat $repodir/contact}^'<br>'
 echo '	</div>'
--- a/list
+++ b/list
@@ -10,7 +10,7 @@
 '
 
 prelude '' 'the fragrant git host'
-echo '	<img src="/static/shithub.png" />
+echo '	<img src="/static/'$logo'" />
 	<br/>
 
 	<p>Shithub is a site for hosting git repositories. It is
--- a/mkfile
+++ b/mkfile
@@ -14,7 +14,8 @@
 	feed
 
 LIBFILES=\
-	common.rc
+	common.rc\
+	config.rc
 
 WEBFILES=\
 	shithub.png\