aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-07-05 22:37:01 +0530
committerAkshay Nair <phenax5@gmail.com>2026-07-05 22:37:01 +0530
commit4d5182ad994c3bee390f3c21af4c43fc24428eef (patch)
treedb4f6a71520c4b948c6a48a6d27d4a4dbe1afbaf
parentc20d74cb5793d5821eadb2f96ac2e8e336e9a94a (diff)
downloadbacchus-remote-4d5182ad994c3bee390f3c21af4c43fc24428eef.tar.gz
bacchus-remote-4d5182ad994c3bee390f3c21af4c43fc24428eef.zip
Add category command and styles
Diffstat (limited to '')
-rwxr-xr-xcgit/ssh/git-shell-commands/list15
-rwxr-xr-xcgit/ssh/git-shell-commands/set-category28
-rw-r--r--cgit/static/cgit.css17
-rwxr-xr-xsetup.sh4
4 files changed, 44 insertions, 20 deletions
diff --git a/cgit/ssh/git-shell-commands/list b/cgit/ssh/git-shell-commands/list
index 804a488..8a924c9 100755
--- a/cgit/ssh/git-shell-commands/list
+++ b/cgit/ssh/git-shell-commands/list
@@ -1,13 +1,8 @@
#!/usr/bin/env sh
-ls -1 /git | while IPS="" read name; do
- echo "$name"
- printf " description: "
- if [ -f "/git/${name}/description" ]; then
- cat "/git/${name}/description"
- else
- echo "<no description>"
- fi
- echo ""
-done
+git_dir=/git
+
+ls -1 "$git_dir" | while IPS="" read name; do
+ echo "$name||||$(cat "${git_dir}/${name}/description" 2>/dev/null)"
+done | column -t -d -s "||||"
diff --git a/cgit/ssh/git-shell-commands/set-category b/cgit/ssh/git-shell-commands/set-category
new file mode 100755
index 0000000..7f74b94
--- /dev/null
+++ b/cgit/ssh/git-shell-commands/set-category
@@ -0,0 +1,28 @@
+#!/usr/bin/env sh
+
+set -eu
+
+if [ $# -lt 1 ]; then
+ echo "Usage: set-category <name> [category]" 1>&2
+ exit 1
+fi
+
+repo_name="$1";
+[ -z "$repo_name" ] && echo "Error: empty repo name" 1>&2 && exit 1
+(echo "$repo_name" | grep -q "^[A-Za-z0-9_-]\+$" 2>/dev/null) || (echo "Error: invalid repo name" 1>&2 && exit 1)
+
+category="${2:-""}";
+repo_dir="/git/${repo_name}.git"
+
+if ! [ -d "$repo_dir" ]; then
+ echo "Error: $repo_name doesn't exist" 1>&2
+ exit 1;
+fi
+
+if [ -z "$category" ]; then
+ git -C "$repo_dir" config unset gitweb.category
+else
+ git -C "$repo_dir" config set gitweb.category "$category"
+fi
+
+echo "Done"
diff --git a/cgit/static/cgit.css b/cgit/static/cgit.css
index 4ee370d..2fa54e2 100644
--- a/cgit/static/cgit.css
+++ b/cgit/static/cgit.css
@@ -173,9 +173,11 @@ div#cgit table.list tr.logheader {
}
div#cgit table.list tr:nth-child(even) {
- background: #161616;
+ background: #181818;
+}
+div#cgit table.list tr:nth-child(odd) {
+ background: #121212;
}
-div#cgit table.list tr:nth-child(odd) { }
div#cgit table.list tr:hover {
background: #333;
@@ -189,12 +191,8 @@ div#cgit table.list tr.nohover:hover {
background: #222;
}
-div#cgit table.list tr.nohover-highlight:hover:nth-child(even) {
- background: #f7f7f7;
-}
-
-div#cgit table.list tr.nohover-highlight:hover:nth-child(odd) {
- background: black;
+div#cgit table.list tr.nohover-highlight {
+ background: #000;
}
div#cgit table.list th {
@@ -618,7 +616,8 @@ div#cgit .right {
div#cgit table.list td.reposection {
font-style: italic;
- color: #888;
+ color: var(--color-accent-2);
+ font-weight: bold;
}
div#cgit a.button {
diff --git a/setup.sh b/setup.sh
index 7e1316f..3e39d40 100755
--- a/setup.sh
+++ b/setup.sh
@@ -24,6 +24,8 @@ start() {
# dc up nginx-proxy -d
}
+cache_clear() { services exec cgit sh -c 'rm -rf /var/cache/cgit/*'; }
+
startfg() {
services build --pull
stop || true
@@ -86,7 +88,7 @@ update() {
cmd="$1"; shift;
case "$cmd" in
- update|start|startfg|stop|services|core) "$cmd" "$@" ;;
+ update|start|startfg|stop|services|core|cache_clear) "$cmd" "$@" ;;
configure|configure_firewall|configure_user|configure_fs|configure_packages|configure_git) "$cmd" "$@" ;;
*) echo "Invalid command: $cmd"; exit 1 ;;
esac