From 4bd20c0984b3a38283430ab355eef5dcfcea91dd Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 9 Jun 2022 17:19:17 -0500 Subject: Apply my personal configurations to cgit For easy deployment. Actual code changes will go in master for sharing, but then will be merged here. --- Makefile | 18 ++++++++++++ avatar.png | Bin 0 -> 11785 bytes cgit-about-filter.sh | 32 ++++++++++++++++++++ cgit.css | 81 +++++++++++++++++++++++++++++---------------------- cgitrc | 45 ++++++++++++++++++++++++++++ favicon.ico | Bin 0 -> 2462 bytes 6 files changed, 141 insertions(+), 35 deletions(-) create mode 100644 avatar.png create mode 100755 cgit-about-filter.sh create mode 100644 cgitrc create mode 100644 favicon.ico diff --git a/Makefile b/Makefile index 5967a32..6d9eda9 100644 --- a/Makefile +++ b/Makefile @@ -92,6 +92,24 @@ install: all $(INSTALL) -m 0755 -d $(DESTDIR)$(filterdir) $(COPYTREE) filters/* $(DESTDIR)$(filterdir) +SERVER = root@hetzner +SERVER_ROOT_DIR = /usr/local/cgit +SERVER_ROOT = $(SERVER):$(SERVER_ROOT_DIR) +RSYNC = rsync -auvz +STATIC_ASSETS = cgit.css cgit.png robots.txt avatar.png favicon.ico + +server-install: all + $(RSYNC) cgit $(SERVER_ROOT)/bin/cgit.cgi + $(RSYNC) $(STATIC_ASSETS) $(SERVER_ROOT)/share/ + $(RSYNC) cgitrc $(SERVER):/etc/ + $(RSYNC) cgit-about-filter.sh $(SERVER):/usr/bin/ + ssh root@hetzner \ + chown root:root \ + $(SERVER_ROOT_DIR)/bin/cgit.cgi \ + $(SERVER_ROOT_DIR)/share/* \ + /etc/cgitrc \ + /usr/bin/cgit-about-filter.sh + install-doc: install-man install-html install-pdf install-man: doc-man diff --git a/avatar.png b/avatar.png new file mode 100644 index 0000000..510b691 Binary files /dev/null and b/avatar.png differ diff --git a/cgit-about-filter.sh b/cgit-about-filter.sh new file mode 100755 index 0000000..ad2c4ce --- /dev/null +++ b/cgit-about-filter.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# This may be used with the about-filter or repo.about-filter setting in cgitrc. +# It passes formatting of about pages to differing programs, depending on the usage. + +# The following environment variables can be used to retrieve the configuration +# of the repository for which this script is called: +# CGIT_REPO_URL ( = repo.url setting ) +# CGIT_REPO_NAME ( = repo.name setting ) +# CGIT_REPO_PATH ( = repo.path setting ) +# CGIT_REPO_OWNER ( = repo.owner setting ) +# CGIT_REPO_DEFBRANCH ( = repo.defbranch setting ) +# CGIT_REPO_SECTION ( = section setting ) +# CGIT_REPO_CLONE_URL ( = repo.clone-url setting ) + +plaintext() { + echo "
"
+ awk \
+ '{
+ gsub(/&/,"\\&");
+ gsub(/,"\\<");
+ gsub(/>/,"\\>");
+ print;
+ }'
+ echo "
"
+}
+
+case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in
+ *.markdown|*.mdown|*.md|*.mkd) exec pandoc -thtml -fmarkdown ;;
+ *.htm|*.html) exec cat ;;
+ *) plaintext ;;
+esac
diff --git a/cgit.css b/cgit.css
index 51ddbf8..ee2ab11 100644
--- a/cgit.css
+++ b/cgit.css
@@ -1,10 +1,15 @@
+body {
+ max-width: 100ch;
+ padding: 2ch;
+ margin: 0 auto;
+ color: navy;
+ background: papayawhip;
+ font-size: 16pt;
+}
+
div#cgit {
- padding: 0em;
margin: 0em;
font-family: sans-serif;
- font-size: 10pt;
- color: #333;
- background: white;
padding: 4px;
}
@@ -56,13 +61,13 @@ div#cgit table#header td.form select {
}
div#cgit table#header td.sub {
- color: #777;
- border-top: solid 1px #ccc;
+ color: navy;
+ border-top: solid 1px goldenrod;
padding-left: 10px;
}
div#cgit table.tabs {
- border-bottom: solid 3px #ccc;
+ border-bottom: solid 3px goldenrod;
border-collapse: collapse;
margin-top: 2em;
margin-bottom: 0px;
@@ -76,13 +81,12 @@ div#cgit table.tabs td {
div#cgit table.tabs td a {
padding: 2px 0.25em;
- color: #777;
+ color: navy;
font-size: 110%;
}
div#cgit table.tabs td a.active {
- color: #000;
- background-color: #ccc;
+ background-color: goldenrod;
}
div#cgit table.tabs a[href^="http://"]:after, div#cgit table.tabs a[href^="https://"]:after {
@@ -116,10 +120,11 @@ div#cgit div.path {
div#cgit div.content {
margin: 0px;
padding: 2em;
- border-bottom: solid 3px #ccc;
+ background: #fff5e6;
+ font-size: 12pt;
+ border-bottom: solid 3px goldenrod;
}
-
div#cgit table.list {
width: 100%;
border: none;
@@ -127,47 +132,47 @@ div#cgit table.list {
}
div#cgit table.list tr {
- background: white;
+ background: #fff5e6;
}
div#cgit table.list tr.logheader {
- background: #eee;
+ background: #fff5e6;
}
div#cgit table.list tr:nth-child(even) {
- background: #f7f7f7;
+ background: #fff5e6;
}
div#cgit table.list tr:nth-child(odd) {
- background: white;
+ background: #fff5e6;
}
div#cgit table.list tr:hover {
- background: #eee;
+ background: papayawhip;
}
div#cgit table.list tr.nohover {
- background: white;
+ background: #fff5e6;
}
div#cgit table.list tr.nohover:hover {
- background: white;
+ background: papayawhip;
}
div#cgit table.list tr.nohover-highlight:hover:nth-child(even) {
- background: #f7f7f7;
+ background: #fff5e6;
}
div#cgit table.list tr.nohover-highlight:hover:nth-child(odd) {
- background: white;
+ background: #fff5e6;
}
div#cgit table.list th {
font-weight: bold;
/* color: #888;
- border-top: dashed 1px #888;
- border-bottom: dashed 1px #888;
- */
+border-top: dashed 1px #888;
+border-bottom: dashed 1px #888;
+ */
padding: 0.1em 0.5em 0.05em 0.5em;
vertical-align: baseline;
}
@@ -261,13 +266,13 @@ div#cgit div#summary {
div#cgit table#downloads {
float: right;
border-collapse: collapse;
- border: solid 1px #777;
+ border: solid 1px goldenrod;
margin-left: 0.5em;
margin-bottom: 0.5em;
}
div#cgit table#downloads th {
- background-color: #ccc;
+ background-color: goldenrod;
}
div#cgit div#blob {
@@ -346,11 +351,11 @@ div#cgit table.blame td.linenumbers div.alt {
}
div#cgit table.blame div.alt:nth-child(even) {
- background: #eee;
+ background: #fff5e6;
}
div#cgit table.blame div.alt:nth-child(odd) {
- background: white;
+ background: #fff5e6;
}
div#cgit table.blame td.lines > div {
@@ -375,14 +380,14 @@ div#cgit table.bin-blob {
div#cgit table.bin-blob th {
font-family: monospace;
white-space: pre;
- border: solid 1px #777;
+ border: solid 1px goldenrod;
padding: 0.5em 1em;
}
div#cgit table.bin-blob td {
font-family: monospace;
white-space: pre;
- border-left: solid 1px #777;
+ border-left: solid 1px goldenrod;
padding: 0em 1em;
}
@@ -403,7 +408,7 @@ div#cgit div.cgit-panel {
div#cgit div.cgit-panel table {
border-collapse: collapse;
border: solid 1px #aaa;
- background-color: #eee;
+ background-color: papayawhip;
}
div#cgit div.cgit-panel th {
@@ -605,7 +610,7 @@ div#cgit ul.pager li {
}
div#cgit ul.pager a {
- color: #777;
+ color: goldenrod;
}
div#cgit ul.pager .current {
@@ -649,11 +654,11 @@ div#cgit div.footer {
margin-top: 0.5em;
text-align: center;
font-size: 80%;
- color: #ccc;
+ color: goldenrod;
}
div#cgit div.footer a {
- color: #ccc;
+ color: goldenrod;
text-decoration: none;
}
@@ -730,7 +735,7 @@ div#cgit table.stats td.total {
div#cgit table.stats td.sum {
color: #c00;
font-weight: bold;
-/* background-color: #eee; */
+ /*background-color: #eee; */
}
div#cgit table.stats td.left {
@@ -879,3 +884,9 @@ div#cgit table.ssdiff td.space {
div#cgit table.ssdiff td.space div {
min-height: 3em;
}
+
+div#cgit div.content pre>code {
+ background-color: #ffe;
+ padding: 1ch;
+ display: block;
+}
diff --git a/cgitrc b/cgitrc
new file mode 100644
index 0000000..f58dcb7
--- /dev/null
+++ b/cgitrc
@@ -0,0 +1,45 @@
+# /etc/cgitrc -*- conf -*-
+
+root-title=git.acdw.net
+root-desc=personal projects of acdw
+
+# Paths to static resource in Nginx root
+css=/cgit.css
+#logo=/cgit.png
+logo=/avatar.png
+
+clone-url=git://$HTTP_HOST/$CGIT_REPO_URL
+snapshots=tar.gz zip
+
+enable-commit-graph=1
+repository-sort=age
+branch-sort=age
+
+max-repodesc-length=100
+
+section-from-path=1
+max-repo-count=100
+
+mimetype.gif=image/gif
+mimetype.html=text/html
+mimetype.jpg=image/jpeg
+mimetype.jpeg=image/jpeg
+mimetype.pdf=application/pdf
+mimetype.png=image/png
+mimetype.svg=image/svg+xml
+
+# enable git config
+enable-git-config=1
+# remove .git from URLs and repo list
+remove-suffix=1
+# Root for all cgit links
+virtual-root=/
+
+# READMEs
+readme=:README.md
+readme=:readme.txt
+readme=:README
+about-filter=/usr/bin/cgit-about-filter.sh
+
+# Folder with all my repos
+scan-path=/git/
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..72904ce
Binary files /dev/null and b/favicon.ico differ
--
cgit 1.4.1-21-gabe81