From 0fc1cb64def2ac7c0e234670d2c72bd71107a818 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Tue, 26 Jun 2018 23:32:40 +0200 Subject: Initial commit --- README.md | 16 +++++++++++ apache/cgit.conf | 56 ++++++++++++++++++++++++++++++++++++ etc/cgitrc | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ lib/email-filter.py | 28 ++++++++++++++++++ www/assets/content.txt | 1 + www/cgit.css | 1 + www/cgit.png | 1 + www/favicon.ico | 1 + www/fonts/content.txt | 1 + www/head.html | 15 ++++++++++ www/head.php | 5 ++++ www/lirionnet.css | 6 ++++ www/nav.php | 1 + www/robot.txt | 1 + www/update | 13 +++++++++ 15 files changed, 224 insertions(+) create mode 100644 README.md create mode 100644 apache/cgit.conf create mode 100644 etc/cgitrc create mode 100644 lib/email-filter.py create mode 100644 www/assets/content.txt create mode 100644 www/cgit.css create mode 120000 www/cgit.png create mode 120000 www/favicon.ico create mode 100644 www/fonts/content.txt create mode 100644 www/head.html create mode 100644 www/head.php create mode 100644 www/lirionnet.css create mode 120000 www/nav.php create mode 120000 www/robot.txt create mode 100755 www/update diff --git a/README.md b/README.md new file mode 100644 index 0000000..d39d562 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +## Objective + +This is just a mirror of what few adjustments I made to cgit to host my own repository. + +Some of this just reflects mechanisms - so it serves two simple purposes: + +1. For myself: reminder what I did +2. For others: kickoff to your own customisation + +## Folders + +* **apache:** The apache config file +* **www:** The www host referenced in the apache file; contains the CSS and stuff +* **lib:** Your cgit lib folder, most likely /usr/lib/cgit when coming from + a distro package +* **etc:** cgit's own configuration file(s) diff --git a/apache/cgit.conf b/apache/cgit.conf new file mode 100644 index 0000000..30c9d04 --- /dev/null +++ b/apache/cgit.conf @@ -0,0 +1,56 @@ +#vim:syntax=apache + + + + ServerName git.lirion.de + ServerAlias git.lirion.de + ServerSignature Off + + RewriteEngine on + RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] + RewriteRule ^(.*)$ http://%1/$1 [R=301,L] + RewriteCond %{HTTPS} !=on + RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [NE,R,L] + + + header set Public-Key-Pins 'pin-sha256="NxMynxRVjjSnl8BnON+6WwexY53HOyKtctua48Am6xA=";pin-sha256="8cwqjzxOlLuW9OGaHAj5GG6DCgZdXEd+OB9UJPWV9KE=";max-age=2419200;' + ServerAdmin webmaster@lirion.net + ServerName git.lirion.de + ServerAlias git.lirion.de git.lirion.net + # not my true DocRoot. Remember to replace this, and pay respect to the FHS, kids! + DocumentRoot "/www/cgit" + + + AllowOverride None + Options ExecCGI FollowSymlinks + Order allow,deny + Allow from all + + + Alias /cgit.css "/www/cgit/cgit.css" + Alias /cgit.png "/www/cgit/cgit.png" + Alias /favicon.ico "/www/cgit/favicon.ico" + Alias /assets "/www/cgit/assets" + Alias /fonts "/www/cgit/fonts" + ScriptAlias / "/usr/lib/cgit/cgit.cgi/" + + ErrorLog ${APACHE_LOG_DIR}/git.lirion.de-error.log + LogLevel warn + CustomLog ${APACHE_LOG_DIR}/git.lirion.de-access.log combined + SSLEngine on + # same as above - this is not the true entry. Adjust! + SSLCertificateKeyFile /ssl/private/git.lirion.de.key + SSLCertificateFile /ssl/public/git.lirion.de-chain.pem + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + diff --git a/etc/cgitrc b/etc/cgitrc new file mode 100644 index 0000000..7a9ac27 --- /dev/null +++ b/etc/cgitrc @@ -0,0 +1,78 @@ +#vim:syntax=config +css=/cgit.css +logo=/cgit.png +favicon=/favicon.ico +root-title=repositories @ lirion.de +root-desc=...because we can. hosted in vogtland, saxony! +enable-index-owner=1 +enable-http-clone=0 +enable-index-links=1 +enable-commit-graph=1 +enable-log-filecount=1 +enable-log-linecount=1 +cache-root=/var/cache/cgit +case-sensitive-sort=0 +header=/www/cgit/head.html +head-include=/www/cgit/lirionnet.css +#favicon=/pommes.ico +#logo=img(mylogo.png +max-stats=quarter +snapshots=tar.bz2 +#source-filter=/usr/lib/cgit/filters/syntax-highlighting.py +source-filter=/usr/lib/cgit/filters/syntax-highlighting.sh +about-filter=/usr/lib/cgit/filters/about-formatting.sh +email-filter=/usr/lib/cgit/filters/email-filter.py +readme=master:README.md +readme=master:readme.md +readme=master:README.rst +readme=master:readme.rst +readme=master:README.html +readme=master:readme.html +readme=master:README.htm +readme=master:readme.htm +readme=master:README.txt +readme=master:readme.txt +readme=master:README +readme=master:readme +readme=master:INSTALL.md +readme=master:install.md +readme=master:INSTALL.mkd +readme=master:install.mkd +readme=master:INSTALL.rst +readme=master:install.rst +readme=master:INSTALL.html +readme=master:install.html +readme=master:INSTALL.htm +readme=master:install.htm +readme=master:INSTALL.txt +readme=master:install.txt +readme=master:INSTALL +readme=master:install +section=os +repo.url=systeminfo +# This is obfuscated. Remember the FHS, kids! +repo.path=/git/systeminfo.git +repo.desc=Gives you system information on a Linux machine. Born from checks inside docker, yet to grow. +repo.owner=H. P. +#repo.readme=README.md +section=server +repo.url=gitlab-apache +repo.path=/git/gitlab-apache.git +repo.desc=Setup for a gitlab integrated as vhost into an already running apache, i.e. don't fork yet another non-distro web server thingy making maintenance and security a hell of a job. +repo.url=mp3dir2html +repo.path=/git/mp3dir2html.git +repo.desc=Creates PHP/HTML from music directories +repo.owner=H. P. +repo.url=infinoted-init +repo.path=/git/infinoted.git +repo.desc=Infinoted SysVinit script and whatever else +repo.owner=H. P. +repo.url=cgit +repo-path=/git/cgit.git +repo.desc=My few adjustments to my own cgit instance. +repo.owner=H. P. +section=desktop +repo.url=hattrick +repo.path=/git/hattrick.git +repo.desc=Personal hattrick.org scripts +repo.owner=H.P. diff --git a/lib/email-filter.py b/lib/email-filter.py new file mode 100644 index 0000000..1b44e1e --- /dev/null +++ b/lib/email-filter.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +# Please prefer the email-gravatar.lua using lua: as a prefix over this script. This +# script is very slow, in comparison. +# +# This script may be used with the email-filter or repo.email-filter settings in cgitrc. +# +# 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 ) +# +# This simply receives text on stdin and replaces any occurrence of "@" by +# " _ " to obfuscate emails. Not the most sophisticated algorithm (for now), +# but laziness and time are two important factors. +# It still helps with receiving email only from the wealthy Nigerian princes. +# I need to make money, too. + +from sys import stdin +text = stdin.read().strip() +text=text.replace("@", " _ ") + +print(text) diff --git a/www/assets/content.txt b/www/assets/content.txt new file mode 100644 index 0000000..ed0f2a4 --- /dev/null +++ b/www/assets/content.txt @@ -0,0 +1 @@ +the assets/ folder diff --git a/www/cgit.css b/www/cgit.css new file mode 100644 index 0000000..df048d1 --- /dev/null +++ b/www/cgit.css @@ -0,0 +1 @@ +/* here be a symlink to cgit's native CSS */ diff --git a/www/cgit.png b/www/cgit.png new file mode 120000 index 0000000..1d72e3c --- /dev/null +++ b/www/cgit.png @@ -0,0 +1 @@ +the actual cgit logo \ No newline at end of file diff --git a/www/favicon.ico b/www/favicon.ico new file mode 120000 index 0000000..baee530 --- /dev/null +++ b/www/favicon.ico @@ -0,0 +1 @@ +your favicon \ No newline at end of file diff --git a/www/fonts/content.txt b/www/fonts/content.txt new file mode 100644 index 0000000..3c61089 --- /dev/null +++ b/www/fonts/content.txt @@ -0,0 +1 @@ +the actual fonts folder diff --git a/www/head.html b/www/head.html new file mode 100644 index 0000000..fedb311 --- /dev/null +++ b/www/head.html @@ -0,0 +1,15 @@ +
+

git.lirion.de

+

Of git, get, and gud

+
+ diff --git a/www/head.php b/www/head.php new file mode 100644 index 0000000..8d40e16 --- /dev/null +++ b/www/head.php @@ -0,0 +1,5 @@ +
+

git.lirion.de

+

Of git, get, and gud

+
+ diff --git a/www/lirionnet.css b/www/lirionnet.css new file mode 100644 index 0000000..64d8b61 --- /dev/null +++ b/www/lirionnet.css @@ -0,0 +1,6 @@ + + + + diff --git a/www/nav.php b/www/nav.php new file mode 120000 index 0000000..bbf3731 --- /dev/null +++ b/www/nav.php @@ -0,0 +1 @@ +symlink to the navigation fragment of the main website code \ No newline at end of file diff --git a/www/robot.txt b/www/robot.txt new file mode 120000 index 0000000..4e330c7 --- /dev/null +++ b/www/robot.txt @@ -0,0 +1 @@ +cgit's robot.txt \ No newline at end of file diff --git a/www/update b/www/update new file mode 100755 index 0000000..b118e70 --- /dev/null +++ b/www/update @@ -0,0 +1,13 @@ +#!/bin/sh + +php head.php > head.html + +# style.css +# This will be included in the cgit head itself, so... well. Let's wrap it. +echo '' >> lirionnet.css +for i in "/fonts/telex-ht-regular.css" "/fonts/alte-din.css" "/fonts/elusive-icons.css" +do + echo "" >> lirionnet.css +done -- cgit v1.2.3