shithub: gitonline

Download patch

ref: f0c1620f4aa739008e27da1ee9789388cfbb1811
parent: bf1f60feafb24158549319f3a9e05a377a9ce08b
author: glenda <glenda@9front.local>
date: Sun Nov 29 08:40:14 EST 2020

Show repos under user/repo instead, and add a SITE_TITLE variable

--- a/gitonline.rc
+++ b/gitonline.rc
@@ -1,5 +1,7 @@
 #!/bin/rc
 
+SITE_TITLE='Git repository browser (mirror of shithub.us)'
+
 nl='
 '
 
@@ -43,7 +45,7 @@
 	<!DOCTYPE html>
 	<html>
 	<head>
-		<title>Git repo browser</title>
+		<title>'$SITE_TITLE'</title>
 		<meta charset="UTF-8">
 		<style>
 	body {
@@ -68,8 +70,8 @@
 
 fn repo_index {
 	html_emit_start 
-	echo '<h1> Git repo browser </h1>' 
-	dirs=`{walk -d -n1}
+	echo '<h1> '$SITE_TITLE' - index </h1>' 
+	dirs=`{walk -d -n2,2}
 	echo '
 	<table style="width: 100%">
 	<tr>
@@ -102,13 +104,12 @@
 
 fn repo_view {
 	html_emit_start
-	reponame=`{basename $1}
+	reponame=`{echo $1 | sed 's,^/,,'}
 	echo '
 	<h1>'$reponame'</h1>
 	<a href="'$reponame'/shortlog">'Shortlog'</a>
 	<a href="'$reponame'/browse">'browse'</a>'
 	html_emit_end
-
 }
 
 fn repo_browse {