Repo containing scripts to be used with dovel, and git hooks that powers our web interface.
Author: brian (git@myr.sh)
Date: Mon Sep 25 00:16:45 2023 -0300
Parent: 41d1226
Simplified scripts
diff --git a/aux.sh b/aux.sh
index 472a08c..b52abd2 100755
--- a/aux.sh
+++ b/aux.sh
@@ -1,5 +1,55 @@
#!/bin/sh
+pageheader() {
+ cat <<- EOF
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <title>$1's git</title>
+ <meta charset="UTF-8">
+ <meta name="author" content="Brian Lee Mayer">
+ <meta name="description" content="This is the development homepage of the Dovel project. Find here all repos mailing lists. And latest development changes.">
+ <meta name="language" content="english">
+ <meta name="keywords" content="email, dovel, blmayer, self host, software, smtp, web, interface">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="light dark">
+ <style>
+ body {
+ max-width: 40em;
+ margin: 60px auto;
+ padding: 20px;
+ font-family: sans-serif;
+ }
+ pre {
+ font-family: monospace;
+ white-space: pre-line;
+ font-weight: bold;
+ background: lightgray;
+ padding: 8px;
+ border-radius: 8px;
+ }
+ table {width: 100%}
+ th {text-align: left}
+ pre > file {
+ line-height: 0.65;
+ overflow-x: auto
+ }
+ ol li {padding-bottom: 10px}
+ li::marker {
+ color: gray;
+ content: counter(list-item, decimal-leading-zero) " "
+ }
+ ol {margin: 0}
+ tt {font-weight: bold}
+ @media (prefers-color-scheme: dark) {
+ pre {background: darkslategray}
+ }
+ </style>
+ </head>
+ <body>
+ EOF
+}
+
escapehtml() {
printf "%s" "$1" | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g'
}
diff --git a/post-receive b/post-receive
index 7d85646..51a8bab 100755
--- a/post-receive
+++ b/post-receive
@@ -9,6 +9,8 @@ OUT="$HOME/www/dovel.email"
[ -d "$OUT/$REPO/tree" ] && rm -rf "$OUT/$REPO/tree"
git clone . "$OUT/$REPO/tree"
+. ./hooks/aux.sh
+
# update git's index page
. ./hooks/update-git-index
diff --git a/update-git-index b/update-git-index
index 0949fc2..a19054b 100755
--- a/update-git-index
+++ b/update-git-index
@@ -4,38 +4,7 @@ echo "updating git pages"
# git.html lists all repos
cat << EOF > "$OUT/git.html"
-<!DOCTYPE html>
-<html>
-<head>
- <title>dovel's git</title>
- <meta charset="UTF-8">
- <meta name="author" content="Brian Lee Mayer">
- <meta name="description" content="This is the development homepage of the Dovel project. Find here all repos mailing lists. And latest development changes.">
- <meta name="language" content="english">
- <meta name="keywords" content="email, dovel, blmayer, self host, software, smtp, web, interface">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="color-scheme" content="light dark">
- <style>
- body {
- max-width: 600px;
- margin: 60px auto;
- padding: 20px;
- font-family: sans-serif;
- }
- pre {
- font-weight: bold;
- background: lightgray;
- padding: 8px;
- border-radius: 8px;
- }
- ol li {padding-bottom: 10px}
- tt {font-weight: bold}
- @media (prefers-color-scheme: dark) {
- pre {background: darkslategray}
- }
- </style>
-</head>
-<body>
+ $(pageheader "dovel")
<h1>Dovel project Git home</h1>
Welcome! Here you'll find general info about our projects and how to
contribute to them. We proudly use dovel email technology for our
diff --git a/update-repo-index b/update-repo-index
index 8b55c45..a544d44 100755
--- a/update-repo-index
+++ b/update-repo-index
@@ -13,39 +13,7 @@ git archive -o "$OUT/$REPO-HEAD.zip" HEAD
echo "creating index.html"
cat << EOF > "$OUT/index.html"
-<!DOCTYPE html>
-<html>
-<head>
- <title>$REPO's git</title>
- <meta charset="UTF-8">
- <meta name="author" content="Brian Lee Mayer">
- <meta name="description" content="This is the development homepage of the Dovel project, this is the repo $REPO. Find here code, all mailing lists and latest development changes.">
- <meta name="language" content="english">
- <meta name="keywords" content="email, dovel, blmayer, self host, software, smtp, web, interface">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="color-scheme" content="light dark">
- <style>
- body {
- max-width: 600px;
- margin: 60px auto;
- padding: 20px;
- font-family: sans-serif;
- }
- pre {
- white-space: pre-line;
- font-family: monospace;
- background: lightgray;
- padding: 8px;
- border-radius: 8px;
- }
- ol li {padding-bottom: 10px}
- tt {font-weight: bold}
- @media (prefers-color-scheme: dark) {
- pre {background: darkslategray}
- }
- </style>
-</head>
-<body>
+$(pageheader "$REPO")
<center>
<h1>$REPO</h1>
<nav>
diff --git a/update-repo-tree b/update-repo-tree
index f287003..8f93785 100755
--- a/update-repo-tree
+++ b/update-repo-tree
@@ -4,64 +4,27 @@
# set -ex
echo "updating git tree"
-. ./hooks/aux.sh
-
OUT="$HOME/www/dovel.email/$REPO"
createfilepage() {
cat <<- EOF
- <!DOCTYPE html>
- <html>
- <head>
- <title>$REPO's git</title>
- <meta charset="UTF-8">
- <meta name="author" content="Brian Lee Mayer">
- <meta name="description" content="This is the development homepage of the Dovel project, this is the repo $REPO. Find here code, all mailing lists and latest development changes.">
- <meta name="language" content="english">
- <meta name="keywords" content="email, dovel, blmayer, self host, software, smtp, web, interface">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="color-scheme" content="light dark">
- <style>
- body {
- max-width: 600px;
- margin: 60px auto;
- padding: 20px;
- font-family: sans-serif;
- }
- li::marker {
- color: gray;
- content: counter(list-item, decimal-leading-zero) " "
- }
- ol {margin: 0}
- pre {
- line-height: 0.65;
- font-family: monospace;
- background: lightgray;
- padding: 8px;
- border-radius: 8px;
- overflow-x: auto
- }
- @media (prefers-color-scheme: dark) {
- pre {background: darkslategray}
- }
- </style>
- </head>
- <body>
- <center>
- <h1>$REPO</h1>
- <nav>
- <a href=/$REPO/index.html>index</a>  
- <a href=/$REPO/refs.html>refs</a>  
- <a href=/$REPO/log.html>log</a>  
- <a href=/$REPO/tree.html>tree</a>  
- <a href=/$REPO/mail.html>mail</a>
- </nav>
- <p><i>$(cat description)</i></p>
- </center>
- <kbd>curl https://dovel.email/$REPO/$REPO.zip</kbd>
- <hr>
- <h2>$1</h2>
- <pre>
- <ol>
+ $(pageheader "$REPO")
+ <center>
+ <h1>$REPO</h1>
+ <nav>
+ <a href=/$REPO/index.html>index</a>  
+ <a href=/$REPO/refs.html>refs</a>  
+ <a href=/$REPO/log.html>log</a>  
+ <a href=/$REPO/tree.html>tree</a>  
+ <a href=/$REPO/mail.html>mail</a>
+ </nav>
+ <p><i>$(cat description)</i></p>
+ </center>
+ <kbd>curl https://dovel.email/$REPO/$REPO.zip</kbd>
+ <hr>
+ <h2>$1</h2>
+ <file>
+ <pre>
+ <ol>
EOF
# print file
@@ -70,37 +33,12 @@ createfilepage() {
printf "<li>%s</li>\n" "$(escapehtml "$l")"
done < "$OUT/tree/$1"
- echo "</ol>\n</pre>\n</body>\n</html>"
+ echo "</ol>\n</pre>\n<</file>\n</body>\n</html>"
}
echo "creating tree.html"
cat << EOF > "$OUT/tree.html"
-<!DOCTYPE html>
-<html>
-<head>
- <title>$REPO's git</title>
- <meta charset="UTF-8">
- <meta name="author" content="Brian Lee Mayer">
- <meta name="description" content="This is the development homepage of the Dovel project, this is the repo $REPO. Find here code, all mailing lists and latest development changes.">
- <meta name="language" content="english">
- <meta name="keywords" content="email, dovel, blmayer, self host, software, smtp, web, interface">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="color-scheme" content="light dark">
- <style>
- body {
- max-width: 600px;
- margin: 60px auto;
- padding: 20px;
- font-family: sans-serif;
- }
- table {width: 100%}
- th {text-align: left}
- @media (prefers-color-scheme: dark) {
- pre {background: darkslategray}
- }
- </style>
-</head>
-<body>
+ $(pageheader "$REPO")
<center>
<h1>$REPO</h1>
<nav>