aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-15 13:48:32 +0100
committerLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-15 13:48:32 +0100
commit6f080713489cfc11bfc4fc77b57ea9398bef424b (patch)
tree35fc2a7e96aba5fc5159b2b664e105fde2b47da7
parented7a5cfe5508f3b7b1f79149c4436679b191f4fd (diff)
downloadcgit-oci-6f080713489cfc11bfc4fc77b57ea9398bef424b.tar.gz
cgit-oci-6f080713489cfc11bfc4fc77b57ea9398bef424b.tar.bz2
cgit-oci-6f080713489cfc11bfc4fc77b57ea9398bef424b.tar.lz
cgit-oci-6f080713489cfc11bfc4fc77b57ea9398bef424b.zip

feat: things!! :3

-rw-r--r--.gitignore1
-rw-r--r--Containerfile13
-rw-r--r--compose.yml2
-rw-r--r--image/Caddyfile2
-rw-r--r--image/cgitrc7
-rwxr-xr-ximage/filters/about-formatting27
-rwxr-xr-x[-rw-r--r--]image/filters/email-libravatar.lua0
-rwxr-xr-x[-rw-r--r--]image/filters/syntax-highlighting.sh0
8 files changed, 46 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index ba8c1d6..c22bfdb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/cgit
/.env
+/markdown-tool/target
diff --git a/Containerfile b/Containerfile
index b24bf60..dc7864a 100644
--- a/Containerfile
+++ b/Containerfile
@@ -1,3 +1,10 @@
+FROM docker.io/alpine:latest AS markdown-tool
+RUN apk add --no-cache cargo
+COPY markdown-tool /md-tool
+WORKDIR /md-tool
+RUN cargo b -r
+RUN cp target/release/markdown-tool /usr/bin/markdown-tool
+
FROM docker.io/alpine:latest AS base
WORKDIR /root
@@ -69,14 +76,14 @@ CMD ["sh", "-c", "/usr/local/bin/prepare-container.sh && sh -c 'sleep 1 && chgrp
FROM base AS with-fmt
RUN apk add --no-cache py3-markdown py3-docutils groff
-RUN echo -ne 'about-filter=/usr/lib/cgit/filters/about-formatting.sh\n' >> /etc/cgitrc.default
+ADD image/filters/about-formatting /usr/lib/cgit/filters/extra/about-formatting
+COPY --from=markdown-tool /usr/bin/markdown-tool /usr/bin/markdown-tool
FROM with-fmt AS with-highlighting
RUN apk add --no-cache highlight
ADD image/filters/syntax-highlighting.sh /usr/lib/cgit/filters/extra/syntax-highlighting.sh
ADD image/filters/email-libravatar.lua /usr/lib/cgit/filters/extra/email-libravatar.lua
-RUN chmod +x /usr/lib/cgit/filters/syntax-highlighting-uwu.sh
-RUN echo -ne 'source-filter=/usr/lib/cgit/filters/syntax-highlighting-uwu.sh\n' >> /etc/cgitrc.default
+RUN chmod +x /usr/lib/cgit/filters/extra/syntax-highlighting.sh
FROM with-highlighting AS full
# with nice userland aswell
diff --git a/compose.yml b/compose.yml
index a10ed22..9980fd1 100644
--- a/compose.yml
+++ b/compose.yml
@@ -11,7 +11,7 @@ services:
# Copy these directories from the container first, then uncomment to modify things:
# - ./cgit/caddy:/etc/caddy:ro
# - ./cgit/html-converters:/usr/lib/cgit/filters/html-converters:ro
- # - ./cgit/extra-filters:/usr/lib/cgit/filters/extra:ro
+ # - ./cgit/extra-filters:/usr/lib/cgit/filters/extra:ro # consider specifying each file rather than the whole dir!!
ports:
- 127.0.0.1:18080:80
- 127.0.0.1:12222:22
diff --git a/image/Caddyfile b/image/Caddyfile
index 56f89a0..82e6020 100644
--- a/image/Caddyfile
+++ b/image/Caddyfile
@@ -17,6 +17,8 @@ http:// {
}
}
+ # you may want to handle /assets/md.css (for example doing a rewrite to /cgit-assets.git/plain/markdown.css) if you use the default markdown handler
+
reverse_proxy unix//run/fcgiwrap/fcgiwrap.sock {
transport fastcgi {
env DOCUMENT_ROOT /usr/share/webapps/cgit
diff --git a/image/cgitrc b/image/cgitrc
index 61a5944..6214b74 100644
--- a/image/cgitrc
+++ b/image/cgitrc
@@ -9,7 +9,7 @@ cache-size=1000
# The clone prefixes, used to show the user where to clone from
clone-prefix=https://git.estrogen.zone ssh://git@git.estrogen.zone
-# Use /cgit.css or https://git.estrogen.zone/cgit-assets.git/plain/cgit.css if you don't have this repo available
+# Use /cgit.css or https://git.estrogen.zone/cgit-assets.git/plain/cgit.css if you don't have this repo on your cgit
css=/cgit-assets.git/plain/cgit.css
# Specify your own icon's URL here
@@ -55,9 +55,12 @@ readme=:README.rst
readme=:readme.rst
readme=:README.md
readme=:readme.md
+readme=:README.txt
+readme=:readme.txt
readme=:README
readme=:readme
#readme=:README.html
+#readme=:readme.html
# if cgit messes up links, use a virtual-root. For example, cgit.example.org/ has this value:
virtual-root=/
@@ -89,7 +92,7 @@ email-filter=lua:/usr/lib/cgit/filters/extra/email-libravatar.lua
# commit-filter=exec:/usr/lib/cgit/filters/extra/commit.sh
# Handle the about pages
-about-filter=/usr/lib/cgit/filters/about-formatting.sh
+about-filter=/usr/lib/cgit/filters/extra/about-formatting.sh
# Handle syntax highlighting
source-filter=/usr/lib/cgit/filters/syntax-highlighting-uwu.sh
diff --git a/image/filters/about-formatting b/image/filters/about-formatting
new file mode 100755
index 0000000..edc7ec2
--- /dev/null
+++ b/image/filters/about-formatting
@@ -0,0 +1,27 @@
+#!/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.
+
+# Markdown support requires python and markdown-python.
+# RestructuredText support requires python and docutils.
+# Man page support requires groff.
+
+# 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 )
+
+cd "$(dirname $0)/html-converters/"
+case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in
+ *.markdown|*.mdown|*.md|*.mkd) exec /usr/bin/markdown-tool; ;;
+ *.rst) exec ./rst2html; ;;
+ *.[1-9]) exec ./man2html; ;;
+ *.htm|*.html) exec cat; ;;
+ *.txt|*) exec ./txt2html; ;;
+esac
diff --git a/image/filters/email-libravatar.lua b/image/filters/email-libravatar.lua
index 5e8554e..5e8554e 100644..100755
--- a/image/filters/email-libravatar.lua
+++ b/image/filters/email-libravatar.lua
diff --git a/image/filters/syntax-highlighting.sh b/image/filters/syntax-highlighting.sh
index 46ad2bb..46ad2bb 100644..100755
--- a/image/filters/syntax-highlighting.sh
+++ b/image/filters/syntax-highlighting.sh